java.lang.Object
org.praxislive.hub.Hub
Support for configuring and running a
RootHub, along with the
Roots within it.
This class doesn't implement either RootHub or Root directly. It uses a core
root, usually an instance or subclass of BasicCoreRoot, to manage
other system and user roots.
Use builder() to configure and create an instance of this class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classProvides access to control of the RootHub.static classA builder for Hubs.static interfaceAn interface for creating custom core root implementations. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidawait()Wait for the core root and hub to terminate.voidWait for the given time period for the core root and hub to terminate.static Hub.Builderbuilder()Create aHub.Builder.intReturn an exit value for the hub.booleanisAlive()Query whether the hub and core root are running.voidshutdown()Signal the hub to shutdown.voidstart()Start the hub.
-
Field Details
-
SYS_PREFIX
- See Also:
-
CORE_PREFIX
- See Also:
-
EXT_PREFIX
- See Also:
-
-
Method Details
-
start
Start the hub. This will start the core root, which will in turn start other services. A hub cannot be started more than once and is not reusable.- Throws:
Exception- if start fails or the hub has already been started
-
shutdown
public void shutdown()Signal the hub to shutdown. This will signal the core root to terminate, which will terminate all other roots. -
await
Wait for the core root and hub to terminate.- Throws:
InterruptedException- if interrupted
-
await
Wait for the given time period for the core root and hub to terminate.- Parameters:
time- time to waitunit- unit of time to wait- Throws:
InterruptedException- if interruptedTimeoutException- if the hub has not terminated in the given time
-
isAlive
public boolean isAlive()Query whether the hub and core root are running.- Returns:
- true if active
-
exitValue
public int exitValue()Return an exit value for the hub. This may be used as the exit value for the hub process. The default value is 0.- Returns:
- exit value
-
builder
Create aHub.Builder.- Returns:
- builder
-