cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2005-07-16 Thread pero
pero2005/07/16 14:04:37

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Open Cluster APi that Context can have its own Cluster Manager config.
  
  Revision  ChangesPath
  1.71  +56 -12
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- SimpleTcpCluster.java 8 Jul 2005 20:50:30 -   1.70
  +++ SimpleTcpCluster.java 16 Jul 2005 21:04:37 -  1.71
  @@ -32,6 +32,9 @@
   import javax.management.modelmbean.ModelMBean;
   
   import org.apache.catalina.Container;
  +import org.apache.catalina.Context;
  +import org.apache.catalina.Engine;
  +import org.apache.catalina.Host;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
  @@ -335,11 +338,20 @@
   this.membershipService = membershipService;
   }
   
  +/**
  + * Add cluster valve 
  + * Cluster Valves are only add to container when cluster is started!
  + * @param new cluster Valve.
  + */
   public void addValve(Valve valve) {
   if (valve instanceof ClusterValve)
   valves.add(valve);
   }
   
  +/**
  + * get all cluster valves
  + * @return current cluster valves
  + */
   public Valve[] getValves() {
   return (Valve[]) valves.toArray(new Valve[valves.size()]);
   }
  @@ -392,6 +404,10 @@
   this.clusterDeployer = clusterDeployer;
   }
   
  +/**
  + * Get all current cluster members
  + * @return all members or empty array 
  + */
   public Member[] getMembers() {
   Member[] members = membershipService.getMembers();
   if(members != null) {
  @@ -437,12 +453,17 @@
   
   properties.put(name, value);
   if(started) {
  +// FIXME Hmm, is that correct when some DeltaManagers are direct 
configured inside Context?
  +// Why we not support it for other elements, like sender, 
receiver or membership?
  +// Must we restart element after change?
   if (name.startsWith("manager")) {
   String key = name.substring("manager".length() + 1);
   String pvalue = value.toString();
   for (Iterator iter = managers.values().iterator(); 
iter.hasNext();) {
   Manager manager = (Manager) iter.next();
  -IntrospectionUtils.setProperty(manager, key, pvalue );
  +if(manager instanceof DeltaManager && ((ClusterManager) 
manager).isDefaultMode()) {
  +IntrospectionUtils.setProperty(manager, key, pvalue 
);
  +}
   }
   } 
   }
  @@ -529,8 +550,10 @@
   if(manager != null) {
   manager.setDistributable(true);
   if (manager instanceof ClusterManager) {
  -((ClusterManager) manager).setName(name);
  -((ClusterManager) manager).setCluster(this);
  +ClusterManager cmanager = (ClusterManager) manager ;
  +cmanager.setDefaultMode(true);
  +cmanager.setName(getManagerName(name,manager));
  +cmanager.setCluster(this);
   }
   }
   }
  @@ -540,15 +563,14 @@
   /**
* remove an application form cluster replication bus
* 
  - * @see 
org.apache.catalina.cluster.CatalinaCluster#removeManager(java.lang.String)
  + * @see 
org.apache.catalina.cluster.CatalinaCluster#removeManager(java.lang.String,Manager)
*/
  -public void removeManager(String name) {
  -Manager manager = getManager(name);
  +public void removeManager(String name,Manager manager) {
   if (manager != null) {
   // Notify our interested LifecycleListeners
   lifecycle.fireLifecycleEvent(BEFORE_MANAGERUNREGISTER_EVENT,
   manager);
  -managers.remove(name);
  +managers.remove(getManagerName(name,manager));
   if (manager instanceof ClusterManager)
   ((ClusterManager) manager).setCluster(null);
   // Notify our interested LifecycleListeners
  @@ -575,16 +597,37 @@
   }
   // Notify our interested LifecycleListeners
   lifecycle.fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
  +String clusterName = getManagerName(name, manager);
   if (manager instanceof ClusterMan

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java mbeans-descriptors.xml

2005-07-01 Thread pero
pero2005/07/01 09:51:14

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java mbeans-descriptors.xml
  Log:
  Fix that some elements receiver, sender, membership are empty
  Add sendClusterDomain as jmx operation
  add docs
  
  Revision  ChangesPath
  1.69  +76 -59
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- SimpleTcpCluster.java 30 Jun 2005 13:03:34 -  1.68
  +++ SimpleTcpCluster.java 1 Jul 2005 16:51:14 -   1.69
  @@ -68,8 +68,7 @@
* receiver/sender.
* 
* FIXME remove install/remove/start/stop context dummys
  - * 
  - * FIXME wrote testcases FIXME Propertychange support
  + * FIXME wrote testcases 
* 
* @author Filip Hanik
* @author Remy Maucherat
  @@ -678,7 +677,6 @@
   getClusterLog();
   // Notify our interested LifecycleListeners
   lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, this);
  -
   try {
   if(isDefaultMode() && valves.size() == 0) {
   createDefaultClusterValves() ;
  @@ -698,36 +696,39 @@
   createDefaultClusterSender();
   }
   // start the receiver.
  -clusterReceiver.setSendAck(clusterSender.isWaitForAck());
  -clusterReceiver.setCompress(clusterSender.isCompress());
  -clusterReceiver.setCatalinaCluster(this);
  -clusterReceiver.start();
  +if(clusterReceiver != null) {
  +clusterReceiver.setSendAck(clusterSender.isWaitForAck());
  +clusterReceiver.setCompress(clusterSender.isCompress());
  +clusterReceiver.setCatalinaCluster(this);
  +clusterReceiver.start();
  +} else 

   // start the sender.
  -clusterSender.setCatalinaCluster(this);
  -clusterSender.start();
  +if(clusterSender != null && clusterReceiver != null) {
  +clusterSender.setCatalinaCluster(this);
  +clusterSender.start();
  +}
   
   // start the membership service.
   if(isDefaultMode() && membershipService == null) {
   createDefaultMembershipService();
   }
  -membershipService.setLocalMemberProperties(clusterReceiver
  -.getHost(), clusterReceiver.getPort());
  -membershipService.addMembershipListener(this);
  -membershipService.setCatalinaCluster(this);
  -membershipService.start();
   
  -// start the deployer.
  -try {
  -if (clusterDeployer != null) {
  -clusterDeployer.setCluster(this);
  -clusterDeployer.start();
  +if(membershipService != null && clusterReceiver != null) {
  +membershipService.setLocalMemberProperties(clusterReceiver
  +.getHost(), clusterReceiver.getPort());
  +membershipService.addMembershipListener(this);
  +membershipService.setCatalinaCluster(this);
  +membershipService.start();
  +// start the deployer.
  +try {
  +if (clusterDeployer != null) {
  +clusterDeployer.setCluster(this);
  +clusterDeployer.start();
  +}
  +} catch (Throwable x) {
  +log.fatal("Unable to retrieve the container deployer. 
Cluster deployment disabled.",x);
   }
  -} catch (Throwable x) {
  -log
  -.fatal(
  -"Unable to retrieve the container deployer. 
Cluster deployment disabled.",
  -x);
   }
   this.started = true;
   // Notify our interested LifecycleListeners
  @@ -739,13 +740,15 @@
   }
   
   /**
  - * 
  + * Create default membership service:
  + * 
* 
  + * 
*/
   protected void createDefaultMembershipService() {
   if (log.isInfoEnabled()) {
  @@ -765,13 +768,14 @@
   
   
   /**
  - * 
  + * Create default 

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2005-03-25 Thread pero
pero2005/03/25 14:11:40

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Add a lot Fixme for next 5.5.10 release :-)
  
  Revision  ChangesPath
  1.59  +65 -22
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- SimpleTcpCluster.java 15 Feb 2005 09:31:45 -  1.58
  +++ SimpleTcpCluster.java 25 Mar 2005 22:11:39 -  1.59
  @@ -58,8 +58,17 @@
* setting up a cluster and provides callers with a valid multicast
* receiver/sender.
* 
  + * FIXME remove install/remove/start/stop context dummys
  + * FIXME better stats
  + * FIXME factor out receiver handling
  + * FIXME Support JMX and Lifecycle Listener Notification (start/stop member) 
(start/stop context/manager)
  + * FIXME optimize message package creation
  + * FIXME better compress message handling
  + * FIXME Clearer implementation from notifyListenersOnReplication flag
  + *
* @author Filip Hanik
* @author Remy Maucherat
  + * @author Peter Rossbach
* @version $Revision$, $Date$
*/
   
  @@ -297,10 +306,18 @@
   return manager;
   }
   
  +/* remove an application form cluster replication bus
  + * FIXME notify someone (JMX(Listener)
  + * @see 
org.apache.catalina.cluster.CatalinaCluster#removeManager(java.lang.String)
  + */
   public void removeManager(String name) {
   managers.remove(name);
   }
   
  +/* add an application to cluster replication bus
  + * FIXME notify someone (JMX(Listener)
  + * @see 
org.apache.catalina.cluster.CatalinaCluster#addManager(java.lang.String, 
org.apache.catalina.cluster.ClusterManager)
  + */
   public void addManager(String name, ClusterManager manager) {
   manager.setName(name);
   manager.setCluster(this);
  @@ -366,6 +383,7 @@
* other nodes in the cluster, and request the current session state to 
be
* transferred to this node.
* 
  + * FIXME notify someone (JMX(Listener)   
* @exception IllegalStateException
*if this component has already been started
* @exception LifecycleException
  @@ -389,7 +407,7 @@
   
   }
   registerMBeans();
  -clusterReceiver.setWaitForAck(clusterSender.isWaitForAck());
  +clusterReceiver.setSendAck(clusterSender.isWaitForAck());
   clusterReceiver.setCatalinaCluster(this);
   clusterReceiver.start();
   clusterSender.setCatalinaCluster(this);
  @@ -435,20 +453,15 @@
   && (smsg.getEventType() == 
SessionMessage.EVT_GET_ALL_SESSIONS)
   && (membershipService.getMembers().length > 0)) {
   destination = membershipService.getMembers()[0];
  -}//end if
  -}//end if
  -msg.setTimestamp(System.currentTimeMillis());
  -java.io.ByteArrayOutputStream outs = new 
java.io.ByteArrayOutputStream();
  -java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(
  -outs);
  -out.writeObject(msg);
  -byte[] data = outs.toByteArray();
  +}
  +}
  +byte[] data = createMessageData(msg);
   if (destination != null) {
   Member tcpdest = dest;
   if ((tcpdest != null)
   && 
(!membershipService.getLocalMember().equals(tcpdest))) {
   clusterSender.sendMessage(msg.getUniqueId(), data, 
tcpdest);
  -}//end if
  +}
   } else {
   clusterSender.sendMessage(msg.getUniqueId(), data);
   }
  @@ -458,6 +471,22 @@
   }
   
   /**
  + * Send Message create Timestamp and generate message bytes form msg
  + * @param msg cluster message
  + * @return cluster message as byte array
  + * @throws IOException
  + */
  +protected byte[] createMessageData(ClusterMessage msg) throws 
IOException {
  +msg.setTimestamp(System.currentTimeMillis());
  +java.io.ByteArrayOutputStream outs = new 
java.io.ByteArrayOutputStream();
  +java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(
  +outs);
  +out.writeObject(msg);
  +byte[] data = outs.toByteArray();
  +return data;
  +}
  +
  +/**
* send message to all cluster members
* 
* @see 
org.apache.catalina.cluster.CatalinaCluster#send(

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-11-27 Thread pero
pero2004/11/27 13:10:20

  Modified:modules/cluster build.xml to-do.txt
   modules/cluster/src/share/org/apache/catalina/cluster
ClusterDeployer.java mbeans-descriptors.xml
   modules/cluster/src/share/org/apache/catalina/cluster/deploy
FarmWarDeployer.java FileMessageFactory.java
WarWatcher.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Fix cluster FarmWarDeployer
  add controlled WarWatcher with engine backgroundProcess()
  add more log messages
  
  Revision  ChangesPath
  1.9   +1 -0  jakarta-tomcat-catalina/modules/cluster/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/build.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- build.xml 13 Jul 2004 15:24:47 -  1.8
  +++ build.xml 27 Nov 2004 21:10:19 -  1.9
  @@ -18,6 +18,7 @@
 
   
   
  +
   
   
   
  
  
  
  1.4   +20 -1 jakarta-tomcat-catalina/modules/cluster/to-do.txt
  
  Index: to-do.txt
  ===
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/to-do.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- to-do.txt 29 Sep 2004 18:59:32 -  1.3
  +++ to-do.txt 27 Nov 2004 21:10:19 -  1.4
  @@ -1,12 +1,31 @@
   1. Fix farm deployment for 5.5
  +   pero:
  + Every start all application are deployed only to all running cluster 
nodes
  + New registered nodes don't get the applications!
  + Deploy must send a GET_ALL_APP to all other Deployers.
  + Only watchEnabled Deployer send this member all 
deployed application.
  + Add JMX Support
  + Resend Deployed Applications to all or one cluster node.
  + Show all watch Resource
  + Processing Time
  + Change fileMessage Buffersize.
  + Start/Stop Cluster wide application
  + Deployer and Watcher sync with engine background thread! 
  + Fixed!  
  + Last FileMessage fragment need longe ackTimeout 
  +   
   2. Extend StandardSession if possible
   3. Implement primary/secondary replication logic
   4. Implement fragmentation of large replication objects
  -5. Implementa NonSerializable interface for session attributes that do not
  +5. Implement a NonSerializable interface for session attributes that do not
   wish to be replicated
   6. Implement context attribute replication (?)
  + pero:
  + Also send Start/Stop messages from Context to complete cluster!
   7. JMX friendly
   8. Documentation
   9. Add a flag for replicated  attribute events, to enable or disable them -
  + pero:
  + Why different defaults from notifyListenersOnReplication at 
SimpleTcpCluster and DeltaManager exists?
   COMPLETED
   
  
  
  
  1.4   +6 -1  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/ClusterDeployer.java
  
  Index: ClusterDeployer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/ClusterDeployer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClusterDeployer.java  26 Oct 2004 14:29:02 -  1.3
  +++ ClusterDeployer.java  27 Nov 2004 21:10:20 -  1.4
  @@ -98,4 +98,9 @@
*  removal
*/
   public void remove(String contextPath, boolean undeploy) throws 
IOException;
  +
  +/**
  + * call from container Background Process
  + */
  +public void backgroundProcess();
   }
  
  
  
  1.2   +0 -8  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mbeans-descriptors.xml
  
  Index: mbeans-descriptors.xml
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mbeans-descriptors.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mbeans-descriptors.xml25 Apr 2003 21:14:36 -  1.1
  +++ mbeans-descriptors.xml27 Nov 2004 21:10:20 -  1.2
  @@ -37,10 +37,6 @@
type="java.lang.String"
   writeable="false"/>
   
  -
  -
   
  -
  -
   
 
   
  
  
  
  1.4   +503 -146  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java
  
  Index: FarmWarDeployer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catali

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-11-22 Thread pero
pero2004/11/22 06:51:52

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Better log support to see detail information at debug level.
  
  Revision  ChangesPath
  1.54  +6 -7  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- SimpleTcpCluster.java 11 Nov 2004 14:47:27 -  1.53
  +++ SimpleTcpCluster.java 22 Nov 2004 14:51:52 -  1.54
  @@ -268,9 +268,6 @@
   }
   
   
  -
  -
  -
   // - Public 
