Class TP.ProtocolAdapter

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.TP.ProtocolAdapter
All Implemented Interfaces:
TP.ProbeHandler
Enclosing class:
TP

public static class TP.ProtocolAdapter extends Protocol implements TP.ProbeHandler
Used when the transport is shared (singleton_name is not null). Maintains the cluster name, local address and view
  • Field Details

  • Constructor Details

  • Method Details

    • getClusterName

      public String getClusterName()
    • getAddress

      public Address getAddress()
    • getAddressAsString

      public String getAddressAsString()
    • getAddressAsUUID

      public String getAddressAsUUID()
    • getTransportName

      public short getTransportName()
    • getMembers

      public Set<Address> getMembers()
    • getThreadFactory

      public ThreadFactory getThreadFactory()
      Description copied from class: Protocol
      Supposed to be overwritten by subclasses. Usually the transport returns a valid non-null thread factory, but thread factories can also be created by individual protocols
      Overrides:
      getThreadFactory in class Protocol
      Returns:
    • getSocketFactory

      public SocketFactory getSocketFactory()
      Description copied from class: Protocol
      Returns the SocketFactory associated with this protocol, if overridden in a subclass, or passes the call down
      Overrides:
      getSocketFactory in class Protocol
      Returns:
      SocketFactory
    • setSocketFactory

      public void setSocketFactory(SocketFactory factory)
      Description copied from class: Protocol
      Sets a SocketFactory. Socket factories are typically provided by the transport (TP) or TP.ProtocolAdapter
      Overrides:
      setSocketFactory in class Protocol
      Parameters:
      factory -
    • start

      public void start() throws Exception
      Description copied from class: Protocol
      This method is called on a Channel.connect(String). Starts work. Protocols are connected and queues are ready to receive events. Will be called from bottom to top. This call will replace the START and START_OK events.
      Overrides:
      start in class Protocol
      Throws:
      Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so Channel.connect(String) will throw an exception
    • stop

      public void stop()
      Description copied from class: Protocol
      This method is called on a Channel.disconnect(). Stops work (e.g. by closing multicast socket). Will be called from top to bottom. This means that at the time of the method invocation the neighbor protocol below is still working. This method will replace the STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that when this method is called all messages in the down queue will have been flushed
      Overrides:
      stop in class Protocol
    • down

      public Object down(Event evt)
      Description copied from class: Protocol
      An event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down(). In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack using up_prot.up().
      Overrides:
      down in class Protocol
    • getName

      public String getName()
      Description copied from class: Protocol
      All protocol names have to be unique !
      Overrides:
      getName in class Protocol
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • handleProbe

      public Map<String,String> handleProbe(String... keys)
      Description copied from interface: TP.ProbeHandler
      Handles a probe. For each key that is handled, the key and its result should be in the returned map.
      Specified by:
      handleProbe in interface TP.ProbeHandler
      Parameters:
      keys -
      Returns:
      Mapinvalid input: '<'String,String>. A map of keys and values. A null return value is permissible.
    • supportedKeys

      public String[] supportedKeys()
      Description copied from interface: TP.ProbeHandler
      Returns a list of supported keys
      Specified by:
      supportedKeys in interface TP.ProbeHandler