public final class Controller extends Object implements ServiceThread.Target
Instances of this class are used by services to control a Valve. Where the Valve is configured by its own properties file, this class get its configuration from its creator configuration. Since more than one Valve may be configured, all the informations needed to complete the connection to the control port are supplied in a properties group.
Modifier and Type | Field and Description |
---|---|
static String |
CONTROL_ADDRESS_PROPERTY
Specifies the interface and port listening for the control of the valve.
|
static ElapsedTime |
DEFAULT_RETRY_DELAY
Default retry delay.
|
static String |
REQUIRED_PROPERTY
Indicates that a successful connection to the control port of the valve
is required for this service to complete its initialization.
|
static String |
RETRY_DELAY_PROPERTY
The elapsed time before retrying to connect.
|
static String |
RETRY_PROPERTY
Requests retries for a successful connection.
|
Constructor and Description |
---|
Controller(Config config)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this controller.
|
boolean |
open(String propertiesName)
Opens a control connection to a valve.
|
void |
run()
Runs.
|
public static final String CONTROL_ADDRESS_PROPERTY
public static final ElapsedTime DEFAULT_RETRY_DELAY
public static final String REQUIRED_PROPERTY
public static final String RETRY_DELAY_PROPERTY
public static final String RETRY_PROPERTY
public Controller(@Nonnull Config config)
config
- The config.public void close()
@CheckReturnValue public boolean open(@Nonnull String propertiesName)
propertiesName
- The name of a group of properties.public void run()
Similar to same in Runnable but may throw exceptions.
run
in interface ServiceThread.Target
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.