import org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapOwner;
import org.apache.catalina.tribes.tipis.ReplicatedMap;
import org.apache.catalina.util.Enumerator;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
public MultiEnumeration(Enumeration<T>[] lists) {
e = lists;
}
+ @Override
public boolean hasMoreElements() {
for ( int i=0; i<e.length; i++ ) {
if ( e[i].hasMoreElements() ) return true;
}
return false;
}
+ @Override
public T nextElement() {
for ( int i=0; i<e.length; i++ ) {
if ( e[i].hasMoreElements() ) return e[i].nextElement();
}
}
+ @Override
public void objectMadePrimay(Object key, Object value) {
//noop
}
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapOwner;
import org.apache.catalina.tribes.tipis.LazyReplicatedMap;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
// ClusterManager Interface
//******************************************************************************/
+ @Override
public void messageDataReceived(ClusterMessage msg) {
}
mExpireSessionsOnShutdown = expireSessionsOnShutdown;
}
+ @Override
public void setCluster(CatalinaCluster cluster) {
if(log.isDebugEnabled())
log.debug("Cluster associated with BackupManager");
}
+ @Override
public ClusterMessage requestCompleted(String sessionId) {
if (!getState().isAvailable()) return null;
LazyReplicatedMap map = (LazyReplicatedMap)sessions;
//=========================================================================
// OVERRIDE THESE METHODS TO IMPLEMENT THE REPLICATION
//=========================================================================
+ @Override
public void objectMadePrimay(Object key, Object value) {
if (value!=null && value instanceof DeltaSession) {
DeltaSession session = (DeltaSession)value;
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* Starts the cluster communication channel, this will connect with the
* other nodes in the cluster, and request the current session state to be
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* This will disconnect the cluster communication channel and stop the
* listener thread.
this.distributable = dist;
}
+ @Override
public void setName(String name) {
this.name = name;
}
+ @Override
public boolean isNotifyListenersOnReplication() {
return notifyListenersOnReplication;
}
/*
* @see org.apache.catalina.ha.ClusterManager#getCluster()
*/
+ @Override
public CatalinaCluster getCluster() {
return cluster;
}
return mapSendOptions;
}
+ @Override
public String[] getInvalidatedSessions() {
return new String[0];
}
+ @Override
public ClusterManager cloneFromTemplate() {
BackupManager result = new BackupManager();
result.mExpireSessionsOnShutdown = mExpireSessionsOnShutdown;
import org.apache.catalina.Container;
import org.apache.catalina.Loader;
-import org.apache.catalina.Manager;
import org.apache.catalina.ha.ClusterManager;
import org.apache.catalina.session.ManagerBase;
import org.apache.catalina.tribes.io.ReplicationStream;
* @return The object input stream
* @throws IOException
*/
+ @Override
public ReplicationStream getReplicationStream(byte[] data) throws IOException {
return getReplicationStream(data,0,data.length);
}
+ @Override
public ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException {
ByteArrayInputStream fis = new ByteArrayInputStream(data, offset, length);
return new ReplicationStream(fis, getClassLoaders());
// ---------------------------------------------------- persistence handler
/**
- * {@link Manager} implementations that also implement
+ * {@link org.apache.catalina.Manager} implementations that also implement
* {@link ClusterManager} do not support local session persistence.
*/
+ @Override
public void load() {
// NOOP
}
+ @Override
public void unload() {
// NOOP
}
import org.apache.catalina.ha.tcp.ReplicationValve;
import org.apache.catalina.tribes.Member;
import org.apache.catalina.tribes.io.ReplicationStream;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.ExceptionUtils;
import org.apache.tomcat.util.res.StringManager;
return info;
}
+ @Override
public void setName(String name) {
this.name = name;
}
this.expireSessionsOnShutdown = expireSessionsOnShutdown;
}
+ @Override
public boolean isNotifyListenersOnReplication() {
return notifyListenersOnReplication;
}
}
- public CatalinaCluster getCluster() {
+ @Override
+public CatalinaCluster getCluster() {
return cluster;
}
+ @Override
public void setCluster(CatalinaCluster cluster) {
this.cluster = cluster;
}
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
* @param cmsg -
* the message received.
*/
+ @Override
public void messageDataReceived(ClusterMessage cmsg) {
if (cmsg != null && cmsg instanceof SessionMessage) {
SessionMessage msg = (SessionMessage) cmsg;
* the sessionId that just completed.
* @return a SessionMessage to be sent,
*/
+ @Override
public ClusterMessage requestCompleted(String sessionId) {
return requestCompleted(sessionId, false);
}
*
* @return The invalidated sessions array
*/
+ @Override
public String[] getInvalidatedSessions() {
return new String[0];
}
cluster.send(newmsg, sender);
}
+ @Override
public ClusterManager cloneFromTemplate() {
DeltaManager result = new DeltaManager();
result.name = "Clone-from-"+name;
actionPool.clear();
}
+ @Override
public void readExternal(java.io.ObjectInput in) throws IOException,ClassNotFoundException {
//sessionId - String
//recordAll - boolean
}
+ @Override
public void writeExternal(java.io.ObjectOutput out ) throws java.io.IOException {
//sessionId - String
//recordAll - boolean
private int action;
private int type;
- public AttributeInfo() {}
-
public AttributeInfo(int type,
int action,
String name,
return other.getName().equals(this.getName());
}
+ @Override
public void readExternal(java.io.ObjectInput in ) throws IOException,ClassNotFoundException {
//type - int
//action - int
if ( hasValue ) value = in.readObject();
}
+ @Override
public void writeExternal(java.io.ObjectOutput out) throws IOException {
//type - int
//action - int
* and is not in a locked state
* @return boolean
*/
+ @Override
public boolean isDirty() {
return getDeltaRequest().getSize()>0;
}
* Otherwise it will serialize the entire object.
* @return boolean
*/
+ @Override
public boolean isDiffable() {
return true;
}
* @return byte[]
* @throws IOException
*/
+ @Override
public byte[] getDiff() throws IOException {
try{
lock();
* @param length int
* @throws IOException
*/
+ @Override
public void applyDiff(byte[] diff, int offset, int length) throws IOException, ClassNotFoundException {
try {
lock();
/**
* Resets the current diff state and resets the dirty flag
*/
+ @Override
public void resetDiff() {
resetDeltaRequest();
}
/**
* Lock during serialization
*/
+ @Override
public void lock() {
diffLock.lock();
}
/**
* Unlock after serialization
*/
+ @Override
public void unlock() {
diffLock.unlock();
}
+ @Override
public void setOwner(Object owner) {
if ( owner instanceof ClusterManager && getManager()==null) {
ClusterManager cm = (ClusterManager)owner;
* returns true if this session is the primary session, if that is the case,
* the manager can expire it upon timeout.
*/
+ @Override
public boolean isPrimarySession() {
return isPrimarySession;
}
* @param primarySession
* Flag value
*/
+ @Override
public void setPrimarySession(boolean primarySession) {
this.isPrimarySession = primarySession;
}
// ------------------------------------------------ Session Package Methods
+ @Override
public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
try {
lock();
activate();
}
+ @Override
public void writeExternal(ObjectOutput out ) throws java.io.IOException {
try {
lock();
return lastTimeReplicated;
}
+ @Override
public long getVersion() {
return version;
}
this.lastTimeReplicated = lastTimeReplicated;
}
+ @Override
public void setVersion(long version) {
this.version = version;
}
* must return an empty <code>Enumeration</code> and will be
* removed in a future version of the API.
*/
+ @Override
@Deprecated
public Enumeration<String> getIds() {
return (new Enumerator<String>(dummy));
* must return null and will be removed in a future version of
* the API.
*/
+ @Override
@Deprecated
public HttpSession getSession(String id) {
return (null);
import org.apache.catalina.connector.Response;
import org.apache.catalina.ha.CatalinaCluster;
import org.apache.catalina.ha.ClusterManager;
-import org.apache.catalina.ha.ClusterMessage;
import org.apache.catalina.ha.ClusterValve;
import org.apache.catalina.session.ManagerBase;
import org.apache.catalina.session.PersistentManager;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.catalina.valves.ValveBase;
import org.apache.tomcat.util.res.StringManager;
/**
* @return Returns the cluster.
*/
+ @Override
public CatalinaCluster getCluster() {
return cluster;
}
/**
* @param cluster The cluster to set.
*/
+ @Override
public void setCluster(CatalinaCluster cluster) {
this.cluster = cluster;
}
/**
* Send the changed Sessionid to all clusternodes.
*
- * @see JvmRouteSessionIDBinderListener#messageReceived(ClusterMessage)
+ * @see JvmRouteSessionIDBinderListener#messageReceived(
+ * org.apache.catalina.ha.ClusterMessage)
* @param manager
* ClusterManager
* @param sessionId
* @param newSessionID
* new session id, bind to the new cluster node
*/
- protected void sendSessionIDClusterBackup(ClusterManager manager,Request request,String sessionId,
- String newSessionID) {
+ protected void sendSessionIDClusterBackup(ClusterManager manager,
+ Request request, String sessionId, String newSessionID) {
SessionIDMessage msg = new SessionIDMessage();
msg.setOrignalSessionID(sessionId);
msg.setBackupSessionID(newSessionID);
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
public class SerializablePrincipal implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+
private static final org.apache.juli.logging.Log log =
org.apache.juli.logging.LogFactory.getLog(SerializablePrincipal.class);
*/
public class SessionIDMessage extends ClusterMessageBase {
+ private static final long serialVersionUID = 1L;
+
private int messageNumber;
private String orignalSessionID;
*
*/
-public interface SessionMessage extends ClusterMessage, java.io.Serializable
-{
+public interface SessionMessage extends ClusterMessage {
/**
* Event type used when a session has been created on a node
*/
public class SessionMessageImpl extends ClusterMessageBase implements SessionMessage {
+ private static final long serialVersionUID = 1L;
+
+
public SessionMessageImpl() {
}
* returns the event type
* @return one of the event types EVT_XXXX
*/
+ @Override
public int getEventType() { return mEvtType; }
/**
* @return the serialized data for the session
*/
+ @Override
public byte[] getSession() { return mSession;}
/**
* @return the session ID for the session
*/
+ @Override
public String getSessionID(){ return mSessionID; }
/**
* clear text event type name (for logging purpose only)
* @return the event type in a string representation, useful for debugging
*/
+ @Override
public String getEventTypeString()
{
switch (mEvtType)
}
}
+ @Override
public String getContextName() {
return mContextName;
}