users@glassfish.java.net

Glassfish v2 deployment race condition?

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 Mar 2008 02:54:42 PST

Hi,

I'm trying to understand how gfv2 implements deployment (jsr88). I understand that you can provide a callback event by registering progress listeners from progress object when deploying an application:

===========================================================
Custom code:

ProgressObject progress = deploymentManager.distribute(targets,
                new File(file), null);
progress.addProgressListener(progressListener);


===========================================================
SunDeploymentManager.java (Line 1339):

ProgressObject deploy(Target[] targetList,
           AbstractArchive moduleArchive, AbstractArchive planArchive, Properties presetOptions)
           throws IllegalStateException {
 ...

progressObj = getDeploymentFacility().deploy(targetList, moduleArchive, planArchive, options);

}


===========================================================
DeploymentFacilityImpl.java (Line 167)

public JESProgressObject deploy(Target[] targets, Archive source, Archive deploymentPlan, Map deploymentOptions) {
...
        ProgressObjectImpl progressObject = new DeployAction(targetList);
...

        progressObject.setCommand(CommandType.DISTRIBUTE, args);
        Thread newThread = new Thread(progressObject);
        newThread.start();
        return progressObject;
}


===========================================================

How does glassfish prevent race condition from happening when running DeploymentFacilityImpl.deploy (as new thread is created and started before you could attach progress listeners)?

Cheers.
[Message sent by forum member 'lyeung' (lyeung)]

http://forums.java.net/jive/thread.jspa?messageID=264553