GemFire 7.0

com.gemstone.gemfire.distributed
Class ServerLauncher

java.lang.Object
  extended by com.gemstone.gemfire.distributed.AbstractLauncher<String>
      extended by com.gemstone.gemfire.distributed.ServerLauncher
All Implemented Interfaces:
Identifiable<String>, Serializable, Runnable

public final class ServerLauncher
extends AbstractLauncher<String>

The ServerLauncher class is a launcher class with main method to start a GemFire Server (implying a GemFire Cache server process).

Since:
7.0
See Also:
LocatorLauncher, Serialized Form

Nested Class Summary
static class ServerLauncher.Builder
          The Builder class, modeled after the Builder creational design pattern, is used to construct a properly configured and initialized instance of the ServerLauncher to control and run GemFire servers (in particular, cache servers).
static class ServerLauncher.Command
          An enumerated type representing valid commands to the Server launcher.
static class ServerLauncher.ServerState
          The ServerState is an immutable type representing the state of the specified Locator at any given moment in time.
 
Nested classes/interfaces inherited from class com.gemstone.gemfire.distributed.AbstractLauncher
AbstractLauncher.ServiceState<T extends Comparable<T>>, AbstractLauncher.Status
 
Field Summary
static String DEFAULT_SERVER_PID_FILE
           
 
Fields inherited from class com.gemstone.gemfire.distributed.AbstractLauncher
DEFAULT_WORKING_DIRECTORY, SIGNAL_HANLDER_REGISTRATION_SYSTEM_PROPERTY
 
Method Summary
 ServerLauncher.Command getCommand()
          Get the Server launcher command used to invoke the Server.
 String getId()
          Gets an identifier that uniquely identifies and represents the Server associated with this launcher.
static ServerLauncher getInstance()
          Gets the instance of the ServerLauncher used to launch the GemFire Cache Server, or null if this VM does not have an instance of ServerLauncher indicating no GemFire Cache Server is running.
 String getLogFileName()
          Gets the name of the log file used to log information about this Server.
 String getMemberName()
          Gets the name of this member (this Server) in the GemFire distributed system as determined by the 'name' GemFire property.
 Integer getPid()
          Gets the user-specified process ID (PID) of the running Server that ServerLauncher uses to issue status and stop commands to the Server.
 InetAddress getServerBindAddress()
          Gets the IP address to which the Server is bound listening for and accepting cache client connections.
 String getServerBindAddressAsString()
          Gets the host, as either hostname or IP address, on which the Server was bound and running.
 Integer getServerPort()
          Gets the port on which the Server is listening for cache client connections.
 String getServerPortAsString()
          Gets the server port on which the Server is listening for client requests represented as a String value.
static ServerLauncher.ServerState getServerState()
          Gets the ServerState for this process or null if this process was not launched using this VM's ServerLauncher reference .
 String getServiceName()
          Gets the name for a GemFire Server.
 String getWorkingDirectory()
          Gets the working directory pathname in which the Server will be run.
 void help(ServerLauncher.Command command)
          Displays help for the specified Server launcher command to standard err.
 boolean isAssignBuckets()
          Determines whether buckets should be assigned to partitioned regions in the cache upon Server start.
 boolean isDisableDefaultServer()
          Determines whether a default cache server will be added when the GemFire Server comes online.
 boolean isForcing()
          Determines whether the PID file is allowed to be overwritten when the Server is started and a PID file already exists in the Server's specified working directory.
 boolean isHelping()
          Determines whether this launcher will be used to display help information.
 boolean isRebalancing()
          Determines whether a rebalance operation on the cache will occur upon starting the GemFire server using this launcher.
 boolean isRedirectingOutput()
          Determines whether this launcher will redirect output to system logs when starting a new Locator process.
static void main(String... args)
          Launches a GemFire Server from the command-line configured with the given arguments.
 void run()
          A Runnable method used to invoke the GemFire server (cache server) with the specified command.
 ServerLauncher.ServerState start()
          Invokes the 'start' command and operation to startup a GemFire server (a cache server).
 ServerLauncher.ServerState status()
           
 ServerLauncher.ServerState stop()
           
 void usage()
          Displays usage information on the proper invocation of the ServerLauncher from the command-line to standard err.
 
Methods inherited from class com.gemstone.gemfire.distributed.AbstractLauncher
getMember, getMemberId, isDebugging, isRunning, setDebug, version
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SERVER_PID_FILE

public static final String DEFAULT_SERVER_PID_FILE
See Also:
Constant Field Values
Method Detail

main

public static void main(String... args)
Launches a GemFire Server from the command-line configured with the given arguments.

Parameters:
args - the command-line arguments used to configure the GemFire Server at runtime.

getInstance

public static ServerLauncher getInstance()
Gets the instance of the ServerLauncher used to launch the GemFire Cache Server, or null if this VM does not have an instance of ServerLauncher indicating no GemFire Cache Server is running.

Returns:
the instance of ServerLauncher used to launcher a GemFire Cache Server in this VM.

getServerState

public static ServerLauncher.ServerState getServerState()
Gets the ServerState for this process or null if this process was not launched using this VM's ServerLauncher reference .

Returns:
the ServerState for this process or null.

getId

public final String getId()
Gets an identifier that uniquely identifies and represents the Server associated with this launcher.

Returns:
a String value identifier to uniquely identify the Server and it's launcher.
See Also:
getServerBindAddressAsString(), getServerPortAsString()

getCommand

