Pencarian

Rss Posts

 

 

 

Discover a Bit of JavaOne

Sep 03, 2010

If you’ll be in the San Francisco area during JavaOne week, and you’re interesting in attending some of JavaOne, but don’t want to pay for the entire conference, consider purchasing a JavaOne / Oracle Develop Discover pass. The base Discover pass costs just $75 and provides you with entry into the keynote addresses, the exhibition halls, the Mason Street Tent (where I’ll be spending quite a lot of time), Oracle Mix, and more. If you’d like to attend a few sessions, consider the Discover Plus pass, which provides your choice of three OpenWorld or JavaOne / Oracle Develop sessions and some other extras, for $695.

Note that these prices are the pre-conference prices — you need to purchase your Discover pass by September 18 to get these rates. If you purchase your pass at the conference, the cost will be $125 for the Discover pass, and $795 for the Discover Plus pass.

The Mason Street Tent will be in part a gathering center for the Java community. As java.net Community Manager Sonya Barry recently reported, the tent will be the center of java.net activity at JavaOne. Though I’ll be attending quite a lot of sessions, when I’m not attending a session, you’ll usually find me in the tent (probably writing a blog about the last session I attended, or chatting with the community, or writing a blog about one of those chats). Java User Group leaders are expected to be setting up shop near the java.net area, and the Oracle Technology Network will also be in the area. The OTN will be featuring a full schedule of interviews and talks with key members of the Java and broader open source communities as part of its Oracle Technology Network Live program.

You can get a sneak preview of JavaOne, including what’s going to be in the tent, this coming Tuesday, September 7, at 10 AM, Pacific Time, in a special edition of Justin Kestelyn’s TechCast Live. See the details in the JavaOne Conference Blog’s post JavaOne Preview on TechCast Live! (Tues., Sept. 7, 10am PT).

Still having doubts? Well, as Sonya notes, java.net will be located right next to the coffee and beer — so that should guarantee we’ll see you, right?

But, seriously, if you’d like to attend just some of JavaOne, do consider purchasing a JavaOne / Oracle Develop Discover pass. With everything that’s going to be going on in the tent, in the exhibition halls, and at the keynotes, how can you go wrong for just $75 (or $695 to be able to attend 3 sessions)?

Java Today

In the Aquarium, Alexis Moussine-Pouchkine announces a New GlassFish 3.1 Screencast: Application-scoped resources:

This short screencast demonstrates the new application-scoped resources feature available starting with Milestone 4 of GlassFish 3.1 (the demo used promoted build #17). Such resources are bound to a module (war, ear, ejb) and as such they are created on deploy and destroyed when the module is undeployed. They are defined in a file called glassfish-resources.xml (schema-constrained) and shipped with the archive…

At Hudson Labs, Kohsuke Kawaguchi talks about Recent label and matrix project improvement:

Today, I?d highlight two recent improvements to the label and matrix projects. When you have multiple slaves in your Hudson build farm, you can use labels to classify slaves by their capability/environment/architecture/etc. For example, your one slave might have ?32bit? and ?windows? label, while another one might have ?linux?, ?ubuntu?, and ?64bit.? (with plugins like platform-labeler plugin, you can attach labels automatically, too.) Or if you do Selenium testing, you might add browser names as labels to indicate which slave has which browser available…

Robilad announces the availability of JVM Language Summit 2010 Recordings On Oracle Media Network:

The recordings of the majority of the sessions from the JVM Language Summit 2010 have been uploaded to the Oracle Media Network. Paul Leahy has compiled a list of session recordings and their corresponding abstracts. Slide decks for most of the sessions are available on the JVM Language Summit wiki

James Sugrue reports on Eclipse innovations in IDE 2.0: The Age of Intelligent IDEs -

The latest innovation in the Eclipse space that I’d like to share with you is Code Recommenders. Already available as a plugin for Eclipse, Code Recommenders provides intelligent code completion. Rather than giving you all possible methods for code completion, this plugin proposes the methods that you probably need at the top of the list, with a rating of how applicable each method is. To see Code Recommenders in action, see the following screencast


Poll

Our current java.net poll asks What threat does further fragmentation of the Java language pose? Voting will be open until Monday.


Spotlights

Our new java.net Spotlight is from the JavaOne Conference Blog, JavaOne Preview on TechCast Live! (Tues., Sept. 7, 10am PT):

You’ve read the blogs, you’ve consumed the tweets and Facebook updates. Now how about hearing from some live humans? Next Tuesday morning (Sept. 7, 10am PT), Oracle Technology Network offers you a JavaOne preview via a live video chat with Sharat Chandar and Tori Wieldt, two people intimately familiar with the content and community aspects of the conference. You’ll get insights into the content contribution process, hear about particularly interesting technical sessions and BOFs, and get a sneak peek of the contents of the Mason St. tent, where Oracle Technology Network will host the community in all its glory…

We’re also still highlighting java.net Community Manager Sonya Barry’s JavaOne Conference Blog post Java.net Activities at JavaOne:

I’m excited about JavaOne this year.  It’s going to be different in a lot of ways, but we are doing our best to ensure that the Java.net presence for the community is just as good if not better then previous years.  In years past Java.net has had a “community corner” booth in the JavaOne pavilion at Moscone… This time we’ll be housed in the Mason Street tent, which will be a large comfortable space for people from all of the technology communities to hang out, pick up swag, watch the videocasts, and see some live events too..,


Subscriptions and Archives: You can subscribe to this blog using the java.net Editor’s Blog Feed. You can also subscribe to the Java Today RSS feed and the java.net blogs feed. You can find historical archives of what has appeared the front page of java.net in the java.net home page archive.

Kevin Farnham

Twitter: @kevin_farnham

Grizzly Deployer (1.9.19) new features

Aug 07, 2010

It has been a while since a blog about Grizzly, I was too busy adding new features. The Grizzly Deployer’s community grows and requested theses new features.

Here a quick list of the changes :

  • Websockets support
  • Watch folder
  • Can starts without applications to deploy
  • Can be embedded and extended easily
  • and few bug fixes (thanks to the community)

A little overview or remainder of what is Grizzly Deployer

Grizzly Deployer is a bundle of Grizzly project that act as a web container. It will allow you to deploy applications (war, servlet).
Works fine for Comet, Atmosphere, JSP applications … For more details, I suggest this link Introduction to the first release of Grizzly Deployer

First, lets take a look at the command line parameters.


Usage: com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer

  -a, --application=[path]    Application(s) path(s).

                              Application(s) deployed can be :
                              Servlet(s), war(s) and expanded war folder(s).
                              To deploy multiple applications
                              use File.pathSeparator

                              Example : -a /app.war:/servlet/web.xml:/warfolder/

  -p, --port=[port]           Runs Servlet on the specified port.
                              Default: 8080

  -c, --context=[context]     Force the context for a servlet.
                              Only valid for servlet deployed using
                              -a [path]/[filename].xml

  --dontstart=[true/false]    Won't start the server.
                              You will need to call the start method.
                              Useful for Unit testing.
                              Default : false

  --libraryPath=[path]        Add a libraries folder to the classpath.
                              You can append multiple folders using
                              File.pathSeparator

                              Example : --libraryPath=/libs:/common_libs

  --autodeploy=[path]         AutoDeploy to each applications.
                              You could add JSP support.
                              Just add a web.xml that contains Jasper

                              Example : --autodeploy=/autodeploy

  --webdefault=[path]         webdefault to be used by all applications, can be file or dir with multipe web.xmls.
                              If you want to add only one webdefault point it to web.xml file,
                              If you want multiple files to be included put them in one dir and provide this location here.

                              Example : --webdefault=webdefault.xml

  --cometEnabled=[true/false] Starts the AsyncFilter for Comet.
                              You need to active this for comet applications.
                              Default : false

  --websocketsEnabled=[true/false] Starts the AsyncFilter for Websockets.
                              You need to active this for websockets applications.
                              Default : false

  --forceWar=[true/false]     Force war's deployment over a expanded folder.
                              Will deploy the war instead of the folder.
                              Default : false

  --ajpEnabled=[true/false]   Enable mod_jk.
                              Default : false

  --watchInterval=[seconds]   Watch interval to scan for new applications to deploy in work folder.
                              Default : -1 ; disabled

  --watchFolder=[path]        Folder to scan for new applications to deploy in work folder
                              Default : none

Websocket support

The first feature added was Websockets support. It can be enabled at command line by using the parameter –websocketEnabled=true . That will allow you to deploy Websocket applications.

Watch folder

This feature is interesting, because most of the web container have it. Grizzly Deployer will watch a specific folder to applications to deploy. When this feature was added, I remove the need to specify a application to deploy by command line.
To enable this feature you need to use the command line parameter –watchFolder=[path]. It can be used with this other parameter : –watchInterval=[seconds].

The parameter –watchInterval is used to create a watchdog that will monitor the watch folder. If the parameter –watchInterval is not present, when Grizzly Deployer starts, it will check
all applications that are in the watch folder at launch time and will deploy them, but it won’t monitor the folder after that.

When both of theses parameters are used, it will create a watchdog that will deploy and undeploy application put in the watch folder, and remove from that folder. If you deploy an application at command line and put another application with the
same context name in the watch folder, the application in the watch folder won’t be deploy twice.

Embedded Grizzly Deployer

Grizzly Deployer could already be embedded trough his API, but we got few feedback about to make it simplier. The problem wasn’t the API, it just that most people will only use the main part of Grizzly Deployer : deploy a war.

So to make it easier and faster to implement, I did a little refactoring. We now have 2 main config classes we could use to launch an Embedded Grizzly Deployer : DeployerServerConfiguration and DeployableConfiguration.

DeployerServerConfiguration

That file is used to launch Grizzly Deployer. It contains the same command line parameters. In fact, at runtime, the command line parser use that classe.


    GrizzlyWebServerDeployer deployer = new GrizzlyWebServerDeployer();

    DeployerServerConfiguration conf = new DeployerServerConfiguration();
    conf.cometEnabled = true;
    conf.watchFolder="C:/temp/webapps/";
    conf.watchInterval=15;
    deployer.launch(conf);

Once grizzly Deployer is launched in your application, you can deploy a war later. For that, you use this class : DeployableConfiguration.


    DeployableConfiguration warConfig = new DeployableConfiguration();
    warConfig.location = "C:/temp/webapps/grizzly-jmaki.war";

    deployer.deployApplication(warConfig);

You can follow me on Twitter.

Heiko Seeberger: How to setup a Scala project with SBT and IDEA

Aug 07, 2010

Today I helped my mate Bernd Kolb setting up a simple Scala project. He had been struggling far too long with various options like Maven, SBT, Eclipse and Intellij IDEA. If I remember correctly it only took a 30 minutes conf call to setup a simple Scala and Lift project with SBT and IDEA. But there are quite a few things to know in order to be successful which I am going to describe here in a step-by-step tutorial. I hope you find it useful. Please let me know any issues.

Why SBT and IDEA?

Why not Maven and Eclipse? Or Ant and Netbeans? Or …? First, we have to make a choice. Second, SBT and IDEA are currently the best build tool and the best IDE for Scala. SBT is written specifically for Scala and offers very fast compilation, interactive mode for continuous compilation, testing, etc., integration for Scala test tools like specs and ScalaTest, cross compiling against different Scala versions and many more. While the Scala IDE for Eclipse recently has made nice progress and the Netbeans plugin looks good, IDEA still offers the best Scala plugin with many features known from a Java IDE, e.g. refactroings, code completion, code navigation, etc.

Preparations

Java 5 or 6 is assumed. Get the SBT launcher and follow the instructions to set it up. Install IDEA 9.0.3 and use its plugin manager to install the Scala plugin. Here we go!

1. Create a SBT project

Create a folder for your project, cd there and run SBT. You will be asked the following questions. Answer like I did or chose different values (except for the Scala version).

Project does not exist, create new project? (y/N/s) y

Name: simple

Organization: localhost

Version [1.0]:

Scala version [2.7.7]: 2.8.0

sbt version [0.7.4]:

Now SBT will download Scala 2.7.7 as well as some other libraries for internal use. And it will download Scala 2.8.0 which is used to build your project.

As soon as the downloads are finished, you are in SBT’s interactive mode. At the prompt enter compile, then ~test (press enter to leave the triggered mode) and then help to make yourself familiar with the features.

Looking at your project in the file system, you will notice a layout similar to Maven: Scala sources go into src/main/scala, Scala tests go into src/test/scala and artifacts go into target. If your project looks different from the one at the right, you probably did not run compile or test. But as it is important to run your project against the same version as it was compiled against, there is a Scala_2.8.0 folder between the target and the classes, test-classes etc.

Update

Thanks to Comments from Bart and Mikko I looked into the sbt-idea-plugin which makes it possible to create the project files for IDEA from SBT. While it is still under active development and there are some minor issues, the current snapshot release 0.1 already produces usable IDEA project files. So you could just go for that plugin and skip the next two steps.

2. Create an IDEA project

Now you have to create an IDEA project on top of your SBT project.

Choose File > New Project …, select Create project from scratch and continue.

Then pick your project folder for Project files location and continue.

Then enter src/main/scala as path for the source directory and continue.

Now it is getting a little tricky!

Select Scala from the list of technologies.

Ignore the erroneous combo for the Version.

Choose Pick files from disk and select scala-compiler.jar and scala-library.jar form project/boot/scala-2.8.0/lib.

Then change the Name to scala-2.8.0 and click Finish.

3. Adjust IDEA project settings

Now you have make some adjustments to align SBT’s and IDEA’s project layout.

Choose Modules on the left and navigate to the Sources tab. Add src/main/resources to the Sources (blue) and src/test/scala and src/test/resources to the Test Sources (green). Exclude (red) .idea, lib, project/boot and target.

?

Next go to the Paths tab and select target/scala_2.8.0/classes for the Output path and target/scala_2.8.0/test-classes for the Test output path.

?

Then choose the Scala facet from the mid column (below the one and only module simple) and unchek Use Scala compilers ….

That’s it! Now you are ready to go.

4. Give it a try

In IDEA go to the src/main/scala folder and choose New > Scala Class from the context menu. Call it Hello and make it an Object.

In the editor delete the package statement and enter the following code:

object Hello {

??def main(args: Array[String]) {

????println(“Hello!”)

??}

}

From the context menu choose Run Hello.main(). IDEA will build your project and then run this object.

After that go to SBT and enter ~run. Watch the output and look for the Hello! message. Then change the message in the code, e.g. to Hello, world!. As you have told SBT to use triggered run by prefixing whith the tilda, your project will be incrementally built and the Hello object run again: Watch the output.

Have fun with Scala, SBT and IDEA!

Serialization surprises

Aug 06, 2010

CONTEXT

I want to share a problem that we had in our project. We were doing a real-time “Profits and Loss” server (P&L). The server sends stock updates to all the users subscribed to the stocks, basically as Google Finance or Yahoo Finance.

SIMPLE IMPLEMENTATION

I will used a basic approach (no aggregation and no optimization) to explain the problem that we had with Serialization and Hessian.

The server always keep the last value on the stocks, because when a user ask for a quote we want to send back as soon as possible the
last value (from the cache) that we had on that stock).

