public class HelixServer extends Object implements Server
The Helix Server controls the lifecycle of the features and components which comprise the service.
| Constructor and Description |
|---|
HelixServer(java.util.function.Supplier<Feature[]> bootstrapFeaturesSupplier,
java.util.function.Supplier<Feature[]> coreFeaturesSupplier)
Create a Helix Server
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Component> |
findByType(String componentType)
Find a list of components by type name
|
<T extends Component> |
findByType(String componentType,
T defaultValue)
Finds the a registered component by type name.
|
List<Feature> |
getFeatures()
Get a list of features started
|
com.google.common.collect.Multimap<String,Component> |
getRegistrationMap()
Returns the full map of registered components by type name.
|
ServerState |
getServerState()
Get the Server's current state
|
Optional<io.vertx.core.Vertx> |
getVertx()
Get the Vert.x instance, available after the bootstrap features have started.
|
Thread |
restart()
Restart the Helix Server, asynchronously
|
Thread |
start()
Start the Helix Server, asynchronously
|
Thread |
stop(boolean immediate)
Start the Helix Server, asynchronously
|
public HelixServer(java.util.function.Supplier<Feature[]> bootstrapFeaturesSupplier, java.util.function.Supplier<Feature[]> coreFeaturesSupplier)
The server expects a lambda or class that can will instantiate features to be installed.
bootstrapFeaturesSupplier - Bootstrap features to be started before others. Primarily, these are configuration related features.coreFeaturesSupplier - Core features that will be started after the bootstrap features successfully start.public Optional<io.vertx.core.Vertx> getVertx()
public ServerState getServerState()
getServerState in interface Serverpublic List<Feature> getFeatures()
getFeatures in interface Serverpublic Thread start()
public Thread restart()
This shuts down all the features, waits for the in-flight requests to complete, then starts the server again. Restarting the server includes re-creating all features.
public Thread stop(boolean immediate)
This shuts down all the features, waits for the in-flight requests to complete. During shut-down, all new HTTP requests will fail with HTTP error code 599. This signals the Load Balancer to take the service out of rotation, preventing new requests from flowing to the service.
public com.google.common.collect.Multimap<String,Component> getRegistrationMap()
getRegistrationMap in interface ComponentRegistrypublic <T extends Component> Collection<T> findByType(String componentType)
findByType in interface ComponentRegistryT - Resulting class of the components expectedcomponentType - Type name of the components to findpublic <T extends Component> T findByType(String componentType, T defaultValue)
findByType in interface ComponentRegistryT - Resulting class of the component expectedcomponentType - Type name of the component to finddefaultValue - Default component if none is found (null is okay)Copyright © 2016. All rights reserved.