org.apache.catalina.cluster.session
Class SessionMessageImpl

java.lang.Object
  extended byorg.apache.catalina.cluster.session.SessionMessageImpl
All Implemented Interfaces:
ClusterMessage, java.io.Serializable, SessionMessage

public class SessionMessageImpl
extends java.lang.Object
implements SessionMessage, java.io.Serializable

Session cluster message

Version:
$Id: SessionMessageImpl.java 958491 2010-06-28 07:41:58Z kfujino $
Author:
Filip Hanik, Peter Rossbach
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.catalina.cluster.session.SessionMessage
EVT_ALL_SESSION_DATA, EVT_ALL_SESSION_TRANSFERCOMPLETE, EVT_CHANGE_SESSION_ID, EVT_GET_ALL_SESSIONS, EVT_SESSION_ACCESSED, EVT_SESSION_CREATED, EVT_SESSION_DELTA, EVT_SESSION_EXPIRED
 
Fields inherited from interface org.apache.catalina.cluster.ClusterMessage
FLAG_ALLOWED, FLAG_DEFAULT, FLAG_FORBIDDEN
 
Constructor Summary
SessionMessageImpl()
           
SessionMessageImpl(java.lang.String contextName, int eventtype, byte[] session, java.lang.String sessionID, java.lang.String uniqueID)
          Creates a session message.
 
Method Summary
 Member getAddress()
          Get the address that this message originated from.
 int getCompress()
          Each message can made the desicion that compress is allowed or not or handle by default.
 java.lang.String getContextName()
           
 int getEventType()
          returns the event type
 java.lang.String getEventTypeString()
          clear text event type name (for logging purpose only)
 int getResend()
          Each message can made the desicion that resend is allowed or not or handle by default.
 byte[] getSession()
           
 java.lang.String getSessionID()
           
 long getTimestamp()
          Timestamp message.
 java.lang.String getUniqueId()
          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.
 void setAddress(Member src)
          Use this method to set the address that this message originated from.
 void setCompress(int compress)
          set desicion that compress is allowed or not or handle by default.
 void setResend(int resend)
          set desicion that resend is allowed or not or handle by default.
 void setTimestamp(long time)
          set message send time but only the first setting works (one shot)
 void setUniqueId(java.lang.String uniqueId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionMessageImpl

public SessionMessageImpl()

SessionMessageImpl

public SessionMessageImpl(java.lang.String contextName,
                          int eventtype,
                          byte[] session,
                          java.lang.String sessionID,
                          java.lang.String uniqueID)
Creates a session message. Depending on what event type you want this message to represent, you populate the different parameters in the constructor
The following rules apply dependent on what event type argument you use:
EVT_SESSION_CREATED
The parameters: session, sessionID must be set.
EVT_SESSION_EXPIRED
The parameters: sessionID must be set.
EVT_SESSION_ACCESSED
The parameters: sessionID must be set.
EVT_GET_ALL_SESSIONS
get all sessions from from one of the nodes.
EVT_SESSION_DELTA
Send attribute delta (add,update,remove attribute or principal, ...).
EVT_ALL_SESSION_DATA
Send complete serializes session list
EVT_ALL_SESSION_TRANSFERCOMPLETE
send that all session state information are transfered after GET_ALL_SESSION received from this sender.
EVT_CHANGE_SESSION_ID
send original sessionID and new sessionID.

Parameters:
contextName - - the name of the context (application
eventtype - - one of the 8 event type defined in this class
session - - the serialized byte array of the session itself
sessionID - - the id that identifies this session
uniqueID - - the id that identifies this message
Method Detail

getEventType

public int getEventType()
returns the event type

Specified by:
getEventType in interface SessionMessage
Returns:
one of the event types EVT_XXXX

getSession

public byte[] getSession()
Specified by:
getSession in interface SessionMessage
Returns:
the serialized data for the session

getSessionID

public java.lang.String getSessionID()
Specified by:
getSessionID in interface SessionMessage
Returns:
the session ID for the session

setTimestamp

public void setTimestamp(long time)
set message send time but only the first setting works (one shot)

Specified by:
setTimestamp in interface ClusterMessage
Parameters:
time - The timestamp

getTimestamp

public long getTimestamp()
Description copied from interface: ClusterMessage
Timestamp message.

Specified by:
getTimestamp in interface ClusterMessage
Returns:
long

getEventTypeString

public java.lang.String getEventTypeString()
clear text event type name (for logging purpose only)

Specified by:
getEventTypeString in interface SessionMessage
Returns:
the event type in a string representating, useful for debugging

getAddress

public Member getAddress()
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.

Specified by:
getAddress in interface ClusterMessage

setAddress

public void setAddress(Member src)
Use this method to set the address that this message originated from. This can be used when re-sending the EVT_GET_ALL_SESSIONS message to another machine in the group.

Specified by:
setAddress in interface ClusterMessage
Parameters:
src - Member

getContextName

public java.lang.String getContextName()
Specified by:
getContextName in interface SessionMessage

getUniqueId

public java.lang.String getUniqueId()
Description copied from interface: ClusterMessage
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.

Specified by:
getUniqueId in interface ClusterMessage
Returns:
String

setUniqueId

public void setUniqueId(java.lang.String uniqueId)

getCompress

public int getCompress()
Description copied from interface: ClusterMessage
Each message can made the desicion that compress is allowed or not or handle by default.

Specified by:
getCompress in interface ClusterMessage
Returns:
Returns the compress.
Since:
5.5.10

setCompress

public void setCompress(int compress)
Description copied from interface: ClusterMessage
set desicion that compress is allowed or not or handle by default.

Specified by:
setCompress in interface ClusterMessage
Parameters:
compress - The compress to set.
Since:
5.5.10

getResend

public int getResend()
Description copied from interface: ClusterMessage
Each message can made the desicion that resend is allowed or not or handle by default.

Specified by:
getResend in interface ClusterMessage
Returns:
Returns the resend.
Since:
5.5.10

setResend

public void setResend(int resend)
Description copied from interface: ClusterMessage
set desicion that resend is allowed or not or handle by default.

Specified by:
setResend in interface ClusterMessage
Parameters:
resend - The resend to set.
Since:
5.5.10


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.