fhanik 2004/02/04 17:02:49 Modified: modules/cluster/src/share/org/apache/catalina/cluster ClusterManager.java modules/cluster/src/share/org/apache/catalina/cluster/session DeltaManager.java SimpleTcpReplicationManager.java modules/cluster/src/share/org/apache/catalina/cluster/tcp AsyncSocketSender.java Jdk13ReplicationListener.java PooledSocketSender.java ReplicationListener.java ReplicationTransmitter.java ReplicationValve.java SimpleTcpCluster.java SocketSender.java TcpReplicationThread.java WorkerThread.java Added: modules/cluster/src/share/org/apache/catalina/cluster CatalinaCluster.java Log: Added in a module cluster interface, so that I can change the server.xml to be more modular according to a proposal I made a few weeks ago Revision Changes Path 1.3 +4 -5 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ClusterManager.java 12 Jan 2004 07:50:06 -0000 1.2 +++ ClusterManager.java 5 Feb 2004 01:02:48 -0000 1.3 @@ -73,7 +73,6 @@ */ import org.apache.catalina.Manager; -import org.apache.catalina.cluster.tcp.SimpleTcpCluster; public interface ClusterManager extends Manager { @@ -118,6 +117,6 @@ public void setUseDirtyFlag(boolean useDirtyFlag); - public void setCluster(SimpleTcpCluster cluster); + public void setCluster(CatalinaCluster cluster); } 1.1 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java Index: CatalinaCluster.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java,v 1.1 2004/02/05 01:02:48 fhanik Exp $ * $Revision: 1.1 $ * $Date: 2004/02/05 01:02:48 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.catalina.cluster; import org.apache.catalina.Cluster; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Logger; import org.apache.commons.logging.Log; /** * A <b>CatalinaCluster</b> interface allows to plug in and out the * different cluster implementations * * @author Filip Hanik * @version $Revision: 1.1 $, $Date: 2004/02/05 01:02:48 $ */ public interface CatalinaCluster extends Cluster { // ----------------------------------------------------- Instance Variables /** * Descriptive information about this component implementation. */ public String info = "CatalinaCluster/1.0"; /** * Start the cluster, the owning container will invoke this * @throws Exception - if failure to start cluster */ public void start() throws Exception; /** * Stops the cluster, the owning container will invoke this * @throws LifecycleException */ public void stop() throws LifecycleException; /** * Returns the associates logger with this cluster * @return Log */ public Log getLogger(); /** * Sends a message to all the members in the cluster * @param msg SessionMessage */ public void send(SessionMessage msg); /** * Sends a message to a specific member in the cluster * @param msg SessionMessage * @param dest Member */ public void send(SessionMessage msg, Member dest); /** * returns all the members currently participating in the cluster * @return Member[] */ public Member[] getMembers(); } 1.10 +9 -8 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- DeltaManager.java 4 Feb 2004 20:22:26 -0000 1.9 +++ DeltaManager.java 5 Feb 2004 01:02:48 -0000 1.10 @@ -94,7 +94,8 @@ import org.apache.catalina.cluster.ClusterManager; import org.apache.catalina.cluster.SessionMessage; import org.apache.catalina.cluster.Member; -import org.apache.catalina.cluster.tcp.SimpleTcpCluster; +import org.apache.catalina.cluster.CatalinaCluster; + /** * The DeltaManager manages replicated sessions by only @@ -172,7 +173,7 @@ int expiredSessions=0; long processingTime=0; - private SimpleTcpCluster cluster = null; + private CatalinaCluster cluster = null; private boolean stateTransferred; private boolean useDirtyFlag; private boolean expireSessionsOnShutdown; @@ -967,10 +968,10 @@ public void setStateTransferred(boolean stateTransferred) { this.stateTransferred = stateTransferred; } - public SimpleTcpCluster getCluster() { + public CatalinaCluster getCluster() { return cluster; } - public void setCluster(SimpleTcpCluster cluster) { + public void setCluster(CatalinaCluster cluster) { this.cluster = cluster; } 1.21 +10 -8 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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- SimpleTcpReplicationManager.java 12 Jan 2004 07:50:06 -0000 1.20 +++ SimpleTcpReplicationManager.java 5 Feb 2004 01:02:48 -0000 1.21 @@ -73,7 +73,7 @@ import org.apache.catalina.cluster.tcp.IDataSender; import org.apache.catalina.cluster.tcp.SocketSender; import org.apache.catalina.cluster.Member; -import org.apache.catalina.cluster.tcp.SimpleTcpCluster; +import org.apache.catalina.cluster.CatalinaCluster; import org.apache.catalina.cluster.SessionMessage; @@ -112,6 +112,8 @@ public class SimpleTcpReplicationManager extends org.apache.catalina.session.StandardManager implements org.apache.catalina.cluster.ClusterManager { + public static org.apache.commons.logging.Log log = + org.apache.commons.logging.LogFactory.getLog( SimpleTcpReplicationManager.class ); //the channel configuration protected String mChannelConfig = null; @@ -146,7 +148,7 @@ protected boolean distributable = true; - protected org.apache.catalina.cluster.tcp.SimpleTcpCluster cluster; + protected CatalinaCluster cluster; protected java.util.HashMap invalidatedSessions = new java.util.HashMap(); @@ -181,7 +183,7 @@ mExpireSessionsOnShutdown = expireSessionsOnShutdown; } - public void setCluster(SimpleTcpCluster cluster) { + public void setCluster(CatalinaCluster cluster) { this.log("Cluster associated with SimpleTcpReplicationManager"); this.cluster = cluster; } @@ -660,7 +662,7 @@ if ( getDebug() >= level ) { String lmsg = msg; if ( mPrintToScreen ) System.out.println(lmsg); - SimpleTcpCluster.log.info(lmsg); + log.info(lmsg); } } @@ -671,7 +673,7 @@ System.out.println(lmsg); x.printStackTrace(); } - SimpleTcpCluster.log.error(lmsg,x); + log.error(lmsg,x); }//end if } public void setName(String name) { 1.4 +10 -5 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java Index: AsyncSocketSender.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AsyncSocketSender.java 13 Jan 2004 00:07:18 -0000 1.3 +++ AsyncSocketSender.java 5 Feb 2004 01:02:48 -0000 1.4 @@ -69,6 +69,11 @@ import org.apache.catalina.cluster.util.SmartQueue; public class AsyncSocketSender implements IDataSender { private static int threadCounter=1; + + private static org.apache.commons.logging.Log log = + org.apache.commons.logging.LogFactory.getLog( AsyncSocketSender.class ); + + private InetAddress address; private int port; private Socket sc = null; @@ -82,7 +87,7 @@ QueueThread t = new QueueThread(this); t.setDaemon(true); t.start(); - SimpleTcpCluster.log.info("Started async sender thread for TCP replication."); + log.info("Started async sender thread for TCP replication."); } public InetAddress getAddress() { @@ -169,7 +174,7 @@ sender.sendMessage(data); } catch (Exception x) { - SimpleTcpCluster.log.warn( + log.warn( "Unable to asynchronously send session w/ id=" + entry.getKey()+" message will be ignored."); } 1.2 +4 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/Jdk13ReplicationListener.java Index: Jdk13ReplicationListener.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/Jdk13ReplicationListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Jdk13ReplicationListener.java 18 Dec 2003 04:20:15 -0000 1.1 +++ Jdk13ReplicationListener.java 5 Feb 2004 01:02:48 -0000 1.2 @@ -80,7 +80,7 @@ { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( Jdk13ReplicationListener.class ); private ThreadPool pool = null; private boolean doListen = false; private ListenCallback callback; 1.5 +4 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java Index: PooledSocketSender.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PooledSocketSender.java 15 Jan 2004 04:19:50 -0000 1.4 +++ PooledSocketSender.java 5 Feb 2004 01:02:48 -0000 1.5 @@ -81,7 +81,7 @@ { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( org.apache.catalina.cluster.tcp.SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( org.apache.catalina.cluster.CatalinaCluster.class ); private InetAddress address; private int port; 1.10 +5 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java Index: ReplicationListener.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ReplicationListener.java 9 Jan 2004 02:53:08 -0000 1.9 +++ ReplicationListener.java 5 Feb 2004 01:02:48 -0000 1.10 @@ -78,13 +78,14 @@ import org.apache.catalina.cluster.io.ListenCallback; import org.apache.catalina.cluster.io.ObjectReader; import org.apache.catalina.cluster.io.XByteBuffer; +import org.apache.catalina.cluster.CatalinaCluster; /** */ public class ReplicationListener extends Thread { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( ReplicationListener.class ); private ThreadPool pool = null; private boolean doListen = false; private ListenCallback callback; 1.13 +5 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java Index: ReplicationTransmitter.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ReplicationTransmitter.java 13 Jan 2004 04:22:28 -0000 1.12 +++ ReplicationTransmitter.java 5 Feb 2004 01:02:48 -0000 1.13 @@ -64,12 +64,13 @@ package org.apache.catalina.cluster.tcp; import org.apache.catalina.cluster.io.XByteBuffer; +import org.apache.catalina.cluster.CatalinaCluster; public class ReplicationTransmitter { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( ReplicationTransmitter.class ); private java.util.HashMap map = new java.util.HashMap(); public ReplicationTransmitter(IDataSender[] senders) 1.10 +7 -7 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationValve.java Index: ReplicationValve.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationValve.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ReplicationValve.java 13 Jan 2004 05:26:59 -0000 1.9 +++ ReplicationValve.java 5 Feb 2004 01:02:48 -0000 1.10 @@ -89,7 +89,7 @@ import org.apache.catalina.util.StringManager; import org.apache.catalina.valves.*; import org.apache.catalina.cluster.SessionMessage; -import org.apache.catalina.cluster.tcp.SimpleTcpCluster; +import org.apache.catalina.cluster.CatalinaCluster; import org.apache.catalina.cluster.ClusterSession; import org.apache.catalina.cluster.ClusterManager; @@ -109,7 +109,7 @@ public class ReplicationValve extends ValveBase { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( ReplicationValve.class ); // ----------------------------------------------------- Instance Variables @@ -191,7 +191,7 @@ if (!( request.getContext().getManager() instanceof ClusterManager) ) return; ClusterManager manager = (ClusterManager)request.getContext().getManager(); - SimpleTcpCluster cluster = (SimpleTcpCluster)getContainer().getCluster(); + CatalinaCluster cluster = (CatalinaCluster)getContainer().getCluster(); if ( cluster == null ) { log.warn("No cluster configured for this request."); return; 1.29 +11 -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.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- SimpleTcpCluster.java 13 Jan 2004 05:58:25 -0000 1.28 +++ SimpleTcpCluster.java 5 Feb 2004 01:02:48 -0000 1.29 @@ -85,6 +85,7 @@ import org.apache.catalina.util.StringManager; 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; @@ -113,8 +114,8 @@ * @version $Revision$, $Date$ */ -public class SimpleTcpCluster - implements Cluster, Lifecycle, +public class SimpleTcpCluster + implements CatalinaCluster, Lifecycle, MembershipListener, ListenCallback, LifecycleListener { @@ -788,6 +789,10 @@ */ public void stop(String contextPath) throws IOException { return; + } + + public Log getLogger() { + return log; } 1.11 +4 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketSender.java Index: SocketSender.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketSender.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- SocketSender.java 13 Jan 2004 00:07:18 -0000 1.10 +++ SocketSender.java 5 Feb 2004 01:02:48 -0000 1.11 @@ -78,7 +78,7 @@ { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( org.apache.catalina.cluster.tcp.SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( SocketSender.class ); private InetAddress address; private int port; 1.8 +5 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/TcpReplicationThread.java Index: TcpReplicationThread.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/TcpReplicationThread.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TcpReplicationThread.java 9 Jan 2004 23:24:09 -0000 1.7 +++ TcpReplicationThread.java 5 Feb 2004 01:02:48 -0000 1.8 @@ -69,6 +69,7 @@ import java.io.IOException; import java.nio.channels.SocketChannel; import org.apache.catalina.cluster.io.ObjectReader; + import java.util.LinkedList; /** * A worker thread class which can drain channels and echo-back @@ -85,7 +86,7 @@ public class TcpReplicationThread extends WorkerThread { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( TcpReplicationThread.class ); private ByteBuffer buffer = ByteBuffer.allocate (1024); private SelectionKey key; private boolean synchronous=false; 1.5 +4 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java Index: WorkerThread.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- WorkerThread.java 20 Dec 2003 00:48:52 -0000 1.4 +++ WorkerThread.java 5 Feb 2004 01:02:48 -0000 1.5 @@ -67,7 +67,7 @@ public class WorkerThread extends Thread { private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( SimpleTcpCluster.class ); + org.apache.commons.logging.LogFactory.getLog( WorkerThread.class ); protected ThreadPool pool; protected boolean doRun = true;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]