public ServerLauncher.Command getCommand()
Get the Server launcher command used to invoke the Server.

Returns:
the Server launcher command used to invoke the Server.
See Also:
ServerLauncher.Command

isAssignBuckets

public boolean isAssignBuckets()
Determines whether buckets should be assigned to partitioned regions in the cache upon Server start.

Returns:
a boolean indicating if buckets should be assigned upon Server start.

isDisableDefaultServer

public boolean isDisableDefaultServer()
Determines whether a default cache server will be added when the GemFire Server comes online.

Returns:
a boolean value indicating whether to add a default cache server.

isForcing

public boolean isForcing()
Determines whether the PID file is allowed to be overwritten when the Server is started and a PID file already exists in the Server's specified working directory.

Returns:
boolean indicating if force has been enabled.

isHelping

public boolean isHelping()
Determines whether this launcher will be used to display help information. If so, then none of the standard Server launcher commands will be used to affect the state of the Server. A launcher is said to be 'helping' if the user entered the "--help" option (switch) on the command-line.

Returns:
a boolean value indicating if this launcher is used for displaying help information.
See Also:
ServerLauncher.Command

isRebalancing

public boolean isRebalancing()
Determines whether a rebalance operation on the cache will occur upon starting the GemFire server using this launcher.

Returns:
a boolean indicating if the cache will be rebalance when the GemFire server starts.

isRedirectingOutput

public boolean isRedirectingOutput()
Determines whether this launcher will redirect output to system logs when starting a new Locator process.

Returns:
a boolean value indicating if this launcher will redirect output to system logs when starting a new Locator process

getLogFileName

public String getLogFileName()
Gets the name of the log file used to log information about this Server.

Specified by:
getLogFileName in class AbstractLauncher<String>
Returns:
a String value indicating the name of this Server's log file.

getMemberName

public String getMemberName()
Gets the name of this member (this Server) in the GemFire distributed system as determined by the 'name' GemFire property.

Specified by:
getMemberName in class AbstractLauncher<String>
Returns:
a String indicating the name of the member (this Server) in the GemFire distributed system.

getPid

public Integer getPid()
Gets the user-specified process ID (PID) of the running Server that ServerLauncher uses to issue status and stop commands to the Server.

Specified by:
getPid in class AbstractLauncher<String>
Returns:
an Integer value indicating the process ID (PID) of the running Server.

getServerBindAddress

public InetAddress getServerBindAddress()
Gets the IP address to which the Server is bound listening for and accepting cache client connections. This property should not be confused with 'bindAddress' ServerLauncher property, which is the port for binding the Server's ServerSocket used in distribution and messaging between the peers of the GemFire distributed system.

Returns:
an InetAddress indicating the IP address that the Server is bound to listening for and accepting cache client connections in a client/server topology.

getServerBindAddressAsString

public String getServerBindAddressAsString()
Gets the host, as either hostname or IP address, on which the Server was bound and running. An attempt is made to get the canonical hostname for IP address to which the Server was bound for accepting client requests. If the server bind address is null or localhost is unknown, then a default String value of "localhost/127.0.0.1" is returned.

Note, this information is purely information and should not be used to re-construct state or for other purposes.

Returns:
the hostname or IP address of the host running the Server, based on the bind-address, or 'localhost/127.0.0.1' if the bind address is null and localhost is unknown.
See Also:
InetAddress, getServerBindAddress()

getServerPort

public Integer getServerPort()
Gets the port on which the Server is listening for cache client connections. This property should not be confused with the 'port' ServerLauncher property, which is used by the Server to set the 'tcp-port' distribution config property and is used by the ServerSocket for peer distribution and messaging.

Returns:
an Integer value indicating the port the Server is listening on for cache client connections in the client/server topology.

getServerPortAsString

public String getServerPortAsString()
Gets the server port on which the Server is listening for client requests represented as a String value.

Returns:
a String representing the server port on which the Server is listening for client requests.
See Also:
getServerPort()

getServiceName

public String getServiceName()
Gets the name for a GemFire Server.

Specified by:
getServiceName in class AbstractLauncher<String>
Returns:
a String indicating the name for a GemFire Server.

getWorkingDirectory

public String getWorkingDirectory()
Gets the working directory pathname in which the Server will be run.

Overrides:
getWorkingDirectory in class AbstractLauncher<String>
Returns:
a String value indicating the pathname of the Server's working directory.

help

public void help(ServerLauncher.Command command)
Displays help for the specified Server launcher command to standard err. If the Server launcher command is unspecified, then usage information is displayed instead.

Parameters:
command - the Server launcher command in which to display help information.
See Also:
usage()

usage

public void usage()
Displays usage information on the proper invocation of the ServerLauncher from the command-line to standard err.

See Also:
help(com.gemstone.gemfire.distributed.ServerLauncher.Command)

run

public void run()
A Runnable method used to invoke the GemFire server (cache server) with the specified command. From run, a user can invoke 'start', 'status', 'stop' and 'version'. Note, that 'version' is also a command-line option, but can be treated as a "command" as well.

See Also:
Runnable

start

public ServerLauncher.ServerState start()
Invokes the 'start' command and operation to startup a GemFire server (a cache server). Note, this method will cause the JVM to block upon server start, providing the calling Thread is a non-daemon Thread.

See Also:
run()

status

public ServerLauncher.ServerState status()

stop

public ServerLauncher.ServerState stop()

GemFire 7.0

Copyright © 1997-2012 VMware, Inc. All rights reserved.