public class LocatorLauncher extends AbstractLauncher<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 Comparable<T>>, AbstractLauncher.Status
DEFAULT_FORCE, DEFAULT_WORKING_DIRECTORY, logger, MEMBER_NAME_ERROR_MESSAGE, OPTION_PREFIX, READ_PID_FILE_TIMEOUT_MILLIS, running, SIGNAL_HANDLER_REGISTRATION_SYSTEM_PROPERTY, WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE, WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE
Modifier and Type | Method and Description |
---|---|
InetAddress |
getBindAddress()
Gets the IP address of the NIC to which the Locator has bound itself listening for client
requests.
|
protected String |
getBindAddressAsString()
Gets the host, as either hostname or IP address, on which the Locator was bound and running.
|
String |
getBindAddressString() |
Cache |
getCache()
Gets a reference to the
Cache that was created by this LocatorLauncher . |
LocatorLauncher.Command |
getCommand()
Get the Locator launcher command used to invoke the Locator.
|
protected 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.
|
String |
getHostnameForClients()
Gets the hostname that clients will use to lookup the running Locator.
|
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 Geode Locator, or null if this VM
does not have an instance of LocatorLauncher indicating no Geode Locator is running.
|
Locator |
getLocator()
Gets a reference to the
Locator that was created by this LocatorLauncher . |
protected 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.
|
String |
getLogFileName()
Gets the name of the log file used to log information about this Locator.
|
String |
getMemberName()
Gets the name of this member (this Locator) in the Geode distributed system and determined by
the 'name' Geode property.
|
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.
|
Integer |
getPort()
Gets the port number on which the Locator listens for client requests.
|
String |
getPortAsString()
Gets the port number represented as a String value.
|
Properties |
getProperties()
Gets the Geode Distributed System (cluster) Properties.
|
String |
getServiceName()
Gets the name for a Geode Locator.
|
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(String... args)
Launches a Geode 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
getSocketAddress 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.
|
org.apache.geode.cache.client.internal.locator.LocatorStatusResponse |
statusForLocator(int port,
InetAddress bindAddressArg)
Returns the status of the locator on the given host and port.
|
org.apache.geode.cache.client.internal.locator.LocatorStatusResponse |
statusForLocator(int port,
String hostname)
Returns the status of the locator on the given host and port
|
static org.apache.geode.cache.client.internal.locator.LocatorStatusResponse |
statusLocator(int port,
InetAddress bindAddress)
Deprecated.
in Geode 1.12. Use statusForLocator() instance method instead.
This static method does not use the properties set via the Builder.
|
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,
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 void main(String... args)
args
- the command-line arguments used to configure the Geode Locator at runtime.public static LocatorLauncher getInstance()
public static LocatorLauncher.LocatorState getLocatorState()
@Deprecated public static org.apache.geode.cache.client.internal.locator.LocatorStatusResponse statusLocator(int port, InetAddress bindAddress) throws IOException
port
- the port that the locator is listening onbindAddress
- the IP address to which the locator's socket bindsLocatorStatusResponse
representing the status of the locatorIOException
- if there is a problem interacting with the locatorpublic org.apache.geode.cache.client.internal.locator.LocatorStatusResponse statusForLocator(int port, InetAddress bindAddressArg) throws IOException
port
- the port that the locator is listening onbindAddressArg
- the IP address to which the locator's socket bindsLocatorStatusResponse
representing the status of the locatorIOException
- if there is a problem interacting with the locatorpublic org.apache.geode.cache.client.internal.locator.LocatorStatusResponse statusForLocator(int port, String hostname) throws IOException
port
- the port that the locator is listening onhostname
- the host name or ip address that the locator is listening on.LocatorStatusResponse
representing the status of the locatorIOException
- if there is a problem interacting with the locatorpublic Cache getCache()
Cache
that was created by this LocatorLauncher
.Cache
public Locator getLocator()
Locator
that was created by this LocatorLauncher
.Locator
public String getId()
getBindAddressAsString()
,
getPortAsString()
public LocatorLauncher.Command getCommand()
LocatorLauncher.Command
public boolean isForcing()
public boolean isHelping()
LocatorLauncher.Command
public boolean isRedirectingOutput()
public InetAddress getBindAddress()
InetAddress
protected String getBindAddressAsString()
InetAddress
,
getBindAddress()
public String getHostnameForClients()
public String getLogFileName()
getLogFileName
in class AbstractLauncher<String>
public String getMemberName()
getMemberName
in class AbstractLauncher<String>
public Integer getPid()
getPid
in class AbstractLauncher<String>
public Integer getPort()
public String getPortAsString()
getPort()
public Properties getProperties()
Properties
public String getServiceName()
getServiceName
in class AbstractLauncher<String>
public String getWorkingDirectory()
getWorkingDirectory
in class AbstractLauncher<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 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'.RuntimeException
- if the Locator failed to start for any reason.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 Properties getDistributedSystemProperties()
AbstractLauncher
getDistributedSystemProperties
in class AbstractLauncher<String>
AbstractLauncher.getDistributedSystemProperties(java.util.Properties)
,
Properties
public LocatorLauncher.LocatorState waitOnLocator()
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, 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
public String getBindAddressString()