public final class LocatorLauncher extends AbstractLauncher<java.lang.String>
AbstractLauncher
,
ServerLauncher
Modifier and Type | Class and Description |
---|---|
static class |
LocatorLauncher.Builder
Following the Builder design pattern, the LocatorLauncher Builder is used to configure and
create a properly initialized instance of the LocatorLauncher class for running the Locator and
performing other Locator operations.
|
static class |
LocatorLauncher.Command
An enumerated type representing valid commands to the Locator launcher.
|
static class |
LocatorLauncher.LocatorState
The LocatorState is an immutable type representing the state of the specified Locator at any
given moment in time.
|
AbstractLauncher.ServiceState<T extends java.lang.Comparable<T>>, AbstractLauncher.Status
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ENABLE_PEER_LOCATION
Deprecated.
This is specific to the internal implementation and may go away in a future
release.
|
static boolean |
DEFAULT_ENABLE_SERVER_LOCATION
Deprecated.
This is specific to the internal implementation and may go away in a future
release.
|
static java.lang.String |
DEFAULT_LOCATOR_PID_FILE
Deprecated.
This is specific to the internal implementation and may go away in a future
release.
|
static java.lang.Integer |
DEFAULT_LOCATOR_PORT
Deprecated.
This is specific to the internal implementation and may go away in a future
release.
|
DEFAULT_FORCE, DEFAULT_WORKING_DIRECTORY, logger, OPTION_PREFIX, READ_PID_FILE_TIMEOUT_MILLIS, running, SIGNAL_HANDLER_REGISTRATION_SYSTEM_PROPERTY
Modifier and Type | Method and Description |
---|---|
java.net.InetAddress |
getBindAddress()
Gets the IP address of the NIC to which the Locator has bound itself listening for client
requests.
|
protected java.lang.String |
getBindAddressAsString()
Gets the host, as either hostname or IP address, on which the Locator was bound and running.
|
LocatorLauncher.Command |
getCommand()
Get the Locator launcher command used to invoke the Locator.
|
protected java.util.Properties |
getDistributedSystemProperties()
Creates a Properties object with configuration settings that the launcher has that should take
precedence over anything the user has defined in their gemfire properties file.
|
java.lang.String |
getHostnameForClients()
Gets the hostname that clients will use to lookup the running Locator.
|
java.lang.String |
getId()
Gets an identifier that uniquely identifies and represents the Locator associated with this
launcher.
|
static LocatorLauncher |
getInstance()
Gets the instance of the LocatorLauncher used to launch the GemFire Locator, or null if this VM
does not have an instance of LocatorLauncher indicating no GemFire Locator is running.
|
protected java.io.File |
getLocatorPidFile()
Gets a File reference with the path to the PID file for the Locator.
|
static LocatorLauncher.LocatorState |
getLocatorState()
Gets the LocatorState for this process or null if this process was not launched using this VM's
LocatorLauncher reference.
|
java.lang.String |
getLogFileName()
Gets the name of the log file used to log information about this Locator.
|
java.lang.String |
getMemberName()
Gets the name of this member (this Locator) in the GemFire distributed system and determined by
the 'name' GemFire property.
|
java.lang.Integer |
getPid()
Gets the user-specified process ID (PID) of the running Locator that LocatorLauncher uses to
issue status and stop commands to the Locator.
|
java.lang.Integer |
getPort()
Gets the port number on which the Locator listens for client requests.
|
java.lang.String |
getPortAsString()
Gets the port number represented as a String value.
|
java.util.Properties |
getProperties()
Gets the GemFire Distributed System (cluster) Properties.
|
java.lang.String |
getServiceName()
Gets the name for a GemFire Locator.
|
java.lang.String |
getWorkingDirectory()
Gets the working directory pathname in which the Locator will be run.
|
void |
help(LocatorLauncher.Command command)
Displays help for the specified Locator launcher command to standard err.
|
boolean |
isForcing()
Determines whether the PID file is allowed to be overwritten when the Locator is started and a
PID file already exists in the Locator's specified working directory.
|
boolean |
isHelping()
Determines whether this launcher will be used to display help information.
|
boolean |
isRedirectingOutput()
Determines whether this launcher will redirect output to system logs when starting a new
Locator process.
|
protected boolean |
isStoppable()
Determines whether the Locator can be stopped in-process, such as when a Locator is embedded in
an application and the LocatorLauncher API is being used.
|
static void |
main(java.lang.String... args)
Launches a GemFire Locator from the command-line configured with the given arguments.
|
void |
run()
The Runnable method used to launch the Locator with the specified command.
|
LocatorLauncher.LocatorState |
start()
Starts a Locator running on the specified port and bind address, as determined by getPort and
getBindAddress respectively, defaulting to 10334 and 'localhost' if not specified, with both
peer and server location enabled.
|
LocatorLauncher.LocatorState |
status()
Attempts to determine the state of the Locator.
|
static org.apache.geode.cache.client.internal.locator.LocatorStatusResponse |
statusLocator(int port,
java.net.InetAddress bindAddress)
Returns the status of the locator on the given host & port
|
LocatorLauncher.LocatorState |
stop()
Stop shuts the running Locator down.
|
void |
usage()
Displays usage information on the proper invocation of the LocatorLauncher from the
command-line to standard err.
|
LocatorLauncher.LocatorState |
waitOnLocator()
Waits on the Locator to stop causing the calling Thread to join with the Locator's
location-based services Thread.
|
LocatorLauncher.LocatorState |
waitOnStatusResponse(long timeout,
long interval,
java.util.concurrent.TimeUnit timeUnit)
Waits for a Locator status request response to be returned up to the specified timeout in the
given unit of time.
|
assertPortAvailable, assertPortAvailable, debug, debug, getDistributedSystemProperties, getLogFile, getLogFileCanonicalPath, getMember, getMemberId, info, isDebugging, isRunning, isSet, loadGemFireProperties, redirectOutput, setDebug, version
public static final java.lang.Integer DEFAULT_LOCATOR_PORT
public static final boolean DEFAULT_ENABLE_PEER_LOCATION
public static final boolean DEFAULT_ENABLE_SERVER_LOCATION
public static final java.lang.String DEFAULT_LOCATOR_PID_FILE
public static void main(java.lang.String... args)
args
- the command-line arguments used to configure the GemFire Locator at runtime.public static LocatorLauncher getInstance()
public static LocatorLauncher.LocatorState getLocatorState()
public static org.apache.geode.cache.client.internal.locator.LocatorStatusResponse statusLocator(int port, java.net.InetAddress bindAddress) throws java.io.IOException
java.io.IOException
public final java.lang.String getId()
getBindAddressAsString()
,
getPortAsString()
public LocatorLauncher.Command getCommand()
LocatorLauncher.Command
public boolean isForcing()
public boolean isHelping()
LocatorLauncher.Command
public boolean isRedirectingOutput()
public java.net.InetAddress getBindAddress()
InetAddress
protected java.lang.String getBindAddressAsString()
InetAddress
,
getBindAddress()
public java.lang.String getHostnameForClients()
public java.lang.String getLogFileName()
getLogFileName
in class AbstractLauncher<java.lang.String>
public java.lang.String getMemberName()
getMemberName
in class AbstractLauncher<java.lang.String>
AbstractLauncher.getMemberName()
public java.lang.Integer getPid()
getPid
in class AbstractLauncher<java.lang.String>
public java.lang.Integer getPort()
public java.lang.String getPortAsString()
getPort()
public java.util.Properties getProperties()
Properties
public java.lang.String getServiceName()
getServiceName
in class AbstractLauncher<java.lang.String>
public java.lang.String getWorkingDirectory()
getWorkingDirectory
in class AbstractLauncher<java.lang.String>
public void help(LocatorLauncher.Command command)
command
- the Locator launcher command in which to display help information.usage()
public void usage()
public void run()
protected java.io.File getLocatorPidFile()
public LocatorLauncher.LocatorState start()
waitOnLocator
.
Given the nature of start, the Locator's status will be in either 1 of 2 possible states. If
the 'request' to start the Locator proceeds without exception, the status will be 'STARTED'.
However, if any exception is encountered during the normal startup sequence, then a
RuntimeException is thrown and the status is set to 'STOPPED'.java.lang.RuntimeException
- if the Locator failed to start for any reason.java.lang.IllegalStateException
- if the Locator is already running.failOnStart(Throwable)
,
getBindAddress()
,
getDistributedSystemProperties()
,
isForcing()
,
AbstractLauncher.getLogFile()
,
getLocatorPidFile()
,
getPort()
,
status()
,
stop()
,
waitOnLocator()
,
waitOnStatusResponse(long, long, java.util.concurrent.TimeUnit)
,
LocatorLauncher.LocatorState
,
AbstractLauncher.Status.NOT_RESPONDING
,
AbstractLauncher.Status.ONLINE
,
AbstractLauncher.Status.STARTING
protected java.util.Properties getDistributedSystemProperties()
AbstractLauncher
getDistributedSystemProperties
in class AbstractLauncher<java.lang.String>
AbstractLauncher.getDistributedSystemProperties(java.util.Properties)
,
Properties
public LocatorLauncher.LocatorState waitOnLocator()
java.lang.AssertionError
- if the Locator has not been started and the reference is null
(assertions must be enabled for the error to be thrown).failOnStart(Throwable)
,
AbstractLauncher.Status
,
LocatorLauncher.LocatorState
public LocatorLauncher.LocatorState waitOnStatusResponse(long timeout, long interval, java.util.concurrent.TimeUnit timeUnit)
waitOnLocator
.timeout
- a long value in time unit indicating when the period of time should expire in
attempting to determine the Locator's status.interval
- a long value in time unit for how frequent the requests should be sent to the
Locator.timeUnit
- the unit of time in which the timeout and interval are measured.waitOnLocator()
public LocatorLauncher.LocatorState status()
start()
,
stop()
,
AbstractLauncher.Status
,
LocatorLauncher.LocatorState
protected boolean isStoppable()
public LocatorLauncher.LocatorState stop()
start()
,
status()
,
LocatorLauncher.LocatorState
,
AbstractLauncher.Status.NOT_RESPONDING
,
AbstractLauncher.Status.STOPPED