We kept the stock prices (BID and ASK) in a simple object : SymbolSerializable.

When a update is received for a stock, we update the values in his SymbolSerializable and send back the updated values to all
client subscribed to this stock.


...

symbol.setBid(update.getBid());
symbol.setAsk(update.getAsk());

...

for(Client client : clientList){
    client.sendUpdate(symbol);
}

....

It can’t be more simpler than that. The client will received each updates on his stocks.

The problems that we had was surprising. The clients were receiving the always the same price on a stock !

WHY ?

here an example :

stock : ABC

Updates :

1 : bid=10.25$, ask=10.50$
2 : bid=11.50$, ask=11.75$
3 : bid=12.00$, ask=12.15$

and the clients received :

1 : bid=10.25$, ask=10.50$
2 : bid=10.25$, ask=10.50$
3 : bid=10.25$, ask=10.50$

To debug our server we printed the values sent to the client, and we saw in the server’s logs that the values were corrects.

value sent to client :
bid=10.25$, ask=10.50$

value sent to client :
bid=11.50$, ask=11.75$

value sent to client :
bid=12.00$, ask=12.15$

Everything look fine, why it doesn’t work on the client side ?

INVESTIGATION/SOLUTION

The only thing that could cause the problem were our Serialization in the server.

I’ll show you four different test cases. See the implementations below.

  • #1 : Reference implementation using Serializable (failed)
  • #2 : Changed Serializable for Externalizable interface (failed)
  • #3 : Serializable using new (passed)
  • #4 : Serializable using reset (passed)