Methods
   
   
  @@ -369,9 +366,11 @@
   if (started)
   throw new LifecycleException
   (sm.getString("cluster.alreadyStarted"));
  -log.info("Cluster is about to start");
  +if(log.isInfoEnabled())
  +log.info("Cluster is about to start");
   try {
  -log.debug("Invoking addValve on "+getContainer()+ " with 
class="+valve.getClass().getName());
  +if(log.isDebugEnabled())
  +log.debug("Invoking addValve on "+getContainer()+ " with 
class="+valve.getClass().getName());
   IntrospectionUtils.callMethodN(getContainer(), 
   "addValve", 
   new Object[]  {valve}, 
  @@ -387,7 +386,7 @@
   try {
   if ( clusterDeployer != null ) {
   clusterDeployer.setCluster(this);
  -Object deployer = 
IntrospectionUtils.getProperty(getContainer(), "deployer");
  +// Object deployer = 
IntrospectionUtils.getProperty(getContainer(), "deployer");
   // FIXME: clusterDeployer.setDeployer( 
(org.apache.catalina.Deployer) deployer);
   // clusterDeployer.setDeployer( deployer);
   clusterDeployer.start();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-10-20 Thread fhanik
fhanik  2004/10/20 10:02:17

  Modified:modules/cluster/src/share/org/apache/catalina/cluster Tag:
TOMCAT_5_0 CatalinaCluster.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
Tag: TOMCAT_5_0 DeltaManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
Tag: TOMCAT_5_0 SimpleTcpCluster.java
  Log:
  Fixed defect 31495,
  the cluster manager should survive the context reload by readding itself to the 
cluster upon start.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.6.2.1   +2 -1  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
  
  Index: CatalinaCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- CatalinaCluster.java  4 Jun 2004 20:22:27 -   1.6
  +++ CatalinaCluster.java  20 Oct 2004 17:02:16 -  1.6.2.1
  @@ -109,5 +109,6 @@
   
   public Manager getManager(String name);
   public void removeManager(String name);
  +public void addManager(String name, ClusterManager manager);
   
   }
  
  
  
  No   revision
  No   revision
  1.27.2.2  +5 -2  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
  
  Index: DeltaManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java,v
  retrieving revision 1.27.2.1
  retrieving revision 1.27.2.2
  diff -u -r1.27.2.1 -r1.27.2.2
  --- DeltaManager.java 19 Oct 2004 21:59:05 -  1.27.2.1
  +++ DeltaManager.java 20 Oct 2004 17:02:16 -  1.27.2.2
  @@ -613,6 +613,7 @@
   if (started) {
   return;
   }
  +getCluster().addManager(getName(),this);
   started = true;
   lifecycle.fireLifecycleEvent(START_EVENT, null);
   
  @@ -688,12 +689,14 @@
   if (log.isDebugEnabled())
   log.debug("Stopping");
   
  +getCluster().removeManager(getName());
   // Validate and update our current component state
   if (!started)
   throw new LifecycleException
   (sm.getString("standardManager.notStarted"));
   lifecycle.fireLifecycleEvent(STOP_EVENT, null);
   started = false;
  +
   
   // Expire all active sessions
   {
  @@ -718,7 +721,7 @@
   if( initialized ) {
   destroy();
   }
  -getCluster().removeManager(getName());
  +
   }
   
   
  
  
  
  No   revision
  No   revision
  1.41.2.1  +7 -3  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.41
  retrieving revision 1.41.2.1
  diff -u -r1.41 -r1.41.2.1
  --- SimpleTcpCluster.java 4 Jun 2004 20:22:27 -   1.41
  +++ SimpleTcpCluster.java 20 Oct 2004 17:02:16 -  1.41.2.1
  @@ -325,14 +325,18 @@
   log.error("Unable to load class for replication manager",x);
   manager = new 
org.apache.catalina.cluster.session.SimpleTcpReplicationManager();
   }
  +addManager(name,manager);
  +
  +return manager;
  +}
  +
  +public void addManager(String name, ClusterManager manager) {
   manager.setName(name);
   manager.setCluster(this);
   manager.setDistributable(true);
   manager.setExpireSessionsOnShutdown(expireSessionsOnShutdown);
   manager.setUseDirtyFlag(useDirtyFlag);
   managers.put(name,manager);
  -
  -return manager;
   }
   
   public void removeManager(String name) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-10-19 Thread fhanik
fhanik  2004/10/19 15:30:50

  Modified:modules/cluster/src/share/org/apache/catalina/cluster
CatalinaCluster.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Made the cluster survice reloads
  
  Revision  ChangesPath
  1.8   +2 -1  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
  
  Index: CatalinaCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CatalinaCluster.java  23 Jun 2004 13:51:37 -  1.7
  +++ CatalinaCluster.java  19 Oct 2004 22:30:50 -  1.8
  @@ -107,5 +107,6 @@
   
   public Manager getManager(String name);
   public void removeManager(String name);
  +public void addManager(String name, ClusterManager manager);
   
   }
  
  
  
  1.33  +6 -3  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
  
  Index: DeltaManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DeltaManager.java 19 Oct 2004 21:38:55 -  1.32
  +++ DeltaManager.java 19 Oct 2004 22:30:50 -  1.33
  @@ -625,6 +625,9 @@
   log.error("Starting... no cluster associated with this 
context:"+getName());
   return;
   }
  +//to survice context reloads, as only a stop/start is called, not 
createManager
  +System.out.println("\n\n\nADDING MANAGER WITH NAME 
"+getName()+"\n\n\n");
  +getCluster().addManager(getName(),this);
   
   if (cluster.getMembers().length > 0) {
   Member mbr = cluster.getMembers()[0];
  @@ -668,7 +671,6 @@
   } catch (Throwable t) {
   log.error(sm.getString("standardManager.managerLoad"), t);
   }
  -
   }
   
   
  @@ -685,6 +687,8 @@
   if (log.isDebugEnabled())
   log.debug("Stopping");
   
  +getCluster().removeManager(getName());
  +
   // Validate and update our current component state
   if (!started)
   throw new LifecycleException
  @@ -715,7 +719,6 @@
   if( initialized ) {
   destroy();
   }
  -getCluster().removeManager(getName());
   }
   
   
  
  
  
  1.52  +10 -8 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- SimpleTcpCluster.java 5 Oct 2004 17:12:50 -   1.51
  +++ SimpleTcpCluster.java 19 Oct 2004 22:30:50 -  1.52
  @@ -284,6 +284,15 @@
   log.error("Unable to load class for replication manager",x);
   manager = new 
org.apache.catalina.cluster.session.SimpleTcpReplicationManager();
   }
  +addManager(name,manager);
  +return manager;
  +}
  +
  +public void removeManager(String name) {
  +managers.remove(name);
  +}
  +
  +public void addManager(String name, ClusterManager manager) {
   manager.setName(name);
   manager.setCluster(this);
   manager.setDistributable(true);
  @@ -291,13 +300,6 @@
   manager.setUseDirtyFlag(useDirtyFlag);
   manager.setNotifyListenersOnReplication(notifyListenersOnReplication);
   managers.put(name,manager);
  -
  -
  -return manager;
  -}
  -
  -public void removeManager(String name) {
  -managers.remove(name);
   }
   
   public Manager getManager(String name) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-09-29 Thread fhanik
fhanik  2004/09/29 09:43:45

  Modified:modules/cluster/src/share/org/apache/catalina/cluster
ClusterManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java DeltaRequest.java
DeltaSession.java SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Added flag to enabled/disable attribute/context events during session delta 
replication
  
  Revision  ChangesPath
  1.7   +4 -0  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/ClusterManager.java
  
  Index: ClusterManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/ClusterManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ClusterManager.java   22 Jul 2004 15:41:15 -  1.6
  +++ ClusterManager.java   29 Sep 2004 16:43:44 -  1.7
  @@ -71,5 +71,9 @@
  public void setUseDirtyFlag(boolean useDirtyFlag);
  
  public void setCluster(CatalinaCluster cluster);
  +   
  +   public boolean getNotifyListenersOnReplication();
  +   
  +   public void setNotifyListenersOnReplication(boolean 
notifyListenersOnReplication);
   
   }
  
  
  
  1.31  +12 -2 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
  
  Index: DeltaManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- DeltaManager.java 5 Sep 2004 22:03:42 -   1.30
  +++ DeltaManager.java 29 Sep 2004 16:43:44 -  1.31
  @@ -128,6 +128,8 @@
   private boolean useDirtyFlag;
   private boolean expireSessionsOnShutdown;
   private boolean printToScreen;
  +
  +private boolean notifyListenersOnReplication = false;
   // - Constructor
   public DeltaManager() {
   super();
  @@ -895,7 +897,7 @@
  DeltaSession session = 
(DeltaSession)findSession(msg.getSessionID());
  if (session != null) {
  DeltaRequest dreq = loadDeltaRequest(session, delta);
  -   dreq.execute(session);
  +   dreq.execute(session,notifyListenersOnReplication);
  session.setPrimarySession(false);
  }
  
  @@ -984,6 +986,14 @@
   }
   public void setName(String name) {
   this.name = name;
  +}
  +
  +public boolean getNotifyListenersOnReplication() {
  +return notifyListenersOnReplication;
  +}
  +
  +public void setNotifyListenersOnReplication(boolean 
notifyListenersOnReplication) {
  +this.notifyListenersOnReplication = notifyListenersOnReplication;
   }
   
   
  
  
  
  1.9   +9 -5  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java
  
  Index: DeltaRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DeltaRequest.java 1 Jul 2004 09:44:26 -   1.8
  +++ DeltaRequest.java 29 Sep 2004 16:43:44 -  1.9
  @@ -55,7 +55,7 @@
   public DeltaRequest() {
   
   }
  -
  +
   public DeltaRequest(String sessionId, boolean recordAllActions) {
   this.recordAllActions=recordAllActions;
   setSessionId(sessionId);
  @@ -108,8 +108,12 @@
   //add the action
   actions.addLast(info);
   }
  -
  +
   public void execute(DeltaSession session) {
  +execute(session,true);
  +}
  +
  +public void execute(DeltaSession session, boolean notifyListeners) {
   if ( !this.sessionId.equals( session.getId() ) )
   throw new java.lang.IllegalArgumentException("Session id mismatch, not 
executing the delta request");
   session.access();
  @@ -118,9 +122,9 @@
   switch ( info.getType() ) {
   case TYPE_ATTRIBUTE: {
   if ( info.getAction() == ACTION_SET ) {
  -session.setAttribute(info.getName(), info.getValue(),false);
  +session.setAttribute(info.getName(), 
info.getValue(),notifyListeners,false);
   

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-07-28 Thread remm
remm2004/07/28 11:02:15

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/deploy
FarmWarDeployer.java
   catalina/src/share/org/apache/catalina Context.java
   catalina/src/share/org/apache/catalina/core
StandardHost.java
   modules/cluster/src/share/org/apache/catalina/cluster
ClusterDeployer.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Removed: catalina/src/share/org/apache/catalina Deployer.java
   catalina/src/share/org/apache/catalina/core
StandardHostDeployer.java
  Log:
  - Remove Deployer.
  - The cluster farm code will needs some updates.
  
  Revision  ChangesPath
  1.2   +12 -10
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java
  
  Index: FarmWarDeployer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FarmWarDeployer.java  4 Jun 2004 20:22:27 -   1.1
  +++ FarmWarDeployer.java  28 Jul 2004 18:02:15 -  1.2
  @@ -20,7 +20,6 @@
   import org.apache.catalina.cluster.ClusterMessage;
   import org.apache.catalina.cluster.CatalinaCluster;
   import org.apache.catalina.LifecycleException;
  -import org.apache.catalina.Deployer;
   import java.io.File;
   import java.net.URL;
   import java.io.IOException;
  @@ -51,7 +50,6 @@
   org.apache.commons.logging.LogFactory.getLog(FarmWarDeployer.class);
   /*--Instance Variables--*/
   protected CatalinaCluster cluster = null;
  -protected Deployer deployer = null;
   protected boolean started = false; //default 5 seconds
   protected HashMap fileFactories = new HashMap();
   protected String deployDir;
  @@ -108,6 +106,8 @@
   name = name + ".war";
   File deployable = new File(getDeployDir(), name);
   factory.getFile().renameTo(deployable);
  +// FIXME
  +/*
   try {
   if (getDeployer().findDeployedApp(fmsg.getContextPath()) != 
null)
   getDeployer().remove(fmsg.getContextPath(), true);
  @@ -118,13 +118,17 @@
   }
   getDeployer().install(fmsg.getContextPath(),
 deployable.toURL());
  +  */
   removeFactory(fmsg);
   } //end if
   } else if (msg instanceof UndeployMessage && msg != null) {
   UndeployMessage umsg = (UndeployMessage) msg;
  +// FIXME
  +/*
   if (getDeployer().findDeployedApp(umsg.getContextPath()) != null)
   getDeployer().remove(umsg.getContextPath(),
umsg.getUndeploy());
  + */
   } //end if
   } catch (java.io.IOException x) {
   log.error("Unable to read farm deploy file message.", x);
  @@ -190,10 +194,13 @@
*  during installation
*/
   public void install(String contextPath, URL war) throws IOException {
  + // FIXME
  + /*
   if (getDeployer().findDeployedApp(contextPath) != null)
   getDeployer().remove(contextPath, true);
   //step 1. Install it locally
   getDeployer().install(contextPath, war);
  +*/
   //step 2. Send it to each member in the cluster
   Member[] members = getCluster().getMembers();
   Member localMember = getCluster().getLocalMember();
  @@ -231,8 +238,11 @@
   public void remove(String contextPath, boolean undeploy) throws IOException {
   log.info("Cluster wide remove of web app " + contextPath);
   //step 1. Remove it locally
  +// FIXME
  +/*
   if (getDeployer().findDeployedApp(contextPath) != null)
   getDeployer().remove(contextPath, undeploy);
  +*/
   //step 2. Send it to each member in the cluster
   Member[] members = getCluster().getMembers();
   Member localMember = getCluster().getLocalMember();
  @@ -284,10 +294,6 @@
   this.cluster = cluster;
   }
   
  -public void setDeployer(Deployer deployer) {
  -this.deployer = deployer;
  -}
  -
   public boolean equals(Object listener) {
   return super.equals(listener);
   }
  @@ -310,10 +316,6 @@
   
   public void setTempDir(String

Re: cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-06-04 Thread Filip Hanik - Dev
Remy Wrote:

>I take note of your intent to refator as well. I'd like to point out
>that refatoring, unlike regular bland refactoring, is an art which takes
>years to master.
Yes, refatoring is an art, and I intend to master it one day :)


>How about implementing your FarmWarDeployer as a replacement HostConfig
>instead ? This seems logical.
Yes, that could work, and it is logical. So you would configure it as a life cycle 
listener
of the host?

Before I move to replace the host config with a cluster deployer, I want to fine tune 
the deployer a little bit. How about I make
that part of my refatoring?

I also noticed that currently the MBeanFactory has the HostConfig class hard coded 
when creating a standard host.

Filip



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-06-04 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
fhanik  2004/06/04 13:22:27
  Modified:catalina/src/share/org/apache/catalina/startup
ClusterRuleSet.java
   modules/cluster/src/share/org/apache/catalina/cluster
CatalinaCluster.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Added:   modules/cluster/src/share/org/apache/catalina/cluster
ClusterDeployer.java
   modules/cluster/src/share/org/apache/catalina/cluster/deploy
FarmWarDeployer.java FileChangeListener.java
FileMessage.java FileMessageFactory.java
UndeployMessage.java WarWatcher.java
  Log:
  Added in the ability to do farm deployment/undeployment of war files to all members 
in the cluster
  Upon startup, no state is replicated.
  Also, I wanna refator some messaging before we move on, I do that once we have a 
branch
I take note of your intent to refator as well. I'd like to point out 
that refatoring, unlike regular bland refactoring, is an art which takes 
years to master.

How about implementing your FarmWarDeployer as a replacement HostConfig 
instead ? This seems logical.

Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-06-04 Thread fhanik
fhanik  2004/06/04 13:22:27

  Modified:catalina/src/share/org/apache/catalina/startup
ClusterRuleSet.java
   modules/cluster/src/share/org/apache/catalina/cluster
CatalinaCluster.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Added:   modules/cluster/src/share/org/apache/catalina/cluster
ClusterDeployer.java
   modules/cluster/src/share/org/apache/catalina/cluster/deploy
FarmWarDeployer.java FileChangeListener.java
FileMessage.java FileMessageFactory.java
UndeployMessage.java WarWatcher.java
  Log:
  Added in the ability to do farm deployment/undeployment of war files to all members 
in the cluster
  Upon startup, no state is replicated.
  Also, I wanna refator some messaging before we move on, I do that once we have a 
branch
  
  Revision  ChangesPath
  1.3   +10 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java
  
  Index: ClusterRuleSet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClusterRuleSet.java   27 Feb 2004 14:58:48 -  1.2
  +++ ClusterRuleSet.java   4 Jun 2004 20:22:27 -   1.3
  @@ -115,6 +115,15 @@
   digester.addSetNext(prefix + "Valve",
   "addValve",
   "org.apache.catalina.Valve");
  +
  +digester.addObjectCreate(prefix + "Deployer",
  + null, // MUST be specified in the element
  + "className");
  +digester.addSetProperties(prefix + "Deployer");
  +digester.addSetNext(prefix + "Deployer",
  +"setClusterDeployer",
  +"org.apache.catalina.cluster.ClusterDeployer");
  +
   
   
   //Cluster configuration end
  
  
  
  1.6   +15 -1 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
  
  Index: CatalinaCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CatalinaCluster.java  29 May 2004 02:36:12 -  1.5
  +++ CatalinaCluster.java  4 Jun 2004 20:22:27 -   1.6
  @@ -23,6 +23,7 @@
   import org.apache.catalina.Logger;
   import org.apache.catalina.Valve;
   import org.apache.commons.logging.Log;
  +import org.apache.catalina.Manager;
   
   /**
* A CatalinaCluster interface allows to plug in and out the 
  @@ -78,6 +79,12 @@
*/
   public Member[] getMembers();
   
  +/**
  + * Return the member that represents this node.
  + * @return Member
  + */
  +public Member getLocalMember();
  +
   public void setClusterSender(ClusterSender sender);
   
   public ClusterSender getClusterSender();
  @@ -95,5 +102,12 @@
   public void addClusterListener(MessageListener listener);
   
   public void removeClusterListener(MessageListener listener);
  +
  +public void setClusterDeployer(ClusterDeployer deployer);
  +
  +public ClusterDeployer getClusterDeployer();
  +
  +public Manager getManager(String name);
  +public void removeManager(String name);
   
   }
  
  
  
  1.1  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/ClusterDeployer.java
  
  Index: ClusterDeployer.java
  ===
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *  http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.catalina.cluster;
  
  /**
   * A ClusterDeployer interface allows to plug in and out the
   * different deployment implementa

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-05-28 Thread fhanik
fhanik  2004/05/28 19:36:12

  Modified:modules/cluster/src/share/org/apache/catalina/cluster
CatalinaCluster.java SessionMessage.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Added:   modules/cluster/src/share/org/apache/catalina/cluster
ClusterMessage.java MessageListener.java
  Log:
  Refactored a little bit more.
  Extending the catalina cluster to handle more than session messages.
  The next step is to implement farm deployment, hence I am expanding the
  cluster to use a message callback model instead of invoking the objects
  directly. this allows you to plug in as many callback objects as possible.
  The first call back object will be the cluster farm object. Coming soon... :)
  
  Revision  ChangesPath
  1.5   +7 -3  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
  
  Index: CatalinaCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CatalinaCluster.java  27 Feb 2004 14:58:55 -  1.4
  +++ CatalinaCluster.java  29 May 2004 02:36:12 -  1.5
  @@ -63,14 +63,14 @@
* Sends a message to all the members in the cluster
* @param msg SessionMessage
*/
  -public void send(SessionMessage msg);
  +public void send(ClusterMessage msg);
   
   /**
* Sends a message to a specific member in the cluster
* @param msg SessionMessage
* @param dest Member
*/
  -public void send(SessionMessage msg, Member dest);
  +public void send(ClusterMessage msg, Member dest);
   
   /**
* returns all the members currently participating in the cluster
  @@ -91,5 +91,9 @@
   public MembershipService getMembershipService();
   
   public void addValve(Valve valve);
  +
  +public void addClusterListener(MessageListener listener);
  +
  +public void removeClusterListener(MessageListener listener);
   
   }
  
  
  
  1.10  +2 -31 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/SessionMessage.java
  
  Index: SessionMessage.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/SessionMessage.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SessionMessage.java   5 May 2004 16:42:22 -   1.9
  +++ SessionMessage.java   29 May 2004 02:36:12 -  1.10
  @@ -38,7 +38,7 @@
*/
import java.security.Principal;
import org.apache.catalina.cluster.Member;
  -public interface SessionMessage extends java.io.Serializable
  +public interface SessionMessage extends ClusterMessage, java.io.Serializable
   {
   
   /**
  @@ -73,18 +73,7 @@
*/
   public static final int EVT_ALL_SESSION_DATA = 12;
   
  -/**
  - * Get the address that this message originated from.  This would be set
  - * if the message was being relayed from a host other than the one
  - * that originally sent it.
  - */
  -public Member getAddress();
  -/**
  - * Called by the cluster before sending it to the other
  - * nodes
  - * @param member Member
  - */
  -public void setAddress(Member member);
  +
   
   public String getContextName();
   
  @@ -104,24 +93,6 @@
*/
   public String getSessionID();
   
  -/**
  - * Timestamp message 
  - * @return long
  - */
  -public long getTimestamp();
  -/**
  - * Called by the cluster before sending out 
  - * the message
  - * @param timestamp long
  - */
  -public void setTimestamp(long timestamp);
  -
  -/**
  - * Each message must have a unique ID, in case of using async replication,
  - * and a smart queue, this id is used to replace messages not yet sent 
  - * @return String
  - */
  -public String getUniqueId();
   
   
   }//SessionMessage
  
  
  
  1.1  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/ClusterMessage.java
  
  Index: ClusterMessage.java
  ===
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *  http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-05-26 Thread yoavs
yoavs   2004/05/26 09:38:44

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Minor JavaDoc fixes (Bugzilla 28335)
  
  Revision  ChangesPath
  1.39  +1 -3  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- SimpleTcpCluster.java 8 Apr 2004 15:30:11 -   1.38
  +++ SimpleTcpCluster.java 26 May 2004 16:38:44 -  1.39
  @@ -579,8 +579,6 @@
*  is malformed (it must be "" or start with a slash)
* @exception IllegalStateException if the specified context path
*  is already attached to an existing web application
  - * @exception IOException if an input/output error was encountered
  - *  during installation
*/
   public void installContext(String contextPath, URL war) {
   log.debug("\n\n\n\nCluster Install called for 
context:"+contextPath+"\n\n\n\n");
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-04-08 Thread fhanik
fhanik  2004/04/08 08:30:11

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/mcast
McastMembership.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Three fixes:
  
  1. Membership alive time gets updated with each new broad cast, this will keep the 
membership updated with the exact lifetime of each node
  
  2. The cluster sorts its members by desc alive time
  
  3. change the started flag to be set earlier in the DeltaManager, somehow the start 
is still invoked twice, will investigate
  
  Revision  ChangesPath
  1.4   +5 -2  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastMembership.java
  
  Index: McastMembership.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastMembership.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- McastMembership.java  27 Feb 2004 14:58:55 -  1.3
  +++ McastMembership.java  8 Apr 2004 15:30:11 -   1.4
  @@ -76,6 +76,9 @@
   entry = new MbrEntry(m);
   map.put(m.getName(),entry);
   result = true;
  +} else {
  +//update the member alive time
  +entry.getMember().setMemberAliveTime(m.getMemberAliveTime());
   }//end if
   entry.accessed();
   return result;
  @@ -163,4 +166,4 @@
   return delta > maxtime;
   }
   }//MbrEntry
  -}
  \ No newline at end of file
  +}
  
  
  
  1.22  +3 -2  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
  
  Index: DeltaManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DeltaManager.java 7 Apr 2004 20:43:54 -   1.21
  +++ DeltaManager.java 8 Apr 2004 15:30:11 -   1.22
  @@ -602,8 +602,9 @@
   if (started) {
   return;
   }
  -lifecycle.fireLifecycleEvent(START_EVENT, null);
   started = true;
  +lifecycle.fireLifecycleEvent(START_EVENT, null);
  +
   
   // Force initialization of the random number generator
   String dummy = generateSessionId();
  
  
  
  1.38  +27 -2 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- SimpleTcpCluster.java 7 Apr 2004 20:43:55 -   1.37
  +++ SimpleTcpCluster.java 8 Apr 2004 15:30:11 -   1.38
  @@ -167,6 +167,9 @@
   private long nrOfMsgsReceived = 0;
   private long msgSendTime = 0;
   private long lastChecked = System.currentTimeMillis();
  +
  +//sort members by alive time
  +protected MemberComparator memberComparator = new MemberComparator();
   
   private String managerClassName = 
"org.apache.catalina.cluster.session.DeltaManager";
   
  @@ -281,7 +284,10 @@
   }
   
   public Member[] getMembers() {
  -return membershipService.getMembers();
  +Member[] members = membershipService.getMembers();
  +//sort by alive time
  +java.util.Arrays.sort(members,memberComparator);
  +return members;
   }
   
   
  @@ -643,6 +649,25 @@
   
   public void addValve(Valve valve) {
   this.valve = valve;
  +}
  +
  +private class MemberComparator implements java.util.Comparator {
  +
  +public int compare(Object o1, Object o2) { 
  +try {
  +return compare((Member)o1,(Member)o2);
  +} catch (ClassCastException x) {
  +return 0;
  +}
  +}
  +
  +public int compare(Member m1, Member m2) {
  +//longer alive time, means sort first
  +long result = m2.getMemberAliveTime() - m1.getMemberAliveTime();
  +if ( result < 0 ) return -1;
  +else if ( result == 0 ) return 0;
  +else return 1;
  +}
   }
   
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addition

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-02-22 Thread fhanik
fhanik  2004/02/22 22:36:13

  Modified:modules/cluster/src/share/org/apache/catalina/cluster
Member.java MembershipService.java
   modules/cluster/src/share/org/apache/catalina/cluster/mcast
