Class ServerRegistry

java.lang.Object
org.serviceconnector.registry.Registry<String,Server>
org.serviceconnector.registry.ServerRegistry
All Implemented Interfaces:
IRegistryMXBean

public class ServerRegistry extends Registry<String,Server>
The Class ServerRegistry. Stores an entry for every registered server in system. Server registry is also responsible for observation of server timeout and to clean up in case of broken servers. Server timeout gets initialized by adding server. Resetting the timer needs to be done outside the registry by calling reset method.
Author:
JTraber
  • Constructor Details

    • ServerRegistry

      public ServerRegistry()
      Instantiates a ServerRegistry.
  • Method Details

    • addServer

      public void addServer(String key, Server server)
      Adds an entry of a server.
      Parameters:
      key - the key
      server - the server
    • getServer

      public Server getServer(String key)
      Gets the server.
      Parameters:
      key - the key
      Returns:
      the server
    • getServers

      public Server[] getServers()
      Gets all servers.
      Returns:
      the servers
    • removeServer

      public void removeServer(String key)
      Removes the server.
      Parameters:
      key - the key
    • resetServerTimeout

      public void resetServerTimeout(Server server, double newTimeoutMillis)
      Reset server timeout. Careful in use - take care of synchronization when parallel request possible.
      Parameters:
      server - the server
      newTimeoutMillis - the new timeout in milliseconds