Class SCSessionServer

java.lang.Object
org.serviceconnector.api.srv.SCSessionServer
Direct Known Subclasses:
SCPublishServer

public class SCSessionServer extends Object
The Class SCServer. Basic class for any kind of a server which communicates with an SC.
Author:
JTraber
  • Field Details

    • registered

      protected boolean registered
      The registered. Indicates if a server is already registered to an SC.
    • serviceName

      protected String serviceName
      The service name.
    • requester

      protected SCRequester requester
      The requester.
    • scServer

      protected SCServer scServer
      The SC server.
    • serverTimeout

      protected ScheduledFuture<TimeoutWrapper> serverTimeout
      The serverTimeout, timeout runs when server entry on SC need to be refreshed.
  • Constructor Details

    • SCSessionServer

      public SCSessionServer(SCServer scServer, String serviceName, SCRequester requester)
      Instantiates a new SCSessionServer.
      Parameters:
      scServer - the sc server
      serviceName - the service name
      requester - the requester
  • Method Details

    • getKeepAliveIntervalSeconds

      public int getKeepAliveIntervalSeconds()
      Gets the keep alive interval in seconds.
      Returns:
      the keep alive interval in seconds
    • getCheckRegistrationIntervalSeconds

      public int getCheckRegistrationIntervalSeconds()
      Gets the check registration interval seconds.
      Returns:
      the check registration interval seconds
    • getMaxSessions

      public int getMaxSessions()
      Gets the max sessions the server is serving for service.
      Returns:
      the max sessions
    • getMaxConnections

      public int getMaxConnections()
      Gets the max connections which the pool uses to connect to SC.
      Returns:
      the max connections
    • register

      public void register(int maxSessions, int maxConnections, SCSessionServerCallback scCallback) throws SCServiceException, SCMPValidatorException
      Register server with default operation timeout.
      Parameters:
      maxSessions - the max sessions to serve
      maxConnections - the max connections pool uses to connect to SC
      scCallback - the SC callback
      Throws:
      SCServiceException - listener not started yet
      server already registered for service
      register server on SC failed
      error message received from SC
      SCMPValidatorException - callback is not set
    • register

      public void register(int operationTimeoutSeconds, int maxSessions, int maxConnections, SCSessionServerCallback scCallback) throws SCServiceException, SCMPValidatorException
      Register server.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      maxSessions - the max sessions to serve
      maxConnections - the max connections pool uses to connect to SC
      scCallback - the SC callback
      Throws:
      SCServiceException - listener not started yet
      server already registered for service
      register server on SC failed
      error message received from SC
      SCMPValidatorException - callback is not set
    • doRegister

      protected void doRegister(int operationTimeoutSeconds, int maxSessions, int maxConnections) throws SCServiceException
      Do register.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      maxSessions - the max sessions to serve
      maxConnections - the max connections pool uses to connect to SC
      Throws:
      SCServiceException - listener not started yet
      server already registered for service
      register server on SC failed
      error message received from SC
    • checkRegistration

      public void checkRegistration() throws SCServiceException
      Check registration with default operation timeout. This message can be sent from the registered server to SC in order to check its registration.
      Throws:
      SCServiceException - server is not registered for a service
      check registration failed
      error message received from SC
    • checkRegistration

      public void checkRegistration(int operationTimeoutSeconds) throws SCServiceException
      Check registration. This message can be sent from the registered server to SC in order to check its registration.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      Throws:
      SCServiceException - server is not registered for a service
      check registration failed
      error message received from SC
    • deregister

      public void deregister() throws SCServiceException
      Deregister server with default operation timeout.
      Throws:
      SCServiceException - deregister failed
      error message received from SC
    • deregister

      public void deregister(int operationTimeoutSeconds) throws SCServiceException
      Deregister server.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      Throws:
      SCServiceException - deregister failed
      error message received from SC
    • isListening

      public boolean isListening()
      Checks if server is listening.
      Returns:
      true, if is listening
    • isRegistered

      public boolean isRegistered()
      Checks if serve is registered to an SC.
      Returns:
      true, if is registered
    • isImmediateConnect

      public boolean isImmediateConnect()
      Checks if server has its immediate connect flag set.
      Returns:
      true, if is immediate connect
    • getSCHost

      public String getSCHost()
      Gets the SC host.
      Returns:
      the SC host
    • getSCPort

      public int getSCPort()
      Gets the SC port.
      Returns:
      the SC port
    • getListenerInterfaces

      public List<String> getListenerInterfaces()
      Gets the interfaces on which server is listening.
      Returns:
      the interfaces
    • getListenerPort

      public int getListenerPort()
      Gets the port on which server is listening.
      Returns:
      the listening port
    • getConnectionType

      public ConnectionType getConnectionType()
      Gets the connection type which is used to communicate with SC.
      Returns:
      the connection type
    • getServiceName

      public String getServiceName()
      Gets the service name.
      Returns:
      the service name
    • getSCServer

      public SCServer getSCServer()
      Gets the SC server.
      Returns:
      the SC server