T
- the type of the Server
U
- the type of the Server.start(T)
method options@ThreadSafe public class Registry<T extends Server<U>,U> extends Object
Server
s that run within an Alluxio process. The intended
use of this class is for the Alluxio process to register the individual Server
s using an
instance of this class. The registry is passed as an argument to constructors of individual
Server
s who are expected to add themselves to the registry.
The reason for using an instance as opposed to a static class is to enable dependency
injection in tests.Constructor and Description |
---|
Registry()
Creates a new instance of
Registry . |
Modifier and Type | Method and Description |
---|---|
<W extends T> |
add(Class<W> clazz,
T server) |
void |
close()
Closes all
Server s in reverse dependency order. |
<W extends T> |
get(Class<W> clazz)
Convenience method for calling
get(Class, int) with a default timeout. |
<W extends T> |
get(Class<W> clazz,
int timeoutMs)
Attempts to look up the
Server for the given class. |
List<T> |
getServers() |
void |
start(U options)
Starts all
Server s in dependency order. |
void |
stop()
Stops all
Server s in reverse dependency order. |
public Registry()
Registry
.public <W extends T> W get(Class<W> clazz)
get(Class, int)
with a default timeout.public List<T> getServers()
Server
s, order by dependency relationpublic void start(U options) throws IOException
Server
s in dependency order. If A depends on B, A is started before B.
If a Server
fails to start, already-started Server
s will be stopped.options
- the start optionsIOException
public void stop() throws IOException
Server
s in reverse dependency order. If A depends on B, A is stopped
before B.IOException
public void close() throws IOException
Server
s in reverse dependency order. If A depends on B, A is closed
before B.IOException
Copyright © 2023. All Rights Reserved.