public abstract class AbstractLauncher<T extends java.lang.Comparable<T>>
extends java.lang.Object
implements java.lang.Runnable
Comparable,
Runnable,
Identifiable| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractLauncher.ServiceState<T extends java.lang.Comparable<T>>
The ServiceState is an immutable type representing the state of the specified Locator at any given moment in time.
|
static class |
AbstractLauncher.Status
The Status enumerated type represents the various lifecycle states of a GemFire service (such as a Cache Server,
a Locator or a Manager).
|
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.Boolean |
DEFAULT_FORCE |
static java.lang.String |
DEFAULT_WORKING_DIRECTORY |
protected java.util.logging.Logger |
logger |
protected static java.lang.String |
OPTION_PREFIX |
protected static long |
READ_PID_FILE_TIMEOUT_MILLIS |
protected java.util.concurrent.atomic.AtomicBoolean |
running |
static java.lang.String |
SIGNAL_HANDLER_REGISTRATION_SYSTEM_PROPERTY |
| Constructor and Description |
|---|
AbstractLauncher() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
assertPortAvailable(java.net.InetAddress bindAddress,
int port)
Asserts that the specified port is available on the specified network interface, indicated by it's assigned
IP address, on this local system.
|
protected static void |
assertPortAvailable(int port)
Asserts that the specified port is available on all network interfaces on this local system.
|
protected void |
debug(java.lang.String message,
java.lang.Object... args)
Prints the specified debug message to standard err, replacing any placeholder values with the specified arguments
on output, if debugging has been enabled.
|
protected void |
debug(java.lang.Throwable t)
Prints the stack trace of the given Throwable to standard err if debugging has been enabled.
|
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.
|
protected java.util.Properties |
getDistributedSystemProperties(java.util.Properties defaults)
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.
|
protected java.io.File |
getLogFile()
Gets a File reference with the path to the log file for the process.
|
protected java.lang.String |
getLogFileCanonicalPath()
Gets the fully qualified canonical path of the log file for the process.
|
abstract java.lang.String |
getLogFileName()
Gets the name of the log file used to log information about this GemFire service.
|
java.lang.String |
getMember()
Gets the name or ID of the member in the GemFire distributed system.
|
java.lang.String |
getMemberId()
Gets the ID of the member in the GemFire distributed system as determined and assigned by GemFire when the member
process joins the distributed system.
|
java.lang.String |
getMemberName()
Gets the name of the member in the GemFire distributed system as determined by the 'name' GemFire property.
|
abstract java.lang.Integer |
getPid()
Gets the user-specified process ID (PID) of the running GemFire service that AbstractLauncher implementations
can use to determine status, or stop the service.
|
abstract java.lang.String |
getServiceName()
Gets the name of the GemFire service.
|
java.lang.String |
getWorkingDirectory()
Gets the working directory pathname in which the process will be run.
|
protected void |
info(java.lang.Object message,
java.lang.Object... args)
Prints the specified informational message to standard err, replacing any placeholder values with the specified
arguments on output.
|
protected boolean |
isAttachAPINotFound(java.lang.Throwable t)
This method attempts to make a best effort determination for whether the Attach API classes are on the classpath.
|
boolean |
isDebugging()
Determines whether the Locator launcher is in debug mode.
|
boolean |
isRunning()
Determines whether the Locator referenced by this launcher is running.
|
protected static boolean |
isSet(java.util.Properties properties,
java.lang.String propertyName)
Determines whether the specified property with name is set to a value in the referenced Properties.
|
protected static java.util.Properties |
loadGemFireProperties(java.net.URL url)
Loads the GemFire properties at the specified URL.
|
protected void |
redirectOutput(DistributedSystem distributedSystem)
Redirects the standard out and standard err to the configured log file as specified in the GemFire distributed
system properties.
|
void |
setDebug(boolean debug)
Sets the debug mode of the GemFire launcher class.
|
java.lang.String |
version()
Gets the version of GemFire currently running.
|
protected static final java.lang.Boolean DEFAULT_FORCE
protected static final long READ_PID_FILE_TIMEOUT_MILLIS
public static final java.lang.String DEFAULT_WORKING_DIRECTORY
public static final java.lang.String SIGNAL_HANDLER_REGISTRATION_SYSTEM_PROPERTY
protected static final java.lang.String OPTION_PREFIX
protected final transient java.util.concurrent.atomic.AtomicBoolean running
protected java.util.logging.Logger logger
protected static void assertPortAvailable(int port)
throws java.net.BindException
port - an integer indicating the network port to listen for client network requests.java.net.BindException - if the network port is not available.assertPortAvailable(int)protected static void assertPortAvailable(java.net.InetAddress bindAddress,
int port)
throws java.net.BindException
bindAddress - an InetAddress indicating the bounded network interface to determine whether the service port
is available or not.port - an integer indicating the network port to listen for client network requests.java.net.BindException - if the network address and port are not available. Address defaults to localhost (or all
network interfaces on the local system) if null.AvailablePortprotected static boolean isSet(java.util.Properties properties,
java.lang.String propertyName)
properties - the Properties used in determining whether the given property is set.propertyName - a String indicating the name of the property to check if set.Propertiesprotected static java.util.Properties loadGemFireProperties(java.net.URL url)
url - the URL to the gemfire.properties to load.URLprotected boolean isAttachAPINotFound(java.lang.Throwable t)
t - the Throwable being evaluated for missing Attach API classes.public boolean isDebugging()
setDebug(boolean)public final void setDebug(boolean debug)
debug - a boolean used to enable or disable debug mode.isDebugging()public boolean isRunning()
protected java.util.Properties getDistributedSystemProperties()
getDistributedSystemProperties(java.util.Properties),
Propertiesprotected java.util.Properties getDistributedSystemProperties(java.util.Properties defaults)
defaults - default GemFire Distributed System properties as configured in the Builder.Propertiesprotected java.io.File getLogFile()
protected java.lang.String getLogFileCanonicalPath()
public abstract java.lang.String getLogFileName()
public java.lang.String getMember()
getMemberName(),
getMemberId()public java.lang.String getMemberId()
public java.lang.String getMemberName()
public abstract java.lang.Integer getPid()
public abstract java.lang.String getServiceName()
public java.lang.String getWorkingDirectory()
protected void debug(java.lang.String message,
java.lang.Object... args)
message - the String value written to standard err.args - an Object array containing arguments to replace the placeholder values in the message.System.err,
isDebugging(),
debug(Throwable),
info(Object, Object...)protected void debug(java.lang.Throwable t)
t - the Throwable who's stack trace is printed to standard err.System.err,
isDebugging(),
debug(String, Object...)protected void info(java.lang.Object message,
java.lang.Object... args)
message - the String value written to standard err.args - an Object array containing arguments to replace the placeholder values in the message.System.err,
debug(String, Object...)protected void redirectOutput(DistributedSystem distributedSystem) throws java.io.IOException
distributedSystem - the GemFire model for a distributed system.java.io.IOException - if the standard out and err redirection was unsuccessful.public java.lang.String version()