[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] jboss-tomcat/src/main/org/jboss/web/tomcat/tc5 Tomcat5.java
From:       Remy Maucherat <remm () users ! sourceforge ! net>
Date:       2003-11-29 21:23:19
[Download RAW message or body]

  User: remm    
  Date: 03/11/29 13:23:18

  Modified:    src/main/org/jboss/web/tomcat/tc5 Tag: Branch_3_2
                        Tomcat5.java
  Log:
  - Port of the clustering code to TC 5. It builds, but is untested.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.1.1.2.8 +72 -1     jboss-tomcat/src/main/org/jboss/web/tomcat/tc5/Tomcat5.java
  
  Index: Tomcat5.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-tomcat/src/main/org/jboss/web/tomcat/tc5/Tomcat5.java,v
  retrieving revision 1.1.1.1.2.7
  retrieving revision 1.1.1.1.2.8
  diff -u -r1.1.1.1.2.7 -r1.1.1.1.2.8
  --- Tomcat5.java	31 Oct 2003 23:15:14 -0000	1.1.1.1.2.7
  +++ Tomcat5.java	29 Nov 2003 21:23:18 -0000	1.1.1.1.2.8
  @@ -21,6 +21,8 @@
   import javax.management.ObjectName;
   import javax.management.Attribute;
   
  +import org.jboss.web.tomcat.tc5.session.*;
  +
   /** 
    * An implementation of the AbstractWebContainer for the Jakarta Tomcat5
    * servlet container. It has no code dependency on tomcat - only the new JMX
  @@ -32,7 +34,7 @@
    * 
    * @author Scott.Stark@jboss.org
    * @author Costin Manolache
  - * @version $Revision: 1.1.1.1.2.7 $
  + * @version $Revision: 1.1.1.1.2.8 $
    */
   public class Tomcat5 extends AbstractWebContainer
      implements Tomcat5MBean
  @@ -50,6 +52,14 @@
      /** Domain for tomcat5 mbeans */
      private String catalinaDomain = "Catalina";
   
  +   /** With IntervalSnapshotManager use this interval (in ms) 
  +   for snapshotting */
  +   private int snapshotInterval = 1000;
  +
  +   /** Which snapshot mode should be used in clustered environment?
  +    Default: instant */
  +   private String snapshotMode = "instant"; // instant or interval
  +
      /** A flag indicating if the JBoss Loader should be used */
      private boolean useJBossWebLoader = true;
   
  @@ -88,6 +98,28 @@
         return null;
      }
   
  +   /** Set the snapshot interval in milliseconds for snapshot mode = interval */
  +   public void setSnapshotInterval(int interval)
  +   {
  +      this.snapshotInterval = interval;
  +   }
  +   /** Get the snapshot interval */
  +   public int getSnapshotInterval()
  +   {
  +      return this.snapshotInterval;
  +   }
  +
  +   /** Set the snapshot mode. Currently supported: instant or interval */
  +   public void setSnapshotMode(String mode)
  +   {
  +      this.snapshotMode = mode;
  +   }
  +   /** Get the snapshot mode */
  +   public String getSnapshotMode()
  +   {
  +      return this.snapshotMode;
  +   }
  +
      public boolean getUseJBossWebLoader()
      {
         return useJBossWebLoader;
  @@ -266,6 +298,45 @@
         // events to be notified of the start of the
         // context as this occurs before the servlets are started.
         webAppParser.parseWebAppDescriptors(loader, appInfo.getMetaData());
  +
  +      if (metaData.getDistributable())
  +      {
  +         // Try to initate clustering, fallback to standard if no clustering is available
  +         try
  +         {
  +             JBossManager manager =
  +                 new JBossManager(ctxPath, this.log, metaData);
  +             server.setAttribute(objectName, new Attribute
  +                                 ("manager", manager));
  +
  +            // choose the snapshot manager
  +            SnapshotManager snap = null;
  +            if (snapshotMode.equals("instant"))
  +            {
  +                snap = new InstantSnapshotManager(manager, ctxPath);
  +            }
  +            else if (snapshotMode.equals("interval"))
  +            {
  +                snap = new IntervalSnapshotManager(manager, ctxPath, snapshotInterval);
  +            }
  +            else
  +            {
  +               log.error("Snapshot mode must be 'instant' or 'interval' - using 'instant'");
  +               snap = new InstantSnapshotManager(manager, ctxPath);
  +            }
  +            // Adding session snapshot valve
  +            Object valve = new ClusteredSessionValve(snap);
  +            server.invoke(objectName, "addValve", 
  +                          new Object[] { valve }, 
  +                          new String[] { "org.apache.catalina.Valve" });
  +
  +            log.info("Enabled clustering support for ctxPath=" + ctxPath);
  +         }
  +         catch (ClusteringNotSupportedException e)
  +         {
  +            log.error("Failed to setup clustering, clustering disabled");
  +         }
  +      }
   
         server.invoke(objectName, "init", new Object[]{}, new String[]{});
         //server.invoke( objectName, "start", new Object[]{}, new String[] {});
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic