Class SimpleTcpCluster

    • Field Detail

      • log

        public static final Log log

        public static final java.lang.String BEFORE_MEMBERREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String AFTER_MEMBERREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String BEFORE_MANAGERREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String AFTER_MANAGERREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String BEFORE_MANAGERUNREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String AFTER_MANAGERUNREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String BEFORE_MEMBERUNREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String AFTER_MEMBERUNREGISTER_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String SEND_MESSAGE_FAILURE_EVENT
        See Also:
        Constant Field Values

        public static final java.lang.String RECEIVE_MESSAGE_FAILURE_EVENT
        See Also:
        Constant Field Values
      • channel

        protected Channel channel
        Group channel.
      • sm

        protected static final StringManager sm
        The string manager for this package.
      • clusterName

        protected java.lang.String clusterName
        The cluster name to join
      • heartbeatBackgroundEnabled

        protected boolean heartbeatBackgroundEnabled
        call Channel.heartbeat() at container background thread
        See Also:
      • container

        protected Container container
        The Container associated with this Cluster.
      • support

        protected final java.beans.PropertyChangeSupport support
        The property change support for this component.
      • managers

        protected final java.util.Map<java.lang.String,​ClusterManager> managers
        The context name <-> manager association for distributed contexts.
      • clusterListeners

        protected final java.util.List<ClusterListener> clusterListeners
        Listeners of messages
      • hasMembers

        protected boolean hasMembers
        has members
    • Constructor Detail

      • SimpleTcpCluster

        public SimpleTcpCluster()
    • Method Detail

      • isHeartbeatBackgroundEnabled

        public boolean isHeartbeatBackgroundEnabled()
        Return heartbeat enable flag (default false)
        the heartbeatBackgroundEnabled
      • setHeartbeatBackgroundEnabled

        public void setHeartbeatBackgroundEnabled​(boolean heartbeatBackgroundEnabled)
        enabled that container backgroundThread call heartbeat at channel
        heartbeatBackgroundEnabled - the heartbeatBackgroundEnabled to set
      • setClusterName

        public void setClusterName​(java.lang.String clusterName)
        Set the name of the cluster to join, if no cluster with this name is present create one.
        Specified by:
        setClusterName in interface Cluster
        clusterName - The clustername to join
      • getClusterName

        public java.lang.String getClusterName()
        Return the name of the cluster that this Server is currently configured to operate within.
        Specified by:
        getClusterName in interface Cluster
        The name of the cluster associated with this server
      • setContainer

        public void setContainer​(Container container)
        Set the Container associated with our Cluster
        Specified by:
        setContainer in interface Contained
        container - The Container to use
      • getContainer

        public Container getContainer()
        Get the Container associated with our Cluster
        Specified by:
        getContainer in interface Contained
        The Container associated with our Cluster
      • isNotifyLifecycleListenerOnFailure

        public boolean isNotifyLifecycleListenerOnFailure()
        Returns the notifyLifecycleListenerOnFailure.
      • setNotifyLifecycleListenerOnFailure

        public void setNotifyLifecycleListenerOnFailure​(boolean notifyListenerOnFailure)
        notifyListenerOnFailure - The notifyLifecycleListenerOnFailure to set.
      • addValve

        public void addValve​(Valve valve)
        Add cluster valve Cluster Valves are only add to container when cluster is started!
        Specified by:
        addValve in interface CatalinaCluster
        valve - The new cluster Valve.
      • getValves

        public Valve[] getValves()
        get all cluster valves
        Specified by:
        getValves in interface CatalinaCluster
        current cluster valves
      • findClusterListeners

        public ClusterListener[] findClusterListeners()
        Get the cluster listeners associated with this cluster. If this Array has no listeners registered, a zero-length array is returned.
        the listener array
      • setClusterDeployer

        public void setClusterDeployer​(ClusterDeployer clusterDeployer)
        set a new Deployer, must be set before cluster started!
        Specified by:
        setClusterDeployer in interface CatalinaCluster
        clusterDeployer - The associated deployer
      • setManagerTemplate

        public void setManagerTemplate​(ClusterManager managerTemplate)
      • setChannelSendOptions

        public void setChannelSendOptions​(int channelSendOptions)
      • setChannelSendOptions

        public void setChannelSendOptions​(java.lang.String channelSendOptions)
      • hasMembers

        public boolean hasMembers()
        Specified by:
        hasMembers in interface CatalinaCluster
        true if the cluster has members.
      • getMembers

        public Member[] getMembers()
        Get all current cluster members
        Specified by:
        getMembers in interface CatalinaCluster
        all members or empty array
      • getChannelSendOptions

        public int getChannelSendOptions()
      • getChannelSendOptionsName

        public java.lang.String getChannelSendOptionsName()
        returns the SendOptions as a comma separated list of names for use by JMX
        a comma separated list of the option names
      • registerManager

        public void registerManager​(Manager manager)
        Description copied from interface: Cluster
        Register a manager with the cluster. If the cluster is not responsible for creating a manager, then the container will at least notify the cluster that this manager is participating in the cluster.
        Specified by:
        registerManager in interface Cluster
        manager - Manager
      • getManagerName

        public java.lang.String getManagerName​(java.lang.String name,
                                               Manager manager)
        Description copied from interface: CatalinaCluster
        Get a new cluster name for a manager.
        Specified by:
        getManagerName in interface CatalinaCluster
        name - Override name (optional)
        manager - The manager
        the manager name in the cluster
      • getManager

        public Manager getManager​(java.lang.String name)
        Description copied from interface: CatalinaCluster
        Get Manager
        Specified by:
        getManager in interface CatalinaCluster
        name - The manager name
        The manager
      • checkDefaults

        protected void checkDefaults()
      • registerClusterValve

        protected void registerClusterValve()
        register all cluster valve to host or engine
      • unregisterClusterValve

        protected void unregisterClusterValve()
        unregister all cluster valve to host or engine
      • toString

        public java.lang.String toString()
        Return a String rendering of this object.
        toString in class java.lang.Object
      • send

        public void send​(ClusterMessage msg,
                         Member dest,
                         int sendOptions)
        Description copied from interface: CatalinaCluster
        Sends a message with the specified sendOptions to a specific member in the cluster.
        Specified by:
        send in interface CatalinaCluster
        msg - ClusterMessage
        dest - Member
        sendOptions - sendOptions
      • accept

        public boolean accept​( msg,
                              Member sender)
        notify all listeners from receiving a new message is not ClusterMessage emit Failure Event to LifecycleListener
        Specified by:
        accept in interface ChannelListener
        msg - received Message
        sender - Member
      • messageReceived

        public void messageReceived​( message,
                                    Member sender)
        Description copied from interface: ChannelListener
        Receive a message from the channel
        Specified by:
        messageReceived in interface ChannelListener
        message - Serializable
        sender - - the source of the message
      • messageReceived

        public void messageReceived​(ClusterMessage message)
      • getChannelStartOptions

        public int getChannelStartOptions()
      • setChannelStartOptions

        public void setChannelStartOptions​(int channelStartOptions)
      • getDomainInternal

        protected java.lang.String getDomainInternal()
        Description copied from class: LifecycleMBeanBase
        Method implemented by sub-classes to identify the domain in which MBeans should be registered.
        Specified by:
        getDomainInternal in class LifecycleMBeanBase
        The name of the domain to use to register MBeans.
      • getObjectNameKeyProperties

        protected java.lang.String getObjectNameKeyProperties()
        Description copied from class: LifecycleMBeanBase
        Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.
        Specified by:
        getObjectNameKeyProperties in class LifecycleMBeanBase
        The string representation of the key properties component of the desired ObjectName