McastService.java McastServiceImpl.java
   modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java DeltaSession.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  just minor logging changes, and added a start level to the cluster membership, for 
future member merging purposes
  
  Revision  ChangesPath
  1.3   +6 -5  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/Member.java
  
  Index: Member.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/Member.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Member.java   16 Nov 2003 22:22:45 -  1.2
  +++ Member.java   23 Feb 2004 06:36:13 -  1.3
  @@ -106,4 +106,5 @@
* @return nr of milliseconds since this member started.
*/
   public long getMemberAliveTime();
  -}
  \ No newline at end of file
  +
  +}
  
  
  
  1.3   +16 -4 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/MembershipService.java
  
  Index: MembershipService.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/MembershipService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MembershipService.java5 Feb 2004 05:27:31 -   1.2
  +++ MembershipService.java23 Feb 2004 06:36:13 -  1.3
  @@ -88,9 +88,21 @@
   /**
* Starts the membership service. If a membership listeners is added
* the listener will start to receive membership events.
  + * Performs a start level 1 and 2
* @throws java.lang.Exception if the service fails to start.
*/
   public void start() throws java.lang.Exception;
  +
  +/**
  + * Starts the membership service. If a membership listeners is added
  + * the listener will start to receive membership events.
  + * @param level - level 1 starts listening for members, level 2 
  + * starts broad casting the server
  + * @throws java.lang.Exception if the service fails to start.
  + */
  +public void start(int level) throws java.lang.Exception;
  +
  +
   /**
* Stops the membership service
*/
  
  
  
  1.8   +14 -6 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastService.java
  
  Index: McastService.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- McastService.java 5 Feb 2004 22:57:52 -   1.7
  +++ McastService.java 23 Feb 2004 06:36:13 -  1.8
  @@ -192,7 +192,15 @@
