Package org.serviceconnector.registry
Class ServerRegistry
- All Implemented Interfaces:
IRegistryMXBean
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
-
Field Summary
Fields inherited from class org.serviceconnector.registry.Registry
registryMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an entry of a server.Gets the server.Server[]Gets all servers.voidremoveServer(String key) Removes the server.voidresetServerTimeout(Server server, double newTimeoutMillis) Reset server timeout.Methods inherited from class org.serviceconnector.registry.Registry
containsKey, get, getEntries, getSize, keySet, keySetArray, put, remove, toString
-
Constructor Details
-
ServerRegistry
public ServerRegistry()Instantiates a ServerRegistry.
-
-
Method Details
-
addServer
Adds an entry of a server.- Parameters:
key- the keyserver- the server
-
getServer
Gets the server.- Parameters:
key- the key- Returns:
- the server
-
getServers
Gets all servers.- Returns:
- the servers
-
removeServer
Removes the server.- Parameters:
key- the key
-
resetServerTimeout
Reset server timeout. Careful in use - take care of synchronization when parallel request possible.- Parameters:
server- the servernewTimeoutMillis- the new timeout in milliseconds
-