|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.ha.tcp.SimpleTcpCluster
public class 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 wrote testcases
Field Summary | |
---|---|
static java.lang.String |
AFTER_MANAGERREGISTER_EVENT
|
static java.lang.String |
AFTER_MANAGERUNREGISTER_EVENT
|
static java.lang.String |
AFTER_MEMBERREGISTER_EVENT
|
static java.lang.String |
AFTER_MEMBERUNREGISTER_EVENT
|
static java.lang.String |
BEFORE_MANAGERREGISTER_EVENT
|
static java.lang.String |
BEFORE_MANAGERUNREGISTER_EVENT
|
static java.lang.String |
BEFORE_MEMBERREGISTER_EVENT
|
static java.lang.String |
BEFORE_MEMBERUNREGISTER_EVENT
|
protected Channel |
channel
Group channel. |
protected java.lang.String |
clusterImpName
Name for logging purpose |
protected java.util.List |
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 |
hasMembers
has members |
protected boolean |
heartbeatBackgroundEnabled
call Channel.heartbeat() at container background thread |
protected static java.lang.String |
info
Descriptive information about this component implementation. |
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component. |
static Log |
log
|
protected java.util.Map |
managers
The context name <->manager association for distributed contexts. |
protected ClusterManager |
managerTemplate
|
static java.lang.String |
RECEIVE_MESSAGE_FAILURE_EVENT
|
static java.lang.String |
SEND_MESSAGE_FAILURE_EVENT
|
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. |
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 | |
---|---|
boolean |
accept(java.io.Serializable msg,
Member sender)
Notify all listeners from receiving a new message is not ClusterMessage and emit Failure Event to LifecylceListener |
void |
addClusterListener(ClusterListener listener)
add cluster message listener and register cluster to this listener |
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component. |
void |
addValve(Valve valve)
Add cluster valve Cluster Valves are only add to container when cluster is started! |
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc. |
protected void |
checkDefaults()
|
Manager |
createManager(java.lang.String name)
Create new Manager without add to cluster (comes with start the manager) |
ClusterListener[] |
findClusterListeners()
Get the cluster listeners associated with this cluster. |
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
Channel |
getChannel()
|
int |
getChannelSendOptions()
|
int |
getChannelStartOptions()
|
ClusterDeployer |
getClusterDeployer()
get current Deployer |
java.lang.String |
getClusterName()
Return the name of the cluster that this Server is currently configured to operate within. |
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> . |
Member |
getLocalMember()
Return the member that represents this node. |
Log |
getLogger()
Returns the associates logger with this cluster. |
Manager |
getManager(java.lang.String name)
|
java.lang.String |
getManagerClassName()
Deprecated. use getManagerTemplate().getClass().getName() instead. |
java.lang.String |
getManagerName(java.lang.String name,
Manager manager)
|
java.util.Map |
getManagers()
|
ClusterManager |
getManagerTemplate()
|
Member[] |
getMembers()
Get all current cluster members |
java.lang.Object |
getProperty(java.lang.String key)
get current config |
java.util.Iterator |
getPropertyNames()
Get all properties keys |
java.lang.String |
getProtocol()
Get the protocol used by the cluster. |
Valve[] |
getValves()
get all cluster valves |
boolean |
hasMembers()
Returns that cluster has members. |
boolean |
isHeartbeatBackgroundEnabled()
Return heartbeat enable flag (default false) |
boolean |
isNotifyLifecycleListenerOnFailure()
|
void |
lifecycleEvent(LifecycleEvent lifecycleEvent)
Use as base to handle start/stop/periodic Events from host. |
void |
memberAdded(Member member)
New cluster member is registered |
void |
memberDisappeared(Member member)
Cluster member is gone |
void |
messageReceived(ClusterMessage message)
|
void |
messageReceived(java.io.Serializable message,
Member sender)
Receive a message from the channel |
protected void |
registerClusterValve()
register all cluster valve to host or engine |
void |
registerManager(Manager manager)
Register a manager with the cluster. |
void |
removeClusterListener(ClusterListener listener)
remove message listener and deregister Cluster from listener |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component. |
void |
removeManager(Manager manager)
remove an application form cluster replication bus |
void |
removeProperty(java.lang.String key)
remove a configured property. |
void |
send(ClusterMessage msg)
send message to all cluster members |
void |
send(ClusterMessage msg,
Member dest)
send a cluster message to one member |
void |
sendClusterDomain(ClusterMessage msg)
send message to all cluster members same cluster domain |
void |
setChannel(Channel channel)
|
void |
setChannelSendOptions(int channelSendOptions)
|
void |
setChannelStartOptions(int channelStartOptions)
|
void |
setClusterDeployer(ClusterDeployer clusterDeployer)
set a new Deployer, must be set before cluster started! |
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 |
setContainer(Container container)
Set the Container associated with our Cluster |
void |
setHeartbeatBackgroundEnabled(boolean heartbeatBackgroundEnabled)
enabled that container backgroundThread call heartbeat at channel |
void |
setManagerClassName(java.lang.String managerClassName)
Deprecated. use nested <Manager> element inside the cluster config instead. |
void |
setManagerTemplate(ClusterManager managerTemplate)
|
void |
setNotifyLifecycleListenerOnFailure(boolean notifyListenerOnFailure)
|
boolean |
setProperty(java.lang.String name,
java.lang.Object value)
set config attributes with reflect and propagate to all managers |
boolean |
setProperty(java.lang.String name,
java.lang.String value)
JMX hack to direct use at jconsole |
void |
setProtocol(java.lang.String protocol)
Set the protocol parameters. |
void |
start()
Prepare for the beginning of active use of the public methods of this component. |
void |
stop()
Gracefully terminate the active cluster component. |
protected void |
transferProperty(java.lang.String prefix,
java.lang.Object bean)
transfer properties from cluster configuration to subelement bean. |
protected void |
unregisterClusterValve()
unregister all cluster valve to host or engine |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.catalina.tribes.ChannelListener |
---|
equals, hashCode |
Field Detail |
---|
public static Log log
protected static final java.lang.String info
public static final java.lang.String BEFORE_MEMBERREGISTER_EVENT
public static final java.lang.String AFTER_MEMBERREGISTER_EVENT
public static final java.lang.String BEFORE_MANAGERREGISTER_EVENT
public static final java.lang.String AFTER_MANAGERREGISTER_EVENT
public static final java.lang.String BEFORE_MANAGERUNREGISTER_EVENT
public static final java.lang.String AFTER_MANAGERUNREGISTER_EVENT
public static final java.lang.String BEFORE_MEMBERUNREGISTER_EVENT
public static final java.lang.String AFTER_MEMBERUNREGISTER_EVENT
public static final java.lang.String SEND_MESSAGE_FAILURE_EVENT
public static final java.lang.String RECEIVE_MESSAGE_FAILURE_EVENT
protected Channel channel
protected java.lang.String clusterImpName
protected StringManager sm
protected java.lang.String clusterName
protected boolean heartbeatBackgroundEnabled
GroupChannel.heartbeat()
protected Container container
protected LifecycleSupport lifecycle
protected boolean started
protected java.beans.PropertyChangeSupport support
protected java.util.Map managers
protected ClusterManager managerTemplate
protected java.util.List clusterListeners
protected boolean hasMembers
Constructor Detail |
---|
public SimpleTcpCluster()
Method Detail |
---|
public java.lang.String getInfo()
<description>/<version>
.
getInfo
in interface Cluster
public boolean isHeartbeatBackgroundEnabled()
public void setHeartbeatBackgroundEnabled(boolean heartbeatBackgroundEnabled)
heartbeatBackgroundEnabled
- the heartbeatBackgroundEnabled to setpublic 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 boolean isNotifyLifecycleListenerOnFailure()
public void setNotifyLifecycleListenerOnFailure(boolean notifyListenerOnFailure)
notifyListenerOnFailure
- The notifyLifecycleListenerOnFailure to set.public java.lang.String getManagerClassName()
public void setManagerClassName(java.lang.String managerClassName)
managerClassName
- Stringpublic void addValve(Valve valve)
addValve
in interface CatalinaCluster
valve
- The new cluster Valve.public Valve[] getValves()
getValves
in interface CatalinaCluster
public ClusterListener[] findClusterListeners()
public void addClusterListener(ClusterListener listener)
addClusterListener
in interface CatalinaCluster
CatalinaCluster.addClusterListener(org.apache.catalina.ha.ClusterListener)
public void removeClusterListener(ClusterListener listener)
removeClusterListener
in interface CatalinaCluster
CatalinaCluster.removeClusterListener(org.apache.catalina.ha.ClusterListener)
public ClusterDeployer getClusterDeployer()
getClusterDeployer
in interface CatalinaCluster
public void setClusterDeployer(ClusterDeployer clusterDeployer)
setClusterDeployer
in interface CatalinaCluster
public void setChannel(Channel channel)
setChannel
in interface CatalinaCluster
public void setManagerTemplate(ClusterManager managerTemplate)
public void setChannelSendOptions(int channelSendOptions)
public boolean hasMembers()
CatalinaCluster
hasMembers
in interface CatalinaCluster
public Member[] getMembers()
getMembers
in interface CatalinaCluster
public Member getLocalMember()
getLocalMember
in interface CatalinaCluster
public boolean setProperty(java.lang.String name, java.lang.String value)
name
- value
- public boolean setProperty(java.lang.String name, java.lang.Object value)
setProperty
in interface IDynamicProperty
name
- value
- public java.lang.Object getProperty(java.lang.String key)
getProperty
in interface IDynamicProperty
key
-
public java.util.Iterator getPropertyNames()
getPropertyNames
in interface IDynamicProperty
public void removeProperty(java.lang.String key)
removeProperty
in interface IDynamicProperty
key
- protected void transferProperty(java.lang.String prefix, java.lang.Object bean)
prefix
- bean
- public java.util.Map getManagers()
getManagers
in interface CatalinaCluster
public Channel getChannel()
getChannel
in interface CatalinaCluster
public ClusterManager getManagerTemplate()
public int getChannelSendOptions()
public Manager createManager(java.lang.String name)
createManager
in interface Cluster
name
- Context Name of this managerCluster.createManager(java.lang.String)
,
registerManager(Manager)
,
DeltaManager.start()
public void registerManager(Manager manager)
Cluster
registerManager
in interface Cluster
manager
- Managerpublic void removeManager(Manager manager)
removeManager
in interface Cluster
manager
- ManagerCluster.removeManager(Manager)
public java.lang.String getManagerName(java.lang.String name, Manager manager)
getManagerName
in interface CatalinaCluster
public Manager getManager(java.lang.String name)
getManager
in interface CatalinaCluster
public void backgroundProcess()
backgroundProcess
in interface Cluster
FarmWarDeployer.backgroundProcess()
,
GroupChannel.heartbeat()
,
GroupChannel.HeartbeatThread.run()
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic LifecycleListener[] findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to removepublic void lifecycleEvent(LifecycleEvent lifecycleEvent)
lifecycleEvent
in interface LifecycleListener
lifecycleEvent
- LifecycleEvent that has occurredLifecycleListener.lifecycleEvent(org.apache.catalina.LifecycleEvent)
public void start() throws LifecycleException
configure()
,
and before any of the public methods of the component are utilized.
start
in interface CatalinaCluster
start
in interface Lifecycle
java.lang.IllegalStateException
- if this component has already been started
LifecycleException
- if this component detects a fatal error that prevents this
component from being usedprotected void checkDefaults()
protected void registerClusterValve() throws java.lang.Exception
java.lang.Exception
java.lang.ClassNotFoundException
protected void unregisterClusterValve() throws java.lang.Exception
java.lang.Exception
java.lang.ClassNotFoundException
public void stop() throws LifecycleException
stop
in interface CatalinaCluster
stop
in interface Lifecycle
java.lang.IllegalStateException
- if this component has not been started
LifecycleException
- if this component detects a fatal error that needs to be
reportedpublic void send(ClusterMessage msg)
send
in interface CatalinaCluster
msg
- message to transferCatalinaCluster.send(ClusterMessage)
public void sendClusterDomain(ClusterMessage msg)
sendClusterDomain
in interface CatalinaCluster
msg
- ClusterMessageCatalinaCluster.send(ClusterMessage)
public void send(ClusterMessage msg, Member dest)
send
in interface CatalinaCluster
msg
- message to transferdest
- Receiver memberCatalinaCluster.send(ClusterMessage,Member)
public void memberAdded(Member member)
memberAdded
in interface MembershipListener
member
- Member - the member that was addedMembershipListener.memberAdded(Member)
public void memberDisappeared(Member member)
memberDisappeared
in interface MembershipListener
member
- MemberMembershipListener.memberDisappeared(Member)
public boolean accept(java.io.Serializable msg, Member sender)
accept
in interface ChannelListener
msg
- received Messagesender
- Member
public void messageReceived(java.io.Serializable message, Member sender)
ChannelListener
messageReceived
in interface ChannelListener
message
- Serializablesender
- - the source of the messagepublic void messageReceived(ClusterMessage message)
public Log getLogger()
CatalinaCluster
getLogger
in interface CatalinaCluster
public void setProtocol(java.lang.String protocol)
Cluster
setProtocol
in interface Cluster
protocol
- The protocol used by the clusterCluster.setProtocol(java.lang.String)
public java.lang.String getProtocol()
Cluster
getProtocol
in interface Cluster
Cluster.getProtocol()
public int getChannelStartOptions()
public void setChannelStartOptions(int channelStartOptions)
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |