public interface ClusterServersDAO
Modifier and Type | Interface and Description |
---|---|
static class |
ClusterServersDAO.ClusterServer
Value object representing a server within the archiving cluster.
|
Modifier and Type | Method and Description |
---|---|
ListenableFuture<Void> |
createOrUpdateServer(UUID serverId,
String serverName,
String interNodeCommunicationUrl,
Date lastOnlineTime)
Creates or updates the record for an archive server.
|
ListenableFuture<Void> |
deleteServer(UUID serverId)
Removes the server with the specified ID from the database.
|
ListenableFuture<? extends ClusterServersDAO.ClusterServer> |
getServer(UUID serverId)
Reads the server object for the specified ID from the database.
|
ListenableFuture<? extends Iterable<? extends ClusterServersDAO.ClusterServer>> |
getServers()
Reads the server objects for all servers from the database.
|
boolean |
isInitialized()
Tells whether this DAO has finished initialization and is ready to be
used.
|
ListenableFuture<Void> |
updateServerLastOnlineTime(UUID serverId,
Date lastOnlineTime)
Updates the last-online time for an archive server.
|
ListenableFuture<Void> createOrUpdateServer(UUID serverId, String serverName, String interNodeCommunicationUrl, Date lastOnlineTime)
serverId
does not exist yet, it is created.
Otherwise, it is updated. The operation is performed in an asynchronous
way so that it will not block for network communication. The result of
the operation can be checked through the returned future.serverId
- unique ID identifying the server within the cluster. This ID
must be different for each server.serverName
- name (typically the hostname) of the server. The name is used
to help the user in identifying a server. It should be unique
for each server, but this condition is not enforced.interNodeCommunicationUrl
- base URL for the web-service interface of the server that can
be used by other servers within the cluster to communicate
with the server.lastOnlineTime
- time the server last updated its status. This time is used by
other servers to determine if the server is online. Typically,
this parameter should be the current time when calling this
method. The last-online time needs to be updated periodically,
but the updateServerLastOnlineTime(UUID, Date)
should
be preferred for this purpose.get()
method will throw an exception.ListenableFuture<Void> deleteServer(UUID serverId)
serverId
- unique identifier of the server that shall be removed from the
database.get()
method will throw an exception.ListenableFuture<? extends ClusterServersDAO.ClusterServer> getServer(UUID serverId)
serverId
- unique identifier identifying the server.get
method returns
null
. In case of failure, the future's
get()
method will throw an exception.ListenableFuture<? extends Iterable<? extends ClusterServersDAO.ClusterServer>> getServers()
Reads the server objects for all servers from the database. The server objects are not returned directly but through a listenable future, so that the calling code can wait for the database operation to finish asynchronously.
The iterable returned by the future is only safe for iterating once. Subsequent requests to create an iterator might result in the new iterator only returning the elements that have not been returned by a previously created iterator yet. Besides, the iterator might block while iterating, waiting for additional elements to arrive from the network.
get()
method will throw an exception.boolean isInitialized()
true
, operations might
still fail because of transient problems.true
if this DAO has been initialized and is ready
to be used, false
if initialization has not
completed yet.ListenableFuture<Void> updateServerLastOnlineTime(UUID serverId, Date lastOnlineTime)
createOrUpdateServer(UUID, String, String, Date)
method.
However, implementations might not enforce this limitation, silently
creating a partially initialized record when this method is called first.serverId
- unique ID identifying the server within the cluster. This ID
must be different for each server.lastOnlineTime
- time the server last updated its status. This time is used by
other servers to determine if the server is online. Typically,
this parameter should be the current time when calling this
method. The last-online time needs to be updated periodically.get()
method will throw an exception.Copyright © 2011–2017 aquenos GmbH. All rights reserved.