#1 : Serializable : Reference #2 : Externalizable #3 : Serializable with new #4 : Serializable with reset
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • All items read
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • bid= 0.0 ask= 0.0
  • All items read
  • bid= 0.0 ask= 0.0
  • bid= 1.0 ask= 1.0
  • bid= 2.0 ask= 2.0
  • bid= 3.0 ask= 3.0
  • bid= 4.0 ask= 4.0
  • bid= 5.0 ask= 5.0
  • bid= 6.0 ask= 6.0
  • bid= 7.0 ask= 7.0
  • bid= 8.0 ask= 8.0
  • bid= 9.0 ask= 9.0
  • All items read
  • bid= 0.0 ask= 0.0
  • bid= 1.0 ask= 1.0
  • bid= 2.0 ask= 2.0
  • bid= 3.0 ask= 3.0
  • bid= 4.0 ask= 4.0
  • bid= 5.0 ask= 5.0
  • bid= 6.0 ask= 6.0
  • bid= 7.0 ask= 7.0
  • bid= 8.0 ask= 8.0
  • bid= 9.0 ask= 9.0
  • All items read

Here the Serializable pojo


package ca.sebastiendionne.demo.model;

import java.io.Serializable;

public class SymbolSerializable implements Serializable {

    private static final long serialVersionUID = 7853892880704628717L;

