1 Reply Latest reply on Apr 25, 2009 5:48 AM by Brian Stansberry

    Pull New Deployments on Startup Jboss 4.2.3

    sachin mishra Newbie

      Hi,

      Having some problems with Jboss clustering and just wanted to see if i have missed anything importent.

      Problem: Whenever a node startsup, it always pulls the deployed applications from the Coordinator node even if that application is already on the node that which just restarted. This is causing a huge delay for the node to startup as it pulls all the deployments and i have more than 50 Apps which are huge in size.

      Example:
      Cluster with 2 Node A and B.
      1. Deploy X.war file on Node A
      2. File pushed to Node B ( all good here )
      3. restart Node A
      4. Node A pulls the X.war from Node B (** This is not a desired behaviour as X.war already exists on the Node A and also timestamp ( last mod date ) on X.war is not changed, so this is not a new deployment.


      Going throug the FarmService code i can see the bug, but am not sure if its really a bug or a design issue.

      line 174: DeployedURL du = (DeployedURL)parentDUMap.get(depName);
      parentDUMap is always empty on startup as the pull new deployment is called form the startService method,
      therefore all the farmed applications are getting pulled by the node that just started.

      Does anyone has come across this issuse ?


      protected void pullNewDeployments(HAPartition partition, HashMap farmed)
      168 {
      169 log.info("**** pullNewDeployments ****");
      170 Iterator it = farmed.keySet().iterator();
      171 while (it.hasNext())
      172 {
      173 String depName = (String)it.next();
      174 DeployedURL du = (DeployedURL)parentDUMap.get(depName);
      175 Date last = (Date)farmed.get(depName);
      176 if (du != null)
      177 {
      178 Date theLast = new Date(du.getFile().lastModified());
      179 if (!theLast.before(last))
      180 {
      181 continue;
      182 }
      183 }
      184
      185 String parentName = depName.substring(0, depName.indexOf('/'));
      186 File destFile = new File(depName);
      187 try
      188 {
      189 mFileTransfer.pull(destFile,parentName);
      190 synchronized (remotelyDeployed)
      191 {
      192 remotelyDeployed.add (destFile.getName());
      193 }
      194 }
      195 catch(ClusterFileTransferException e)
      196 {
      197 // log the exception and continue with the next deployment
      198 this.logException(e);
      199 }
      200 }
      201 }



        • 1. Re: Pull New Deployments on Startup Jboss 4.2.3
          Brian Stansberry Master

          You're right. :(

          I'd say it's more of a buggy design issue.

          A possible fix would be to parse the value of the "depName" variable (e.g. "farm/foo.ear") into a parentName string (e.g. "farm") and a fileName string ("foo.ear").

          You then use the findParent(parentName) method to get the File that points to the farm/ dir, then create a new File(parent, fileName) and use that for the timestamp comparison.