Class Server

java.lang.Object
org.serviceconnector.server.Server
All Implemented Interfaces:
IServer
Direct Known Subclasses:
CascadedSC, FileServer, StatefulServer

public abstract class Server extends Object implements IServer
The Class Server. Represents a server instance on a backend Server. Serves a service. Has control over the max of sessions and holds a connection pool to communicate to a backend server. Servers activity is observed by a timer. It gets initialized by adding server to server registry.
Author:
JTraber
  • Field Details

    • remoteNodeConfiguration

      protected RemoteNodeConfiguration remoteNodeConfiguration
      The remote node configuration.
    • socketAddress

      protected InetSocketAddress socketAddress
      The socket address.
    • requester

      protected Requester requester
      The requester.
    • serverKey

      protected String serverKey
      The server key.
    • destroyed

      protected volatile boolean destroyed
      The destroyed, marks if server has been destroyed.
    • operationTimeoutMultiplier

      protected final double operationTimeoutMultiplier
      The operation timeout multiplier.
    • serverTimeoutMillis

      protected double serverTimeoutMillis
      The server timeout milliseconds.
  • Constructor Details

    • Server

      public Server(RemoteNodeConfiguration remoteNodeConfiguration, InetSocketAddress socketAddress)
      Instantiates a new server.
      Parameters:
      remoteNodeConfiguration - the remote node configuration
      socketAddress - the socket address
  • Method Details

    • immediateConnect

      public void immediateConnect() throws Exception
      Immediate connect.
      Throws:
      Exception - the exception
    • getSocketAddress

      public SocketAddress getSocketAddress()
      Gets the socket address.
      Returns:
      the socket address
    • getTimeout

      public ScheduledFuture<TimeoutWrapper> getTimeout()
      Gets the server timeout.
      Returns:
      the server timeout
    • setTimeout

      public void setTimeout(ScheduledFuture<TimeoutWrapper> timeout)
      Sets the server timeout.
      Parameters:
      timeout - the new server timeout
    • setTimeouterTask

      public void setTimeouterTask(TimeoutWrapper timeouterTask)
      Sets the timeouter task.
      Parameters:
      timeouterTask - the new timeouter task
    • getTimeouterTask

      public TimeoutWrapper getTimeouterTask()
      Gets the timeouter task.
      Returns:
      the timeouter task
    • getHost

      public String getHost()
      Gets the host.
      Returns:
      the host
    • getPortNr

      public int getPortNr()
      Gets the port number.
      Returns:
      the port number
    • getConnectionType

      public String getConnectionType()
      Gets the connection type
      Returns:
      the host
    • getMaxConnections

      public int getMaxConnections()
      Gets the max connections.
      Returns:
      the max connections
    • getType

      public ServerType getType()
      Gets the server type.
      Specified by:
      getType in interface IServer
      Returns:
      the type
    • getServerTimeoutMillis

      public double getServerTimeoutMillis()
      Gets the server timeout milliseconds.
      Returns:
      the server timeout milliseconds
    • getServerKey

      public String getServerKey()
      Gets the server key.
      Returns:
      the server key
    • getRequester

      public IRequester getRequester()
      Gets the requester.
      Returns:
      the requester
    • isDestroyed

      public boolean isDestroyed()
      Checks if the server has been destroyed.
      Returns:
      true, if is destroyed
    • destroy

      public void destroy()
      Destroy server.
    • toString

      public String toString()
      Overrides:
      toString in class Object