    Double bid = null;
    Double ask = null;

    public SymbolSerializable(){
    }

    public Double getBid() {
        return bid;
    }
    public void setBid(Double bid) {
        this.bid = bid;
    }
    public Double getAsk() {
        return ask;
    }
    public void setAsk(Double ask) {
        this.ask = ask;
    }

    @Override
    public String toString() {
        return "bid = " + bid + "  ask=" + ask;
    }

}

Here the Externalizable pojo


package ca.sebastiendionne.demo.model;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class SymbolExternalizable implements Externalizable {
    private static final long serialVersionUID = 1853892880704628717L;

    Double bid = null;
    Double ask = null;

    public SymbolExternalizable(){

    }

    public Double getBid() {
        return bid;
    }
    public void setBid(Double bid) {
        this.bid = bid;
    }
    public Double getAsk() {
        return ask;
    }
    public void setAsk(Double ask) {
        this.ask = ask;
    }

    @Override
    public String toString() {
        return "bid = " + bid + "  ask=" + ask;
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        bid = (Double)in.readObject();
        ask = (Double)in.readObject();
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeObject(bid);
        out.writeObject(ask);
    }

}

For the test cases I use a for loop to create Symbol and serialized on the hard drive and unserialized them back.

Here the code for the test case #1 (used as reference)


package ca.sebastiendionne.demo;

import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import ca.sebastiendionne.demo.model.SymbolSerializable;

public class SerializationFailed {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("test.ser"))); 

        SymbolSerializable symbol = new SymbolSerializable();

        // dummy values
        symbol.setAsk(new Double(-1));
        symbol.setBid(new Double(-1));

        for(int i=0;i<10;i++){
            // update values
            symbol.setAsk(new Double(i));
            symbol.setBid(new Double(i));

            oos.writeObject(symbol);
            oos.flush();
        }

        oos.flush();
        oos.close();

        // read

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("test.ser")));

        try {
            Object obj = null;
            while((obj = ois.readObject())!=null){
                System.out.println((SymbolSerializable)obj);
            }
        } catch (EOFException e) {
            System.out.println("All items read");
        } catch(Exception e){
            e.printStackTrace();
        } finally {
            ois.close();
        }

    }

}

Here the code for the test case #2


package ca.sebastiendionne.demo;

import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import ca.sebastiendionne.demo.model.SymbolExternalizable;

public class SerializationFailed2 {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("test.ser"))); 

        SymbolExternalizable symbol = new SymbolExternalizable();

        // dummy values
        symbol.setAsk(new Double(-1));
        symbol.setBid(new Double(-1));

        for(int i=0;i<10;i++){
            // update values
            symbol.setAsk(new Double(i));
            symbol.setBid(new Double(i));

            oos.writeObject(symbol);
            oos.flush();
        }

        oos.flush();
        oos.close();

        // read

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("test.ser")));

        try {
            Object obj = null;
            while((obj = ois.readObject())!=null){
                System.out.println((SymbolExternalizable)obj);
            }
        } catch (EOFException e) {
            System.out.println("All items read");
        } catch(Exception e){
            e.printStackTrace();
        } finally {
            ois.close();
        }

    }

}

