[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Locks on MainDeployerImpl
alesj
do-not-reply at jboss.com
Fri Feb 20 04:48:05 EST 2009
I guess if I just write lock the deploy and undeploy lists processing, you should be fine.
| Index: deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java
| ===================================================================
| --- deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java (revision 84459)
| +++ deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java (working copy)
| @@ -322,33 +322,41 @@
| @@ -623,13 +631,13 @@
| if (deployers == null)
| throw new IllegalStateException("No deployers");
|
| + List<DeploymentContext> undeployContexts = null;
| lockWrite();
| try
| {
| if (shutdown.get())
| throw new IllegalStateException("The main deployer is shutdown");
|
| - List<DeploymentContext> undeployContexts = null;
| if (undeploy.isEmpty() == false)
| {
| // Undeploy in reverse order (subdeployments first)
| @@ -640,21 +648,33 @@
| Collections.sort(undeployContexts, reverted);
| undeploy.clear();
| }
| - if (undeployContexts != null)
| - {
| - deployers.process(null, undeployContexts);
| - }
| + }
| + finally
| + {
| + unlockWrite();
| + }
|
| - try
| - {
| - processToDeploy();
| - }
| - catch (DeploymentException e)
| - {
| - throw new RuntimeException("Error while processing new deployments", e);
| - }
| + if (undeployContexts != null)
| + {
| + deployers.process(null, undeployContexts);
| + }
|
| - List<DeploymentContext> deployContexts = null;
| + try
| + {
| + processToDeploy();
| + }
| + catch (DeploymentException e)
| + {
| + throw new RuntimeException("Error while processing new deployments", e);
| + }
| +
| + List<DeploymentContext> deployContexts = null;
| + lockWrite();
| + try
| + {
| + if (shutdown.get())
| + throw new IllegalStateException("The main deployer is shutdown");
| +
| if (deploy.isEmpty() == false)
| {
| deployContexts = new ArrayList<DeploymentContext>(deploy);
| @@ -662,15 +682,16 @@
| Collections.sort(deployContexts, comparator);
| deploy.clear();
| }
| - if (deployContexts != null)
| - {
| - deployers.process(deployContexts, null);
| - }
| }
| finally
| {
| unlockWrite();
| }
| +
| + if (deployContexts != null)
| + {
| + deployers.process(deployContexts, null);
| + }
| }
|
| public DeploymentStage getDeploymentStage(String deploymentName) throws DeploymentException
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211731#4211731
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211731
More information about the jboss-dev-forums
mailing list