|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.cluster.tcp.SimpleTcpCluster
A Cluster implementation using simple multicast. Responsible for 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
Field Summary | |
protected java.lang.String |
clusterImpName
Name for logging purpose |
protected java.util.Vector |
clusterListeners
Listeners of messages |
protected java.lang.String |
clusterName
The cluster name to join |
protected Container |
container
The Container associated with this Cluster. |
protected boolean |
expireSessionsOnShutdown
Whether to expire sessions when shutting down |
protected static java.lang.String |
info
Descriptive information about this component implementation. |
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component. |
static org.apache.commons.logging.Log |
log
|
protected java.util.HashMap |
managers
The context name <->manager association for distributed contexts. |
protected org.apache.catalina.cluster.tcp.SimpleTcpCluster.MemberComparator |
memberComparator
|
protected MembershipService |
membershipService
the service that provides the membership |
protected boolean |
printToScreen
Print debug to std.out? |
protected StringManager |
sm
The string manager for this package. |
protected boolean |
started
Has this component been started? |
protected java.beans.PropertyChangeSupport |
support
The property change support for this component. |
protected boolean |
useDirtyFlag
Replicate only sessions that have been marked dirty false=replicate sessions after each request |
Fields inherited from interface org.apache.catalina.Lifecycle |
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
SimpleTcpCluster()
|
Method Summary | |
void |
addClusterListener(MessageListener listener)
|
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component. |
void |
addManager(java.lang.String name,
ClusterManager manager)
|
void |
addValve(Valve valve)
|
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc. |
Manager |
createManager(java.lang.String name)
Create a new manager which will use this cluster to replicate its sessions. |
protected byte[] |
createMessageData(ClusterMessage msg)
Send Message create Timestamp and generate message bytes form msg |
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
ClusterDeployer |
getClusterDeployer()
|
java.lang.String |
getClusterName()
Return the name of the cluster that this Server is currently configured to operate within. |
ClusterReceiver |
getClusterReceiver()
|
ClusterSender |
getClusterSender()
|
Container |
getContainer()
Get the Container associated with our Cluster |
java.lang.String |
getInfo()
Return descriptive information about this Cluster implementation and the corresponding version number, in the format <description>/<version> . |
long |
getLastChecked()
|
Member |
getLocalMember()
Return the member that represents this node. |
org.apache.commons.logging.Log |
getLogger()
Returns the associates logger with this cluster |
protected javax.management.modelmbean.ModelMBean |
getManagedBean(java.lang.Object object)
Returns the ModelMBean |
Manager |
getManager(java.lang.String name)
|
java.lang.String |
getManagerClassName()
|
protected javax.management.MBeanServer |
getMBeanServer()
Get current Catalina MBean Server and load mbean registry |
Member[] |
getMembers()
returns all the members currently participating in the cluster |
MembershipService |
getMembershipService()
|
long |
getMsgSendTime()
|
boolean |
getNotifyListenersOnReplication()
|
long |
getNrOfMsgsReceived()
|
javax.management.ObjectName |
getObjectName()
|
java.lang.String |
getProtocol()
Returns the protocol. |
Valve |
getValve()
|
void |
installContext(java.lang.String contextPath,
java.net.URL war)
Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path. |
boolean |
isExpireSessionsOnShutdown()
|
boolean |
isPrintToScreen()
|
boolean |
isUseDirtyFlag()
|
void |
lifecycleEvent(LifecycleEvent lifecycleEvent)
Acknowledge the occurrence of the specified event. |
void |
memberAdded(Member member)
|
void |
memberDisappeared(Member member)
|
void |
messageDataReceived(byte[] data)
This method is invoked on the callback object to notify it that new data has been received from one of the cluster nodes. |
protected void |
registerMBeans()
register Means at cluster |
void |
removeClusterListener(MessageListener listener)
|
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component. |
void |
removeManager(java.lang.String name)
|
void |
send(ClusterMessage msg)
send message to all cluster members |
void |
send(ClusterMessage msg,
Member dest)
Sends a message to a specific member in the cluster |
void |
setClusterDeployer(ClusterDeployer clusterDeployer)
|
void |
setClusterName(java.lang.String clusterName)
Set the name of the cluster to join, if no cluster with this name is present create one. |
void |
setClusterReceiver(ClusterReceiver clusterReceiver)
|
void |
setClusterSender(ClusterSender clusterSender)
|
void |
setContainer(Container container)
Set the Container associated with our Cluster |
void |
setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
|
void |
setManagerClassName(java.lang.String managerClassName)
|
void |
setMembershipService(MembershipService membershipService)
|
void |
setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
|
void |
setObjectName(javax.management.ObjectName name)
|
void |
setPrintToScreen(boolean printToScreen)
|
void |
setProtocol(java.lang.String protocol)
Sets the configurable protocol stack. |
void |
setUseDirtyFlag(boolean useDirtyFlag)
|
void |
start()
Prepare for the beginning of active use of the public methods of this component. |
void |
startContext(java.lang.String contextPath)
Start an existing web application, attached to the specified context path in all the other nodes in the cluster. |
void |
stop()
Gracefully terminate the active use of the public methods of this component. |
void |
stop(java.lang.String contextPath)
Stop an existing web application, attached to the specified context path. |
protected void |
unregisterMBeans()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static org.apache.commons.logging.Log log
protected static final java.lang.String info
protected MembershipService membershipService
protected boolean expireSessionsOnShutdown
protected boolean printToScreen
protected boolean useDirtyFlag
protected java.lang.String clusterImpName
protected StringManager sm
protected java.lang.String clusterName
protected Container container
protected LifecycleSupport lifecycle
protected boolean started
protected java.beans.PropertyChangeSupport support
protected java.util.HashMap managers
protected org.apache.catalina.cluster.tcp.SimpleTcpCluster.MemberComparator memberComparator
protected java.util.Vector clusterListeners
Constructor Detail |
public SimpleTcpCluster()
Method Detail |
public java.lang.String getInfo()
<description>/<version>
.
getInfo
in interface Cluster
public void setClusterName(java.lang.String clusterName)
setClusterName
in interface Cluster
clusterName
- The clustername to joinpublic java.lang.String getClusterName()
getClusterName
in interface Cluster
public void setContainer(Container container)
setContainer
in interface Cluster
container
- The Container to usepublic Container getContainer()
getContainer
in interface Cluster
public void setProtocol(java.lang.String protocol)
setProtocol
in interface Cluster
protocol
- the protocol stack - this method is called by the server
configuration at startuppublic java.lang.String getProtocol()
getProtocol
in interface Cluster
public Member[] getMembers()
CatalinaCluster
getMembers
in interface CatalinaCluster
public Member getLocalMember()
getLocalMember
in interface CatalinaCluster
public Manager createManager(java.lang.String name)
Cluster
createManager
in interface Cluster
name
- Name (key) of the application with which the manager is
associatedpublic void removeManager(java.lang.String name)
removeManager
in interface CatalinaCluster
public void addManager(java.lang.String name, ClusterManager manager)
addManager
in interface CatalinaCluster
public Manager getManager(java.lang.String name)
getManager
in interface CatalinaCluster
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic void backgroundProcess()
backgroundProcess
in interface Cluster
public LifecycleListener[] findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to removepublic void start() throws LifecycleException
configure()
,
and before any of the public methods of the component are utilized.
start
in interface CatalinaCluster
java.lang.IllegalStateException
- if this component has already been started
LifecycleException
- if this component detects a fatal error that prevents this
component from being usedpublic void send(ClusterMessage msg, Member dest)
CatalinaCluster
send
in interface CatalinaCluster
msg
- SessionMessagedest
- Memberprotected byte[] createMessageData(ClusterMessage msg) throws java.io.IOException
msg
- cluster message
java.io.IOException
public void send(ClusterMessage msg)
send
in interface CatalinaCluster
msg
- SessionMessageCatalinaCluster.send(org.apache.catalina.cluster.ClusterMessage)
public void stop() throws LifecycleException
stop
in interface CatalinaCluster
java.lang.IllegalStateException
- if this component has not been started
LifecycleException
- if this component detects a fatal error that needs to be
reportedpublic void memberAdded(Member member)
memberAdded
in interface MembershipListener
public void memberDisappeared(Member member)
memberDisappeared
in interface MembershipListener
public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
public void setPrintToScreen(boolean printToScreen)
public long getMsgSendTime()
public long getLastChecked()
public long getNrOfMsgsReceived()
public boolean isExpireSessionsOnShutdown()
public boolean isPrintToScreen()
public boolean isUseDirtyFlag()
public void setUseDirtyFlag(boolean useDirtyFlag)
public void messageDataReceived(byte[] data)
ListenCallback
messageDataReceived
in interface ListenCallback
data
- - the message bytes received from the cluster/replication systempublic void lifecycleEvent(LifecycleEvent lifecycleEvent)
LifecycleListener
lifecycleEvent
in interface LifecycleListener
lifecycleEvent
- LifecycleEvent that has occurredpublic void startContext(java.lang.String contextPath) throws java.io.IOException
startContext
in interface Cluster
contextPath
- The context path of the application to be started
java.lang.IllegalArgumentException
- if the specified context path is malformed (it must be ""
or start with a slash)
java.lang.IllegalArgumentException
- if the specified context path does not identify a
currently installed web application
java.io.IOException
- if an input/output error occurs during startuppublic void installContext(java.lang.String contextPath, java.net.URL war)
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.
installContext
in interface Cluster
contextPath
- The context path to which this application should be installed
(must be unique)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
java.lang.IllegalArgumentException
- if the specified context path is malformed (it must be ""
or start with a slash)
java.lang.IllegalStateException
- if the specified context path is already attached to an
existing web applicationpublic void stop(java.lang.String contextPath) throws java.io.IOException
stop
in interface Cluster
contextPath
- The context path of the application to be stopped
java.lang.IllegalArgumentException
- if the specified context path is malformed (it must be ""
or start with a slash)
java.lang.IllegalArgumentException
- if the specified context path does not identify a
currently installed web application
java.io.IOException
- if an input/output error occurs while stopping the web
applicationpublic org.apache.commons.logging.Log getLogger()
CatalinaCluster
getLogger
in interface CatalinaCluster
public java.lang.String getManagerClassName()
public void setManagerClassName(java.lang.String managerClassName)
public ClusterSender getClusterSender()
getClusterSender
in interface CatalinaCluster
public void setClusterSender(ClusterSender clusterSender)
setClusterSender
in interface CatalinaCluster
public ClusterReceiver getClusterReceiver()
getClusterReceiver
in interface CatalinaCluster
public void setClusterReceiver(ClusterReceiver clusterReceiver)
setClusterReceiver
in interface CatalinaCluster
public MembershipService getMembershipService()
getMembershipService
in interface CatalinaCluster
public void setMembershipService(MembershipService membershipService)
setMembershipService
in interface CatalinaCluster
public void addValve(Valve valve)
addValve
in interface CatalinaCluster
public Valve getValve()
getValve
in interface CatalinaCluster
public void addClusterListener(MessageListener listener)
addClusterListener
in interface CatalinaCluster
public void removeClusterListener(MessageListener listener)
removeClusterListener
in interface CatalinaCluster
public ClusterDeployer getClusterDeployer()
getClusterDeployer
in interface CatalinaCluster
public void setClusterDeployer(ClusterDeployer clusterDeployer)
setClusterDeployer
in interface CatalinaCluster
public boolean getNotifyListenersOnReplication()
public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
protected void registerMBeans()
protected void unregisterMBeans()
protected javax.management.MBeanServer getMBeanServer() throws java.lang.Exception
java.lang.Exception
protected javax.management.modelmbean.ModelMBean getManagedBean(java.lang.Object object) throws java.lang.Exception
object
- The Object to get the ModelMBean for
java.lang.Exception
- If an error occurs this constructors throws this exceptionpublic void setObjectName(javax.management.ObjectName name)
public javax.management.ObjectName getObjectName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |