Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterDeployer.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterDeployer.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterDeployer.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterDeployer.java Sat Oct 21 16:10:15 2006 @@ -1,120 +1,121 @@ -/* - * 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.ha; - -/** - * A <b>ClusterDeployer</b> interface allows to plug in and out the - * different deployment implementations - * - * @author Filip Hanik - * @version $Revision: 378050 $, $Date: 2006-02-15 12:30:02 -0600 (Wed, 15 Feb 2006) $ - */ -import org.apache.catalina.LifecycleException; -import java.io.IOException; -import java.net.URL; -import org.apache.catalina.tribes.ChannelListener; - -public interface ClusterDeployer extends ChannelListener { - /** - * Descriptive information about this component implementation. - */ - public String info = "ClusterDeployer/1.0"; - /** - * Start the cluster deployer, the owning container will invoke this - * @throws Exception - if failure to start cluster - */ - public void start() throws Exception; - - /** - * Stops the cluster deployer, the owning container will invoke this - * @throws LifecycleException - */ - public void stop() throws LifecycleException; - - /** - * Sets the deployer for this cluster deployer to use. - * @param deployer Deployer - */ - // FIXME - //public void setDeployer(Deployer deployer); - - /** - * Install a new web application, whose web application archive is at the - * specified URL, into this container and all the other - * members of the cluster 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. - * <p> - * If this application is successfully installed locally, - * a ContainerEvent of type - * <code>INSTALL_EVENT</code> will be sent to all registered listeners, - * with the newly created <code>Context</code> 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 install(String contextPath, URL war) throws IOException; - - /** - * Remove an existing web application, attached to the specified context - * path. If this application is successfully removed, a - * ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all - * registered listeners, with the removed <code>Context</code> as - * an argument. Deletes the web application war file and/or directory - * if they exist in the Host's appBase. - * - * @param contextPath The context path of the application to be removed - * @param undeploy boolean flag to remove web application from server - * - * @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 - * removal - */ - public void remove(String contextPath, boolean undeploy) throws IOException; - - /** - * call from container Background Process - */ - public void backgroundProcess(); - - /** - * Returns the cluster the cluster deployer is associated with - * @return CatalinaCluster - */ - public CatalinaCluster getCluster(); - - /** - * Associates the cluster deployer with a cluster - * @param cluster CatalinaCluster - */ - public void setCluster(CatalinaCluster cluster); - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + +/** + * A <b>ClusterDeployer</b> interface allows to plug in and out the + * different deployment implementations + * + * @author Filip Hanik + * @version $Revision: 378050 $, $Date: 2006-02-15 12:30:02 -0600 (Wed, 15 Feb 2006) $ + */ +import org.apache.catalina.LifecycleException; +import java.io.IOException; +import java.net.URL; +import org.apache.catalina.tribes.ChannelListener; + +public interface ClusterDeployer extends ChannelListener { + /** + * Descriptive information about this component implementation. + */ + public String info = "ClusterDeployer/1.0"; + /** + * Start the cluster deployer, the owning container will invoke this + * @throws Exception - if failure to start cluster + */ + public void start() throws Exception; + + /** + * Stops the cluster deployer, the owning container will invoke this + * @throws LifecycleException + */ + public void stop() throws LifecycleException; + + /** + * Sets the deployer for this cluster deployer to use. + * @param deployer Deployer + */ + // FIXME + //public void setDeployer(Deployer deployer); + + /** + * Install a new web application, whose web application archive is at the + * specified URL, into this container and all the other + * members of the cluster 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. + * <p> + * If this application is successfully installed locally, + * a ContainerEvent of type + * <code>INSTALL_EVENT</code> will be sent to all registered listeners, + * with the newly created <code>Context</code> 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 install(String contextPath, URL war) throws IOException; + + /** + * Remove an existing web application, attached to the specified context + * path. If this application is successfully removed, a + * ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all + * registered listeners, with the removed <code>Context</code> as + * an argument. Deletes the web application war file and/or directory + * if they exist in the Host's appBase. + * + * @param contextPath The context path of the application to be removed + * @param undeploy boolean flag to remove web application from server + * + * @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 + * removal + */ + public void remove(String contextPath, boolean undeploy) throws IOException; + + /** + * call from container Background Process + */ + public void backgroundProcess(); + + /** + * Returns the cluster the cluster deployer is associated with + * @return CatalinaCluster + */ + public CatalinaCluster getCluster(); + + /** + * Associates the cluster deployer with a cluster + * @param cluster CatalinaCluster + */ + public void setCluster(CatalinaCluster cluster); + +}
Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterListener.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterListener.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterListener.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterListener.java Sat Oct 21 16:10:15 2006 @@ -1,113 +1,114 @@ -/* - * 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.ha; - - - - -import org.apache.catalina.tribes.ChannelListener; -import org.apache.catalina.tribes.ChannelMessage; -import org.apache.catalina.util.StringManager; -import java.io.Serializable; -import org.apache.catalina.tribes.Member; - - -/** - * Receive SessionID cluster change from other backup node after primary session - * node is failed. - * - * @author Peter Rossbach - * @author Filip Hanik - * @version $Revision: 378258 $ $Date: 2006-02-16 08:42:35 -0600 (Thu, 16 Feb 2006) $ - */ -public abstract class ClusterListener implements ChannelListener { - - public static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ClusterListener.class); - - - //--Instance Variables-------------------------------------- - - /** - * The string manager for this package. - */ - protected StringManager sm = StringManager.getManager(Constants.Package); - - protected CatalinaCluster cluster = null; - - //--Constructor--------------------------------------------- - - public ClusterListener() { - } - - //--Instance Getters/Setters-------------------------------- - - public CatalinaCluster getCluster() { - return cluster; - } - - public void setCluster(CatalinaCluster cluster) { - if (log.isDebugEnabled()) { - if (cluster != null) - log.debug("add ClusterListener " + this.toString() + " to cluster" + cluster); - else - log.debug("remove ClusterListener " + this.toString() + " from cluster"); - } - this.cluster = cluster; - } - - public boolean equals(Object listener) { - return super.equals(listener); - } - - public int hashCode() { - return super.hashCode(); - } - - //--Logic--------------------------------------------------- - - public final void messageReceived(Serializable msg, Member member) { - if ( msg instanceof ClusterMessage ) messageReceived((ClusterMessage)msg); - } - public final boolean accept(Serializable msg, Member member) { - if ( msg instanceof ClusterMessage ) return true; - return false; - } - - - - /** - * Callback from the cluster, when a message is received, The cluster will - * broadcast it invoking the messageReceived on the receiver. - * - * @param msg - * ClusterMessage - the message received from the cluster - */ - public abstract void messageReceived(ClusterMessage msg) ; - - - /** - * Accept only SessionIDMessages - * - * @param msg - * ClusterMessage - * @return boolean - returns true to indicate that messageReceived should be - * invoked. If false is returned, the messageReceived method will - * not be invoked. - */ - public abstract boolean accept(ClusterMessage msg) ; - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + + + + +import org.apache.catalina.tribes.ChannelListener; +import org.apache.catalina.tribes.ChannelMessage; +import org.apache.catalina.util.StringManager; +import java.io.Serializable; +import org.apache.catalina.tribes.Member; + + +/** + * Receive SessionID cluster change from other backup node after primary session + * node is failed. + * + * @author Peter Rossbach + * @author Filip Hanik + * @version $Revision: 378258 $ $Date: 2006-02-16 08:42:35 -0600 (Thu, 16 Feb 2006) $ + */ +public abstract class ClusterListener implements ChannelListener { + + public static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ClusterListener.class); + + + //--Instance Variables-------------------------------------- + + /** + * The string manager for this package. + */ + protected StringManager sm = StringManager.getManager(Constants.Package); + + protected CatalinaCluster cluster = null; + + //--Constructor--------------------------------------------- + + public ClusterListener() { + } + + //--Instance Getters/Setters-------------------------------- + + public CatalinaCluster getCluster() { + return cluster; + } + + public void setCluster(CatalinaCluster cluster) { + if (log.isDebugEnabled()) { + if (cluster != null) + log.debug("add ClusterListener " + this.toString() + " to cluster" + cluster); + else + log.debug("remove ClusterListener " + this.toString() + " from cluster"); + } + this.cluster = cluster; + } + + public boolean equals(Object listener) { + return super.equals(listener); + } + + public int hashCode() { + return super.hashCode(); + } + + //--Logic--------------------------------------------------- + + public final void messageReceived(Serializable msg, Member member) { + if ( msg instanceof ClusterMessage ) messageReceived((ClusterMessage)msg); + } + public final boolean accept(Serializable msg, Member member) { + if ( msg instanceof ClusterMessage ) return true; + return false; + } + + + + /** + * Callback from the cluster, when a message is received, The cluster will + * broadcast it invoking the messageReceived on the receiver. + * + * @param msg + * ClusterMessage - the message received from the cluster + */ + public abstract void messageReceived(ClusterMessage msg) ; + + + /** + * Accept only SessionIDMessages + * + * @param msg + * ClusterMessage + * @return boolean - returns true to indicate that messageReceived should be + * invoked. If false is returned, the messageReceived method will + * not be invoked. + */ + public abstract boolean accept(ClusterMessage msg) ; + +} Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterManager.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterManager.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterManager.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterManager.java Sat Oct 21 16:10:15 2006 @@ -1,110 +1,111 @@ -/* - * Copyright 1999,2004-2005 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.ha; - - -import org.apache.catalina.Manager; -import java.io.IOException; -import org.apache.catalina.tribes.io.ReplicationStream; - - -/** - * The common interface used by all cluster manager. - * This is so that we can have a more pluggable way - * of swapping session managers for different algorithms. - * - * @author Filip Hanik - * @author Peter Rossbach - */ -public interface ClusterManager extends Manager { - - /** - * A message was received from another node, this - * is the callback method to implement if you are interested in - * receiving replication messages. - * @param msg - the message received. - */ - public void messageDataReceived(ClusterMessage msg); - - /** - * When the request has been completed, the replication valve - * will notify the manager, and the manager will decide whether - * any replication is needed or not. - * If there is a need for replication, the manager will - * create a session message and that will be replicated. - * The cluster determines where it gets sent. - * @param sessionId - the sessionId that just completed. - * @return a SessionMessage to be sent. - */ - public ClusterMessage requestCompleted(String sessionId); - - /** - * When the manager expires session not tied to a request. - * The cluster will periodically ask for a list of sessions - * that should expire and that should be sent across the wire. - * @return String[] The invalidated sessions - */ - public String[] getInvalidatedSessions(); - - /** - * Return the name of the manager, at host /context name and at engine hostname+/context. - * @return String - * @since 5.5.10 - */ - public String getName(); - - /** - * Set the name of the manager, at host /context name and at engine hostname+/context - * @param name - * @since 5.5.10 - */ - public void setName(String name); - - public CatalinaCluster getCluster(); - - public void setCluster(CatalinaCluster cluster); - - /** - * @return Manager send only to same cluster domain. - * @since 5.5.10 - */ - public boolean isSendClusterDomainOnly(); - - /** - * @param sendClusterDomainOnly Flag value. - * @since 5.5.10 - */ - public void setSendClusterDomainOnly(boolean sendClusterDomainOnly); - - /** - * @param mode The mode - * @since 5.5.10 - */ - public void setDefaultMode(boolean mode); - - /** - * @since 5.5.10 - */ - public boolean isDefaultMode(); - - public ReplicationStream getReplicationStream(byte[] data) throws IOException; - - public ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException; - - public boolean isNotifyListenersOnReplication(); - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + + +import org.apache.catalina.Manager; +import java.io.IOException; +import org.apache.catalina.tribes.io.ReplicationStream; + + +/** + * The common interface used by all cluster manager. + * This is so that we can have a more pluggable way + * of swapping session managers for different algorithms. + * + * @author Filip Hanik + * @author Peter Rossbach + */ +public interface ClusterManager extends Manager { + + /** + * A message was received from another node, this + * is the callback method to implement if you are interested in + * receiving replication messages. + * @param msg - the message received. + */ + public void messageDataReceived(ClusterMessage msg); + + /** + * When the request has been completed, the replication valve + * will notify the manager, and the manager will decide whether + * any replication is needed or not. + * If there is a need for replication, the manager will + * create a session message and that will be replicated. + * The cluster determines where it gets sent. + * @param sessionId - the sessionId that just completed. + * @return a SessionMessage to be sent. + */ + public ClusterMessage requestCompleted(String sessionId); + + /** + * When the manager expires session not tied to a request. + * The cluster will periodically ask for a list of sessions + * that should expire and that should be sent across the wire. + * @return String[] The invalidated sessions + */ + public String[] getInvalidatedSessions(); + + /** + * Return the name of the manager, at host /context name and at engine hostname+/context. + * @return String + * @since 5.5.10 + */ + public String getName(); + + /** + * Set the name of the manager, at host /context name and at engine hostname+/context + * @param name + * @since 5.5.10 + */ + public void setName(String name); + + public CatalinaCluster getCluster(); + + public void setCluster(CatalinaCluster cluster); + + /** + * @return Manager send only to same cluster domain. + * @since 5.5.10 + */ + public boolean isSendClusterDomainOnly(); + + /** + * @param sendClusterDomainOnly Flag value. + * @since 5.5.10 + */ + public void setSendClusterDomainOnly(boolean sendClusterDomainOnly); + + /** + * @param mode The mode + * @since 5.5.10 + */ + public void setDefaultMode(boolean mode); + + /** + * @since 5.5.10 + */ + public boolean isDefaultMode(); + + public ReplicationStream getReplicationStream(byte[] data) throws IOException; + + public ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException; + + public boolean isNotifyListenersOnReplication(); + +} Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterMessage.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterMessage.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterMessage.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterMessage.java Sat Oct 21 16:10:15 2006 @@ -1,33 +1,34 @@ -/* - * Copyright 1999,2005 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.ha; - -import java.io.Serializable; -import org.apache.catalina.tribes.Member; - - -/** - * @author Filip Hanik - * - */ -public interface ClusterMessage extends Serializable { - public Member getAddress(); - public void setAddress(Member member); - public String getUniqueId(); - public void setUniqueId(String id); - public long getTimestamp(); - public void setTimestamp(long timestamp); -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + +import java.io.Serializable; +import org.apache.catalina.tribes.Member; + + +/** + * @author Filip Hanik + * + */ +public interface ClusterMessage extends Serializable { + public Member getAddress(); + public void setAddress(Member member); + public String getUniqueId(); + public void setUniqueId(String id); + public long getTimestamp(); + public void setTimestamp(long timestamp); +} Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterRuleSet.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterRuleSet.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterRuleSet.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterRuleSet.java Sat Oct 21 16:10:15 2006 @@ -1,9 +1,10 @@ /* - * Copyright 1999-2001,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 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 * Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterSession.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterSession.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterSession.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterSession.java Sat Oct 21 16:10:15 2006 @@ -1,39 +1,40 @@ -/* - * 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.ha; - -import org.apache.catalina.Session; -import javax.servlet.http.HttpSession; - -public interface ClusterSession extends Session, HttpSession { - /** - * returns true if this session is the primary session, if that is the - * case, the manager can expire it upon timeout. - * @return True if this session is primary - */ - public boolean isPrimarySession(); - - /** - * Sets whether this is the primary session or not. - * @param primarySession Flag value - */ - public void setPrimarySession(boolean primarySession); - - - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + +import org.apache.catalina.Session; +import javax.servlet.http.HttpSession; + +public interface ClusterSession extends Session, HttpSession { + /** + * returns true if this session is the primary session, if that is the + * case, the manager can expire it upon timeout. + * @return True if this session is primary + */ + public boolean isPrimarySession(); + + /** + * Sets whether this is the primary session or not. + * @param primarySession Flag value + */ + public void setPrimarySession(boolean primarySession); + + + +} Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterValve.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterValve.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterValve.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/ClusterValve.java Sat Oct 21 16:10:15 2006 @@ -1,36 +1,37 @@ -/* - * 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.ha; - -/** - * Cluster Valve Interface to mark all Cluster Valves - * Only those Valve can'be configured as Cluster Valves - * @author Peter Rossbach - * @version $Revision: 303842 $, $Date: 2005-04-10 11:20:46 -0500 (Sun, 10 Apr 2005) $ - */ -public interface ClusterValve { - /** - * Returns the cluster the cluster deployer is associated with - * @return CatalinaCluster - */ - public CatalinaCluster getCluster(); - - /** - * Associates the cluster deployer with a cluster - * @param cluster CatalinaCluster - */ - public void setCluster(CatalinaCluster cluster); -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + +/** + * Cluster Valve Interface to mark all Cluster Valves + * Only those Valve can'be configured as Cluster Valves + * @author Peter Rossbach + * @version $Revision: 303842 $, $Date: 2005-04-10 11:20:46 -0500 (Sun, 10 Apr 2005) $ + */ +public interface ClusterValve { + /** + * Returns the cluster the cluster deployer is associated with + * @return CatalinaCluster + */ + public CatalinaCluster getCluster(); + + /** + * Associates the cluster deployer with a cluster + * @param cluster CatalinaCluster + */ + public void setCluster(CatalinaCluster cluster); +} Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/Constants.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/Constants.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/Constants.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/Constants.java Sat Oct 21 16:10:15 2006 @@ -1,30 +1,31 @@ -/* - * 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.ha; - -/** - * Manifest constants for the <code>org.apache.catalina.ha</code> - * package. - * - * @author Bip Thelin - * @version $Revision: 302726 $, $Date: 2004-02-27 08:59:07 -0600 (Fri, 27 Feb 2004) $ - */ - -public final class Constants { - public static final String Package = "org.apache.catalina.ha"; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha; + +/** + * Manifest constants for the <code>org.apache.catalina.ha</code> + * package. + * + * @author Bip Thelin + * @version $Revision: 302726 $, $Date: 2004-02-27 08:59:07 -0600 (Fri, 27 Feb 2004) $ + */ + +public final class Constants { + public static final String Package = "org.apache.catalina.ha"; +} Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/context/ReplicatedContext.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/context/ReplicatedContext.java?view=diff&rev=466608&r1=466607&r2=466608 ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/context/ReplicatedContext.java (original) +++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/context/ReplicatedContext.java Sat Oct 21 16:10:15 2006 @@ -1,125 +1,126 @@ -/* - * Copyright 1999,2004-2005 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.ha.context; - -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.ha.CatalinaCluster; -import org.apache.catalina.tribes.tipis.ReplicatedMap; -import org.apache.catalina.tribes.Channel; -import org.apache.catalina.Loader; -import org.apache.catalina.core.ApplicationContext; -import org.apache.catalina.Globals; -import javax.servlet.ServletContext; -import java.util.HashMap; -import org.apache.catalina.tribes.tipis.LazyReplicatedMap; - -/** - * @author Filip Hanik - * @version 1.0 - */ -public class ReplicatedContext extends StandardContext { - private int mapSendOptions = Channel.SEND_OPTIONS_DEFAULT; - public static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog( ReplicatedContext.class ); - - protected static long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds - - - - public synchronized void start() throws LifecycleException { - if ( this.started ) return; - try { - CatalinaCluster catclust = (CatalinaCluster)this.getCluster(); - if (this.context == null) this.context = new ReplApplContext(this.getBasePath(), this); - if ( catclust != null ) { - ReplicatedMap map = new ReplicatedMap(this,catclust.getChannel(),DEFAULT_REPL_TIMEOUT, - getName(),getClassLoaders()); - map.setChannelSendOptions(mapSendOptions); - ((ReplApplContext)this.context).setAttributeMap(map); - if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName()); - } - super.start(); - } catch ( Exception x ) { - log.error("Unable to start ReplicatedContext",x); - throw new LifecycleException("Failed to start ReplicatedContext",x); - } - } - - public synchronized void stop() throws LifecycleException - { - ReplicatedMap map = (ReplicatedMap)((ReplApplContext)this.context).getAttributeMap(); - if ( map!=null ) { - map.breakdown(); - } - if ( !this.started ) return; - try { - } catch ( Exception x ){ - log.error("Unable to stop ReplicatedContext",x); - throw new LifecycleException("Failed to stop ReplicatedContext",x); - } finally { - super.stop(); - } - - } - - - public void setMapSendOptions(int mapSendOptions) { - this.mapSendOptions = mapSendOptions; - } - - public int getMapSendOptions() { - return mapSendOptions; - } - - public ClassLoader[] getClassLoaders() { - Loader loader = null; - ClassLoader classLoader = null; - loader = this.getLoader(); - if (loader != null) classLoader = loader.getClassLoader(); - if ( classLoader == null ) classLoader = Thread.currentThread().getContextClassLoader(); - if ( classLoader == Thread.currentThread().getContextClassLoader() ) { - return new ClassLoader[] {classLoader}; - } else { - return new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()}; - } - } - - public ServletContext getServletContext() { - return ((ReplApplContext)context).getFacade(); - - } - - - protected static class ReplApplContext extends ApplicationContext { - public ReplApplContext(String basePath, StandardContext context) { - super(basePath,context); - } - - protected ServletContext getFacade() { - return super.getFacade(); - } - - public HashMap getAttributeMap() { - return this.attributes; - } - public void setAttributeMap(HashMap map) { - this.attributes = map; - } - - } - - +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.ha.context; + +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.ha.CatalinaCluster; +import org.apache.catalina.tribes.tipis.ReplicatedMap; +import org.apache.catalina.tribes.Channel; +import org.apache.catalina.Loader; +import org.apache.catalina.core.ApplicationContext; +import org.apache.catalina.Globals; +import javax.servlet.ServletContext; +import java.util.HashMap; +import org.apache.catalina.tribes.tipis.LazyReplicatedMap; + +/** + * @author Filip Hanik + * @version 1.0 + */ +public class ReplicatedContext extends StandardContext { + private int mapSendOptions = Channel.SEND_OPTIONS_DEFAULT; + public static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog( ReplicatedContext.class ); + + protected static long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds + + + + public synchronized void start() throws LifecycleException { + if ( this.started ) return; + try { + CatalinaCluster catclust = (CatalinaCluster)this.getCluster(); + if (this.context == null) this.context = new ReplApplContext(this.getBasePath(), this); + if ( catclust != null ) { + ReplicatedMap map = new ReplicatedMap(this,catclust.getChannel(),DEFAULT_REPL_TIMEOUT, + getName(),getClassLoaders()); + map.setChannelSendOptions(mapSendOptions); + ((ReplApplContext)this.context).setAttributeMap(map); + if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName()); + } + super.start(); + } catch ( Exception x ) { + log.error("Unable to start ReplicatedContext",x); + throw new LifecycleException("Failed to start ReplicatedContext",x); + } + } + + public synchronized void stop() throws LifecycleException + { + ReplicatedMap map = (ReplicatedMap)((ReplApplContext)this.context).getAttributeMap(); + if ( map!=null ) { + map.breakdown(); + } + if ( !this.started ) return; + try { + } catch ( Exception x ){ + log.error("Unable to stop ReplicatedContext",x); + throw new LifecycleException("Failed to stop ReplicatedContext",x); + } finally { + super.stop(); + } + + } + + + public void setMapSendOptions(int mapSendOptions) { + this.mapSendOptions = mapSendOptions; + } + + public int getMapSendOptions() { + return mapSendOptions; + } + + public ClassLoader[] getClassLoaders() { + Loader loader = null; + ClassLoader classLoader = null; + loader = this.getLoader(); + if (loader != null) classLoader = loader.getClassLoader(); + if ( classLoader == null ) classLoader = Thread.currentThread().getContextClassLoader(); + if ( classLoader == Thread.currentThread().getContextClassLoader() ) { + return new ClassLoader[] {classLoader}; + } else { + return new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()}; + } + } + + public ServletContext getServletContext() { + return ((ReplApplContext)context).getFacade(); + + } + + + protected static class ReplApplContext extends ApplicationContext { + public ReplApplContext(String basePath, StandardContext context) { + super(basePath,context); + } + + protected ServletContext getFacade() { + return super.getFacade(); + } + + public HashMap getAttributeMap() { + return this.attributes; + } + public void setAttributeMap(HashMap map) { + this.attributes = map; + } + + } + + } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]