* @throws java.lang.Exception if a IO error occurs
*/
   public void start() throws java.lang.Exception {
  -if ( impl != null ) return;
  +start(1);
  +start(2);
  +}
  +
  +public void start(int level) throws java.lang.Exception {
  +if ( impl != null ) {
  +impl.start(level);
  +return;
  +}
   String host = getProperties().getProperty("tcpListenHost");
   int port = Integer.parseInt(getProperties().getProperty("tcpListenPort"));
   String name = "tcp://"+host+":"+port;
  @@ -215,7 +223,7 @@
   
java.net.InetAddress.getByName(properties.getProperty("mcastAddress")),
   this);
   
  -impl.start();
  +impl.start(level);
   log.info("Sleeping for 
"+(Long.parseLong(properties.getProperty("msgFrequency"))*4)+" secs to establish 
cluster membership");
   
Thread.currentThread().sleep((Long.parseLong(properties.getProperty("msgFrequency"))*4));
   
  
  
  
  1.7   +19 -15
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java
  
  Index: McastServiceImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- McastServiceImpl.java 13 Jan 2004 00:07:18 -  1.6
  +

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-02-05 Thread fhanik
fhanik  2004/02/05 15:01:30

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  change log.info to log.debug since this is a frequent message
  
  Revision  ChangesPath
  1.13  +6 -6  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
  
  Index: DeltaManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DeltaManager.java 5 Feb 2004 22:57:52 -   1.12
  +++ DeltaManager.java 5 Feb 2004 23:01:29 -   1.13
  @@ -654,7 +654,7 @@
   //the channel is already running
   log.info("Starting clustering manager...:"+getName());
   if ( cluster == null ) {
  -log.info("Starting... no cluster associated with this 
context:"+getName());
  +log.error("Starting... no cluster associated with this 
context:"+getName());
   return;
   }
   
  @@ -869,7 +869,7 @@
   */
  protected void messageReceived(SessionMessage msg, Member sender) {
  try {
  -   log.info("Manager ("+name+") Received SessionMessage of type=" + 
msg.getEventTypeString()+" from "+sender);
  +   log.debug("Manager ("+name+") Received SessionMessage of type=" + 
msg.getEventTypeString()+" from "+sender);
  switch (msg.getEventType()) {
  case SessionMessage.EVT_GET_ALL_SESSIONS: {
  //get a list of all the session from this manager
  
  
  
  1.34  +5 -5  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- SimpleTcpCluster.java 5 Feb 2004 22:57:52 -   1.33
  +++ SimpleTcpCluster.java 5 Feb 2004 23:01:29 -   1.34
  @@ -338,7 +338,7 @@
   
   
   public synchronized Manager createManager(String name) {
  -log.info("Creating ClusterManager for context "+name + " using class 
"+getManagerClassName());
  +log.debug("Creating ClusterManager for context "+name + " using class 
"+getManagerClassName());
   ClusterManager manager = null;
   try {
   manager = 
(ClusterManager)getClass().getClassLoader().loadClass(getManagerClassName()).newInstance();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-02-05 Thread fhanik
fhanik  2004/02/05 13:08:02

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaManager.java DeltaRequest.java
DeltaSession.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Ported latest bugfixes from StandardSession, hopefully in a near future I can extend 
it, but for now, this is they way it is
  
  Revision  ChangesPath
  1.11  +5 -4  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
  
  Index: DeltaManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DeltaManager.java 5 Feb 2004 01:02:48 -   1.10
  +++ DeltaManager.java 5 Feb 2004 21:08:02 -   1.11
  @@ -936,6 +936,7 @@
   //  Private Methods
   
   public void backgroundProcess() {
  +log.debug("DeltaManager.backgroundProcess invoked at 
"+System.currentTimeMillis());
   processExpires();
   }
   /**
  
  
  
  1.5   +8 -3  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java
  
  Index: DeltaRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DeltaRequest.java 13 Jan 2004 04:22:28 -  1.4
  +++ DeltaRequest.java 5 Feb 2004 21:08:02 -   1.5
  @@ -215,6 +215,11 @@
   return actions.size();
   }
   
  +public void clear() {
  +actions.clear();
  +actionPool.clear();
  +}
  +
   public void readExternal(java.io.ObjectInput in) throws java.io.IOException,
   java.lang.ClassNotFoundException {
   //sessionId - String
  
  
  
  1.12  +106 -94   
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
  
  Index: DeltaSession.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DeltaSession.java 4 Feb 2004 20:22:26 -   1.11
  +++ DeltaSession.java 5 Feb 2004 21:08:02 -   1.12
  @@ -339,6 +339,11 @@
*/
   private transient long lastTimeReplicated = System.currentTimeMillis();
   
  +/**
  + * The access count for this session
  + */
  +protected transient int accessCount = 1;
  +
   // - Session Properties
   
   /**
  @@ -642,6 +647,10 @@
   return false;
   }
   
  +if (accessCount > 0 ) {
  +return true;
  +}
  +
   if (maxInactiveInterval >= 0) {
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - lastAccessedTime) / 1000L);
  @@ -686,11 +695,14 @@
   this.thisAccessedTime = System.currentTimeMillis();
   
   evaluateIfValid();
  +
  +accessCount++;
   }
   
   
   public void endAccess() {
  -// FIXME
  +isNew = false;
  +accessCount--;
   }
   
   
  @@ -777,17 +789,13 @@
   }
   }
   }
  +accessCount=0;
   setValid(false);
   
   // Remove this session from our manager's active sessions
   if (manager != null)
   manager.remove(this);
   
  -// Unbind any objects associated with this session
  -String keys[] = keys();
  -for (int i = 0; i < keys.length; i++)
  -removeAttribute(keys[i], notify);
  -
   // Notify interested session event listeners
   if (notify) {
   fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
  @@ -795,6 +803,13 @@
   
   // We have completed expire of this session
   expiring = false;
  +
  +// Unbind any objects associated with this session
  +String keys[] = keys();
  +for (int i = 0; i < keys.length; i++)
  +removeAttributeInternal(keys[i], notify, false);
  +
  +
   
   if ( notifyCluster ) {
   log.debug("Notifying cluster of expiration primary=" +
  @@ -849,11 +864,13 @@
  

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-02-05 Thread fhanik
fhanik  2004/02/05 08:07:57

  Modified:modules/cluster/src/share/org/apache/catalina/cluster
CatalinaCluster.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Added in getter methods
  
  Revision  ChangesPath
  1.3   +10 -4 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
  
  Index: CatalinaCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CatalinaCluster.java  5 Feb 2004 05:27:31 -   1.2
  +++ CatalinaCluster.java  5 Feb 2004 16:07:57 -   1.3
  @@ -127,9 +127,15 @@
   
   public void setClusterSender(ClusterSender sender);
   
  +public ClusterSender getClusterSender();
  +
   public void setClusterReceiver(ClusterReceiver receiver);
   
  +public ClusterReceiver getClusterReceiver();
  +
   public void setMembershipService(MembershipService service);
  +
  +public MembershipService getMembershipService();
   
   public void addValve(Valve valve);
   
  
  
  
  1.31  +5 -6  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- SimpleTcpCluster.java 5 Feb 2004 05:27:31 -   1.30
  +++ SimpleTcpCluster.java 5 Feb 2004 16:07:57 -   1.31
  @@ -88,7 +88,6 @@
   
   import org.apache.catalina.cluster.Member;
   import org.apache.catalina.cluster.CatalinaCluster;
  -import org.apache.catalina.cluster.MembershipFactory;
   import org.apache.catalina.cluster.MembershipListener;
   import org.apache.catalina.cluster.MembershipService;
   import org.apache.commons.beanutils.MethodUtils;
  @@ -161,7 +160,7 @@
   /**
* Name for logging purpose
*/
  -protected String clusterImpName = "SimpleTcpCluster2";
  +protected String clusterImpName = "SimpleTcpCluster";
   
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2004-01-12 Thread fhanik
fhanik  2004/01/12 21:58:25

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Changing the default manager to be DeltaManager.
  
  Revision  ChangesPath
  1.28  +5 -5  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- SimpleTcpCluster.java 13 Jan 2004 05:26:59 -  1.27
  +++ SimpleTcpCluster.java 13 Jan 2004 05:58:25 -  1.28
  @@ -272,7 +272,7 @@
   private long msgSendTime = 0;
   private long lastChecked = System.currentTimeMillis();
   private boolean isJdk13 = false;
  -private String managerClassName = 
"org.apache.catalina.cluster.session.SimpleTcpReplicationManager";
  +private String managerClassName = 
"org.apache.catalina.cluster.session.DeltaManager";
   
   // - Properties
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-11-16 Thread fhanik
fhanik  2003/11/16 14:22:45

  Modified:modules/cluster/src/share/org/apache/catalina/cluster
Member.java SessionMessage.java
   modules/cluster/src/share/org/apache/catalina/cluster/io
XByteBuffer.java
   modules/cluster/src/share/org/apache/catalina/cluster/mcast
McastMember.java McastService.java
McastServiceImpl.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  added in member alive time
  
  Revision  ChangesPath
  1.2   +12 -4 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/Member.java
  
  Index: Member.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/Member.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Member.java   19 Feb 2003 20:57:17 -  1.1
  +++ Member.java   16 Nov 2003 22:22:45 -  1.2
  @@ -98,4 +98,12 @@
* @return
*/
   public int getPort();
  +
  +/**
  + * Contains information on how long this member has been online.
  + * The result is the number of milli seconds this member has been
  + * broadcasting its membership to the cluster.
  + * @return nr of milliseconds since this member started.
  + */
  +public long getMemberAliveTime();
   }
  
  
  
  1.4   +10 -39
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/SessionMessage.java
  
  Index: SessionMessage.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/SessionMessage.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SessionMessage.java   15 Nov 2003 00:58:20 -  1.3
  +++ SessionMessage.java   16 Nov 2003 22:22:45 -  1.4
  @@ -138,36 +138,10 @@
* Event type used when an attribute has been added to a session,
* the attribute will be sent to all the other nodes in the cluster
*/
  -//public static final int EVT_ATTRIBUTE_ADDED  = 5;
  -/**
  - * Event type used when an attribute has been removed from a session,
  - * the attribute will be sent to all the other nodes in the cluster
  - */
  -//public static final int EVT_ATTRIBUTE_REMOVED_WONOTIFY = 6;
  -
  -/**
  - * Event type used when an attribute has been removed from a session,
  - * the attribute will be sent to all the other nodes in the cluster
  - */
  -//public static final int EVT_ATTRIBUTE_REMOVED_WNOTIFY = 8;
  -
  -/**
  - * Event type used when a user principal is being cached in the session
  - */
  -//public static final int EVT_SET_USER_PRINCIPAL = 9;
  +public static final int EVT_SESSION_DELTA  = 13;
   
   /**
  - * Event type used when a user principal is being cached in the session
  - */
  -//public static final int EVT_REMOVE_SESSION_NOTE = 10;
  -
  -
  -/**
  - * Event type used when a user principal is being cached in the session
  - */
  -//public static final int EVT_SET_SESSION_NOTE = 11;
  -/**
  - * Event type used when all sessions are sent over as binary data
  + * When a session state is transferred, this is the event.
*/
   public static final int EVT_ALL_SESSION_DATA = 12;
   
  @@ -208,7 +182,7 @@
* EVT_REMOVE_SESSION_NOTE
*The parameters: sessionID, attrName<
* EVT_SET_SESSION_NOTE
  - *The parameters: sessionID, attrName, attrValue<
  + *The parameters: sessionID, attrName, attrValue
* @param eventtype - one of the 8 event type defined in this class
* @param session - the serialized byte array of the session itself
* @param sessionID - the id that identifies this session
  @@ -263,14 +237,9 @@
   case EVT_SESSION_CREATED : return "SESSION-MODIFIED";
   case EVT_SESSION_EXPIRED_WNOTIFY : return "SESSION-EXPIRED-WITH-NOTIFY";
   case EVT_SESSION_EXPIRED_WONOTIFY : return 
"SESSION-EXPIRED-WITHOUT-NOTIFY";
  -//case EVT_ATTRIBUTE_ADDED : return "SESSION-ATTRIBUTE-ADDED";
  -//case EVT_ATTRIBUTE_REMOVED_WNOTIFY : return 
"SESSION-ATTRIBUTE-REMOVED-WITH-NOTIFY";
  -//case EVT_ATTRIBUTE_REMOVED_WONOTIFY: return 
"SESSION-ATTRIBUTE-REMOVED-WITHOUT-NOTIFY";
   case EVT_SESSION_ACCESSED : return "SESSION-ACCESSED";
   case EVT_GET_ALL_SESSIONS : return "SESSION-GET-ALL";
  -//case EVT_SET_SESSION_NOTE: return "SET-SESSION-NOTE";
  -//case EVT_SET_USER_PRINCIPAL : return "SET-USER-PRINCIPAL";
  -//case EVT_REMOVE_

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-11-14 Thread fhanik
fhanik  2003/11/14 17:07:23

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/session
SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  a little more refactoring
  
  Revision  ChangesPath
  1.16  +4 -3  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java
  
  Index: SimpleTcpReplicationManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SimpleTcpReplicationManager.java  15 Nov 2003 00:58:20 -  1.15
  +++ SimpleTcpReplicationManager.java  15 Nov 2003 01:07:23 -  1.16
  @@ -110,6 +110,7 @@
* a byte array using the StandardSession.readObjectData, 
StandardSession.writeObjectData methods.
*/
   public class SimpleTcpReplicationManager extends 
org.apache.catalina.session.StandardManager
  +implements org.apache.catalina.cluster.ClusterManager
   {
   
   //the channel configuration
  
  
  
  1.18  +7 -7  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SimpleTcpCluster.java 15 Nov 2003 00:58:20 -  1.17
  +++ SimpleTcpCluster.java 15 Nov 2003 01:07:23 -  1.18
  @@ -96,6 +96,7 @@
   
   import org.apache.catalina.cluster.SessionMessage;
   import org.apache.catalina.cluster.session.ReplicationStream;
  +import org.apache.catalina.cluster.ClusterManager;
   import org.apache.catalina.cluster.session.SimpleTcpReplicationManager;
   import org.apache.catalina.cluster.Constants;
   
  @@ -670,15 +671,14 @@
   java.util.Iterator i = managers.keySet().iterator();
   while ( i.hasNext() ) {
   String key = (String)i.next();
  -SimpleTcpReplicationManager mgr = 
(SimpleTcpReplicationManager) managers.get(key);
  +ClusterManager mgr = (ClusterManager) managers.get(key);
   if (mgr != null)
   mgr.messageDataReceived(msg);
   else
   log.warn("Context manager doesn't exist:" + key);
   }//while
   } else {
  -SimpleTcpReplicationManager mgr = (
  -SimpleTcpReplicationManager) managers.get(name);
  +ClusterManager mgr = (ClusterManager) managers.get(name);
   if (mgr != null)
   mgr.messageDataReceived(msg);
   else
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-10-14 Thread fhanik
fhanik  2003/10/14 15:40:34

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/session
SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Implemented session state transfer, I can see that the ContextConfig class has 
solved my problem about
  the distributable element being parsed after the manager is created. Good job!
  
  Revision  ChangesPath
  1.13  +48 -15
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java
  
  Index: SimpleTcpReplicationManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SimpleTcpReplicationManager.java  14 Oct 2003 21:58:52 -  1.12
  +++ SimpleTcpReplicationManager.java  14 Oct 2003 22:40:34 -  1.13
  @@ -147,6 +147,13 @@
   protected org.apache.catalina.cluster.tcp.SimpleTcpCluster cluster;
   
   protected java.util.HashMap invalidatedSessions = new java.util.HashMap();
  +
  +/**
  + * Flag to keep track if the state has been transferred or not
  + * Assumes false.
  + */
  +protected boolean stateTransferred = false;
  +
   /**
* Constructor, just calls super()
*
  @@ -341,7 +348,6 @@
   long interval = session.getMaxInactiveInterval();
   long lastaccdist = System.currentTimeMillis() - 
   session.getLastAccessWasDistributed();
  -System.out.println("\nFH\ninterval="+interval+" 
lastaccdist="+lastaccdist);
   if ( ((interval*1000) / lastaccdist)< 3 ) {
   SessionMessage accmsg = new SessionMessage(name,
   SessionMessage.EVT_SESSION_ACCESSED,
  @@ -474,13 +480,35 @@
   log("Starting... no cluster associated with this 
context:"+getName(),1);
   return;
   }
  +
   if (cluster.getMembers().length > 0) {
  +Member mbr = cluster.getMembers()[0];
   SessionMessage msg =
   new SessionMessage(this.getName(),
  SessionMessage.EVT_GET_ALL_SESSIONS,
  null,
  null);
  -cluster.send(msg, cluster.getMembers()[0]);
  +cluster.send(msg, mbr);
  +log.warn("Manager["+getName()+"], requesting session state from 
"+mbr+
  + ". This operation will timeout if no session state has 
been received within "+
  + "60 seconds");
  +long reqStart = System.currentTimeMillis();
  +long reqNow = 0;
  +boolean isTimeout=false;
  +do {
  +try {
  +Thread.currentThread().sleep(100);
  +}catch ( Exception sleep) {}
  +reqNow = System.currentTimeMillis();
  +isTimeout=((reqNow-reqStart)>(1000*60));
  +} while ( (!isStateTransferred()) && (!isTimeout));
  +if ( isTimeout ) {
  +log.error("Manager["+getName()+"], No session state received, 
timing out.");
  +}else {
  +log.info("Manager["+getName()+"], session state received in 
"+(reqNow-reqStart)+" ms.");
  +}
  +} else {
  +log.info("Manager["+getName()+"], skipping state transfer. No 
members active in cluster group.");
   }//end if
   mChannelStarted = true;
   }  catch ( Exception x ) {
  @@ -555,13 +583,13 @@
   oout.writeObject(data);
   }//for
   //don't send a message if we don't have to
  -if ( sessions.length > 0) {
  -byte[] data = bout.toByteArray();
  -SessionMessage newmsg = new SessionMessage(name,
  -SessionMessage.EVT_ALL_SESSION_DATA,
  -data, "");
  -cluster.send(newmsg, sender);
  -}//end if
  +oout.flush();
  +oout.close();
  +byte[] data = bout.toByteArray();
  +SessionMessage newmsg = new SessionMessage(name,
  +SessionMessage.EVT_ALL_SESSION_DATA,
  +data, "");
  + 

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-09-09 Thread remm
remm2003/09/09 08:27:16

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  - Refactor manager initialization, and move it into ContextConfig.
  - Remove Cluster.setDistributable.
  
  Revision  ChangesPath
  1.15  +7 -19 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SimpleTcpCluster.java 24 Apr 2003 04:24:01 -  1.14
  +++ SimpleTcpCluster.java 9 Sep 2003 15:27:16 -   1.15
  @@ -412,27 +412,15 @@
   
   public synchronized Manager createManager(String name) {
   SimpleTcpReplicationManager manager = new SimpleTcpReplicationManager(name);
  -manager.setCluster(null);
  -manager.setDistributable(false);
  +manager.setCluster(this);
  +manager.setDistributable(true);
   manager.setExpireSessionsOnShutdown(expireSessionsOnShutdown);
   manager.setPrintToScreen(printToScreen);
   manager.setUseDirtyFlag(useDirtyFlag);
   manager.setDebug(debug);
   allmanagers.put(name, manager);
  +managers.put(name,manager);
   return manager;
  -}
  -
  -public void setDistributable(String contextName, boolean distributable)
  -{
  -log.info("Setting distributable for context:"+contextName+" to 
"+distributable);
  -SimpleTcpReplicationManager manager = 
(SimpleTcpReplicationManager)allmanagers.get(contextName);
  -manager.setDistributable(distributable);
  -if (distributable) {
  -manager.setCluster(this);
  -manager.setDistributable(true);
  -managers.put(contextName,manager);
  -}
  -
   }
   
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-04-12 Thread fhanik
fhanik  2003/04/12 19:34:02

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  added in the property when starting the service, before it was complaining about the 
property not set
  
  Revision  ChangesPath
  1.11  +8 -7  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SimpleTcpCluster.java 3 Apr 2003 02:29:38 -   1.10
  +++ SimpleTcpCluster.java 13 Apr 2003 02:34:02 -  1.11
  @@ -613,6 +613,7 @@
   {
   tcpAddress = java.net.InetAddress.getByName(address);
   }//end if
  +svcproperties.setProperty("tcpListenHost",address);
   }catch ( Exception x ){
   log.error("Unable to set listen address",x);
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-03-19 Thread fhanik
fhanik  2003/03/19 16:19:27

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  added in empty methods for compilations
  
  Revision  ChangesPath
  1.7   +80 -6 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SimpleTcpCluster.java 15 Mar 2003 00:20:56 -  1.6
  +++ SimpleTcpCluster.java 20 Mar 2003 00:19:27 -  1.7
  @@ -101,9 +101,11 @@
   
   import org.apache.commons.logging.Log;
   
  -
  +import java.io.IOException;
  +import java.net.URL;
   /**
  - * A Cluster implementation using JavaGroups. Responsible for setting
  + * A Cluster implementation using simple multicast.
  + * Responsible for setting
* up a cluster and provides callers with a valid multicast receiver/sender.
*
* @author Filip Hanik
  @@ -669,6 +671,78 @@
   //
   //}//end if
   }
  +
  +// - Cluster Wide 
Deployments
  +/**
  + * Start an existing web application, attached to the specified context
  + * path in all the other nodes in the cluster.
  + * Only starts a web application if it is not running.
  + *
  + * @param contextPath The context path of the application to be started
  + *
  + * @exception IllegalArgumentException if the specified context path
  + *  is malformed (it must be "" or start with a slash)
  + * @exception IllegalArgumentException if the specified context path does
  + *  not identify a currently installed web application
  + * @exception IOException if an input/output error occurs during
  + *  startup
  + */
  +public void startContext(String contextPath) throws IOException {
  +return;
  +}
  +
  +
  +/**
  + * Install a new web application, whose web application archive is at the
  + * specified URL, into this container with the specified context path.
  + * A context path of "" (the empty string) should be used for the root
  + * application for this container.  Otherwise, the context path must
  + * start with a slash.
  + * 
  + * If this application is successfully installed, a ContainerEvent of type
  + * PRE_INSTALL_EVENT will be sent to registered listeners
  + * before the associated Context is started, and a ContainerEvent of type
  + * INSTALL_EVENT will be sent to all registered listeners
  + * after the associated Context is started, with the newly created
  + * Context as an argument.
  + *
  + * @param contextPath The context path to which this application should
  + *  be installed (must be unique)
  + * @param war A URL of type "jar:" that points to a WAR file, or type
  + *  "file:" that points to an unpacked directory structure containing
  + *  the web application to be installed
  + *
  + * @exception IllegalArgumentException if the specified context path
  + *  is malformed (it must be "" or start with a slash)
  + * @exception IllegalStateException if the specified context path
  + *  is already attached to an existing web application
  + * @exception IOException if an input/output error was encountered
  + *  during installation
  + */
  +public void installContext(String contextPath, URL war) {
  +return;
  +}
  +
  +
  +/**
  + * Stop an existing web application, attached to the specified context
  + * path.  Only stops a web application if it is running.
  + *
  + * @param contextPath The context path of the application to be stopped
  + *
  + * @exception IllegalArgumentException if the specified context path
  + *  is malformed (it must be "" or start with a slash)
  + * @exception IllegalArgumentException if the specified context path does
  + *  not identify a currently installed web application
  + * @exception IOException if an input/output error occurs while stopping
  + *  the web application
  + */
  +public void stop(String contextPath) throws IOException {
  +return;
  +}
  +
  +
  +
   // -  Inner Class
   
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-03-14 Thread fhanik
fhanik  2003/03/14 16:20:56

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/session
SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  okey dokey, let the managers notify the cluster when they are ready to receive data 
from other nodes, instead of waiting for an event from the server
  
  Revision  ChangesPath
  1.3   +20 -12
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java
  
  Index: SimpleTcpReplicationManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleTcpReplicationManager.java  20 Feb 2003 17:54:15 -  1.2
  +++ SimpleTcpReplicationManager.java  15 Mar 2003 00:20:56 -  1.3
  @@ -387,6 +387,10 @@
   }
   return null;
   }
  +
  +public String getName() {
  +return this.name;
  +}
   /**
* Prepare for the beginning of active use of the public methods of this
* component.  This method should be called after configure(),
  @@ -398,21 +402,25 @@
* @exception LifecycleException if this component detects a fatal error
*  that prevents this component from being used
*/
  -public void start() throws LifecycleException
  -{
  +public void start() throws LifecycleException {
   mManagerRunning = true;
   super.start();
   //start the javagroups channel
  -try
  -{
  +try {
   //the channel is already running
   if ( mChannelStarted ) return;
  +if (cluster.getMembers().length > 0) {
  +SessionMessage msg =
  +new SessionMessage(this.getName(),
  +   SessionMessage.EVT_GET_ALL_SESSIONS,
  +   null,
  +   null);
  +cluster.send(msg, cluster.getMembers()[0]);
  +}//end if
  +mChannelStarted = true;
  +}  catch ( Exception x ) {
  +log("Unable to start SimpleTcpReplicationManager",x,1);
   }
  -catch ( Exception x )
  -{
  -log("Unable to start javagroups channel",x,1);
  -}
  -
   }
   
   /**
  
  
  
  1.6   +26 -21
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SimpleTcpCluster.java 5 Mar 2003 23:54:47 -   1.5
  +++ SimpleTcpCluster.java 15 Mar 2003 00:20:56 -  1.6
  @@ -272,10 +272,10 @@
   log.error("In SimpleTcpCluster.constructor()",x);
   }
   
  -if ( ServerFactory.getServer() instanceof StandardServer ) {
  -StandardServer server = (StandardServer) ServerFactory.getServer();
  -server.addLifecycleListener(this);
  -}
  +//if ( ServerFactory.getServer() instanceof StandardServer ) {
  +//StandardServer server = (StandardServer) ServerFactory.getServer();
  +//server.addLifecycleListener(this);
  +//}
   
   }
   /**
  @@ -381,6 +381,11 @@
   return (this.protocol);
   }
   
  +public Member[] getMembers() {
  +return service.getMembers();
  +}
  +
  +
   
   // - Public Methods
   
  @@ -650,19 +655,19 @@
   }
   
   public void lifecycleEvent(LifecycleEvent lifecycleEvent){
  -if ( 
lifecycleEvent.getLifecycle().AFTER_START_EVENT.equals(lifecycleEvent.getType()) ) {
  -//The server has started
  -SessionMessage msg =
  -new SessionMessage(null,
  -   SessionMessage.EVT_GET_ALL_SESSIONS,
  -   null,
  -   null);
  -if (service.getMembers().length > 0) {
  -Member mbr = service.getMembers()[0];
  -send(msg, mbr);
  -}
  -
  -}//end if
  +//if ( 
lifecycleEvent.getLifecycle().AFTER_START_EVENT.equals(lifecycleEvent.getType()) ) {
  +////The server has started
  +//SessionMessage msg =
  +//new SessionMessage(null,
  +//  

cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-03-05 Thread fhanik
fhanik  2003/03/05 15:54:48

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/mcast
McastServiceImpl.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Made all the threads daemon threads
  
  Revision  ChangesPath
  1.2   +6 -4  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java
  
  Index: McastServiceImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- McastServiceImpl.java 19 Feb 2003 20:32:10 -  1.1
  +++ McastServiceImpl.java 5 Mar 2003 23:54:47 -   1.2
  @@ -182,7 +182,9 @@
   socket.joinGroup(address);
   doRun = true;
   sender = new SenderThread(sendFrequency);
  +sender.setDaemon(true);
   receiver = new ReceiverThread();
  +receiver.setDaemon(true);
   receiver.start();
   sender.start();
   }
  
  
  
  1.5   +5 -4  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleTcpCluster.java 22 Feb 2003 00:46:22 -  1.4
  +++ SimpleTcpCluster.java 5 Mar 2003 23:54:47 -   1.5
  @@ -459,6 +459,7 @@
   this.tcpThreadCount,
   this.tcpAddress,
   this.tcpPort);
  +mReplicationListener.setDaemon(true);
   mReplicationListener.start();
   mReplicationTransmitter = new ReplicationTransmitter(new 
SocketSender[0]);
   mReplicationTransmitter.start();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-02-21 Thread fhanik
fhanik  2003/02/21 16:46:22

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Added:   modules/cluster/etc cluster-server.xml
  Log:
  added example config file
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-catalina/modules/cluster/etc/cluster-server.xml
  
  Index: cluster-server.xml
  ===
  
  
  
  
  
  
  
  







  
  
  
  
  
  
  
  

  factory
  org.apache.catalina.users.MemoryUserDatabaseFactory


  pathname
  conf/tomcat-users.xml

  
  

  

  


  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
   
   
  
  
  


  


  

  


  


  

  

  

  

  


 
  
   
   
  
  
  
  

  
  


  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

  
  
  

  
  
  
  
  
  1.4   +5 -4  
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleTcpCluster.java 22 Feb 2003 00:08:47 -  1.3
  +++ SimpleTcpCluster.java 22 Feb 2003 00:46:22 -  1.4
  @@ -391,6 +391,7 @@
   manager.setExpireSessionsOnShutdown(expireSessionsOnShutdown);
   manager.setPrintToScreen(printToScreen);
   manager.setUseDirtyFlag(useDirtyFlag);
  +manager.setDebug(debug);
   managers.put(name, manager);
   return manager;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-02-21 Thread fhanik
fhanik  2003/02/21 16:08:47

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  escalate manager properties from the cluster down to the manager
  
  Revision  ChangesPath
  1.3   +42 -24
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleTcpCluster.java 20 Feb 2003 17:54:15 -  1.2
  +++ SimpleTcpCluster.java 22 Feb 2003 00:08:47 -  1.3
  @@ -176,6 +176,19 @@
*/
   protected String threadName = "SimpleTcpCluster";
   
  +/**
  + * Whether to expire sessions when shutting down
  + */
  +protected boolean expireSessionsOnShutdown = true;
  +/**
  + * Print debug to std.out?
  + */
  +protected boolean printToScreen = false;
  +/**
  + * Replicate only sessions that have been marked dirty
  + * false=replicate sessions after each request
  + */
  +protected boolean useDirtyFlag = false;
   
   /**
* Name for logging purpose
  @@ -375,6 +388,9 @@
   public synchronized Manager createManager(String name) {
   SimpleTcpReplicationManager manager = new SimpleTcpReplicationManager(name);
   manager.setCluster(this);
  +manager.setExpireSessionsOnShutdown(expireSessionsOnShutdown);
  +manager.setPrintToScreen(printToScreen);
  +manager.setUseDirtyFlag(useDirtyFlag);
   managers.put(name, manager);
   return manager;
   }
  @@ -545,50 +561,52 @@
   
   }
   
  -public void setServiceclass(String clazz)
  -{
  +public void setServiceclass(String clazz){
   this.serviceclass = clazz;
   }
  -public void setMcastAddr(String addr)
  -{
  +public void setMcastAddr(String addr) {
   svcproperties.setProperty("mcastAddress",addr);
   }
   
  -public void setMcastPort(int port)
  -{
  +public void setMcastPort(int port) {
   svcproperties.setProperty("mcastPort",String.valueOf(port));
   }
   
  -public void setMcastFrequency(long time)
  -{
  +public void setMcastFrequency(long time) {
   svcproperties.setProperty("msgFrequency",String.valueOf(time));
   msgFrequency = time;
   }
   
  -public void setMcastDropTime(long time)
  -{
  +public void setMcastDropTime(long time) {
   svcproperties.setProperty("memberDropTime",String.valueOf(time));
   }
   
  -public void setTcpThreadCount(int count)
  -{
  +public void setTcpThreadCount(int count) {
   this.tcpThreadCount = count;
   }
   
  -public void setTcpListenAddress(String address)
  -{
  -try
  -{
  +public void setTcpListenAddress(String address)  {
  +try {
   tcpAddress = java.net.InetAddress.getByName(address);
   svcproperties.setProperty("tcpListenHost",address);
  -}catch ( Exception x )
  -{
  +}catch ( Exception x ){
   log.error("Unable to set listen address",x);
   }
   }
   
  -public void setTcpListenPort(int port)
  -{
  +public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown){
  +this.expireSessionsOnShutdown = expireSessionsOnShutdown;
  +}
  +
  +public void setPrintToScreen(boolean printToScreen) {
  +this.printToScreen = printToScreen;
  +}
  +public void setUseDirtyFlag(boolean useDirtyFlag) {
  +this.useDirtyFlag = useDirtyFlag;
  +}
  +
  +
  +public void setTcpListenPort(int port) {
   this.tcpPort = port;
   svcproperties.setProperty("tcpListenPort",String.valueOf(port));
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp SimpleTcpCluster.java

2003-02-20 Thread fhanik
fhanik  2003/02/20 09:54:15

  Modified:modules/cluster/src/share/org/apache/catalina/cluster/session
SimpleTcpReplicationManager.java
   modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
  Log:
  Now listening to the server for an after_start event before requesting data from 
other nodes
  
  Revision  ChangesPath
  1.2   +3 -12 
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java
  
  Index: SimpleTcpReplicationManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleTcpReplicationManager.java  19 Feb 2003 20:32:10 -  1.1
  +++ SimpleTcpReplicationManager.java  20 Feb 2003 17:54:15 -  1.2
  @@ -459,15 +459,6 @@
   log("Received SessionMessage sender="+sender,3);
   switch ( msg.getEventType() ) {
   case SessionMessage.EVT_GET_ALL_SESSIONS: {
  -try {
  -//hack, because we don't want to send the data until the
  -//manager is started up on the other side.
  -Thread.currentThread().sleep(5000);
  -}
  -catch ( Exception ignore ) {
  -//do nothing
  -}
  -
   //get a list of all the session from this manager
   Object[] sessions = findSessions();
   java.io.ByteArrayOutputStream bout = new 
java.io.ByteArrayOutputStream();
  
  
  
  1.2   +40 -17
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
  
  Index: SimpleTcpCluster.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleTcpCluster.java 19 Feb 2003 20:32:11 -  1.1
  +++ SimpleTcpCluster.java 20 Feb 2003 17:54:15 -  1.2
  @@ -70,6 +70,9 @@
   import java.io.IOException;
   import java.util.HashMap;
   
  +import org.apache.catalina.ServerFactory;
  +import org.apache.catalina.core.StandardServer;
  +
   import org.apache.catalina.Cluster;
   import org.apache.catalina.Container;
   import org.apache.catalina.Lifecycle;
  @@ -109,7 +112,9 @@
*/
   
   public class SimpleTcpCluster
  -implements Cluster, Lifecycle,MembershipListener, ListenCallback {
  +implements Cluster, Lifecycle,
  +   MembershipListener, ListenCallback,
  +   LifecycleListener {
   
   
   private static org.apache.commons.logging.Log log =
  @@ -231,7 +236,10 @@
*/
   protected HashMap managers = new HashMap();
   
  -
  +/**
  + * Nr of milliseconds between every heart beat
  + */
  +protected long msgFrequency = 500;
   /**
* A reference to the membership service.
*/
  @@ -251,6 +259,11 @@
   log.error("In SimpleTcpCluster.constructor()",x);
   }
   
  +if ( ServerFactory.getServer() instanceof StandardServer ) {
  +StandardServer server = (StandardServer) ServerFactory.getServer();
  +server.addLifecycleListener(this);
  +}
  +
   }
   /**
* Return descriptive information about this Cluster implementation and
  @@ -319,6 +332,7 @@
   support.firePropertyChange("container",
  oldContainer,
  this.container);
  +//this.container.
   }
   
   
  @@ -431,22 +445,14 @@
   mReplicationListener.start();
   mReplicationTransmitter = new ReplicationTransmitter(new 
SocketSender[0]);
   mReplicationTransmitter.start();
  -SessionMessage msg =
  -new SessionMessage(null,
  -   SessionMessage.EVT_GET_ALL_SESSIONS,
  -   null,
  -   null);
  +
   //wait 5 seconds to establish the view membership
  -log.info("Sleeping for 5 secs to establish cluster membership");
  +log.info("Sleeping for "+(msgFrequency*4)+" secs to establish cluster 
membership");
   service = 
MembershipFactory.getMembershipService(serviceclass,svcproperties);
   service.addMembershipListener(this);
   service.start();
   localMember = service.getLocalMember();
  -Thread.currentThread().slee