- Enclosing interface:
Server.Locator
public static interface Server.Locator.Builder
A builder for
Server.Locator instances.-
Method Summary
Modifier and TypeMethodDescription<C extends Remote,A extends ServerAdmin>
Server<C, A> locate()Retrieves a Server from the registry, using the configured hostname, registry port and server name prefix.namePrefix(String namePrefix) port(int port) registryPort(int registryPort)
-
Method Details
-
hostname
- Parameters:
hostname- the name of the host- Returns:
- this builder instance
-
namePrefix
- Parameters:
namePrefix- the server name prefix to use when looking up, an empty string results in all servers being returned- Returns:
- this builder instance
-
registryPort
- Parameters:
registryPort- the port on which to lookup/configure the registry- Returns:
- this builder instance
-
port
- Parameters:
port- the required server port, -1 for a server on any port- Returns:
- this builder instance
-
locate
<C extends Remote,A extends ServerAdmin> Server<C,A> locate() throws RemoteException, NotBoundExceptionRetrieves a Server from the registry, using the configured hostname, registry port and server name prefix. Returns the first server satisfying the condition.- Type Parameters:
C- the Remote connection type served by the serverA- the server admin type supplied by the server- Returns:
- the first server whose name has the configured prefix
- Throws:
RemoteException- in case of a remote exceptionNotBoundException- in case no such server is found
-