Here the code for the test case #3


package ca.sebastiendionne.demo;

import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import ca.sebastiendionne.demo.model.SymbolSerializable;

public class SerializationWithNew {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("test.ser"))); 

        SymbolSerializable symbol = new SymbolSerializable();

        // dummy values
        symbol.setAsk(new Double(-1));
        symbol.setBid(new Double(-1));

        for(int i=0;i<10;i++){
            // update values
            symbol.setAsk(new Double(i));
            symbol.setBid(new Double(i));

            SymbolSerializable symbol2 = new SymbolSerializable();
            symbol2.setAsk(symbol.getAsk());
            symbol2.setBid(symbol.getBid());

            oos.writeObject(symbol2);
            oos.flush();
        }

        oos.flush();
        oos.close();

        // read

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("test.ser")));

        try {
            Object obj = null;
            while((obj = ois.readObject())!=null){
                System.out.println((SymbolSerializable)obj);
            }
        } catch (EOFException e) {
            System.out.println("All items read");
        } catch(Exception e){
            e.printStackTrace();
        } finally {
            ois.close();
        }

    }

}

Here the code for the test case #4


package ca.sebastiendionne.demo;

import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import ca.sebastiendionne.demo.model.SymbolSerializable;

public class SerializationWithReset {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("test.ser"))); 

        SymbolSerializable symbol = new SymbolSerializable();

        // dummy values
        symbol.setAsk(new Double(-1));
        symbol.setBid(new Double(-1));

        for(int i=0;i<10;i++){
            // update values
            symbol.setAsk(new Double(i));
            symbol.setBid(new Double(i));

            oos.writeObject(symbol);
            oos.flush();
            oos.reset(); // magic line
        }

        oos.flush();
        oos.close();

        // read

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("test.ser")));

        try {
            Object obj = null;
            while((obj = ois.readObject())!=null){
                System.out.println((SymbolSerializable)obj);
            }
        } catch (EOFException e) {
            System.out.println("All items read");
        } catch(Exception e){
            e.printStackTrace();
        } finally {
            ois.close();
        }

    }

}

I can't say what is the performance impact if we use reset() on each updates sent. It is better to use new or reset ?

You can follow me on Twitter : http://twitter.com/survivant

QA#4: Java EE 6: Developers focus on business logic, Much lower TCO – by Johan Vos

Jul 28, 2010

Content available at: http://blogs.sun.com/arungupta/entry/qa_4_java_ee_6

JavaOne News Update 1

Jul 26, 2010


An update on some recent News on
JavaOne 2010.
As you know
JavaOne San Francisco is Sep 19-23, 2010.
The
Official page
has links to the
Registration Page
and the
Online Catalog.
News updates include:


A surprisingly useful & manageable Catalog-as-tweets
via
@javaoneconf


Availability of
Schedule Builder (post)


Open enrollment in
Java University (post)


Announcement of dates for JavaOne Brazil and JavaOne China (post).

• The day before there is a
MySQL Sunday!

• And, the
Duke Awards
submissions page seems to still be active.

Also, this year will be the 15th anniversary for Java, and the 5th for GlassFish.  Don’t know if there will be a BDay party for Java; still hoping we can put something together for GlassFish, we will see!

More related news are tagged
JavaOne.

Ngoprek Java

Mar 31, 2010

Rabu, 24 Maret 2010 ngoprek Java diisi saudara ghalih semester 2, pada saat itu peserta yang hadir cukup banyak sehingga suasana di labsi begitu meriah.
disini yang dibahas adalah membuat aplikasi konversi angka dengan Netbean java dan materi dapat dilihat di File materi Java

Java development 2.0: Gaelyk for Google App Engine

Jan 05, 2010

The introduction of the Google App Engine saw a wave of frameworks emerge to facilitate developing applications targeted for it. The Gaelyk framework, one such framework written in Groovy,nbsp;eases development of lightweight applicationsnbsp;that leverage a datastore. And the scalability you can achieve is impressive.