com.bigdata.jini.start.process
Class ZookeeperProcessHelper
java.lang.Object
com.bigdata.jini.start.process.ProcessHelper
com.bigdata.jini.start.process.ZookeeperProcessHelper
public class ZookeeperProcessHelper
- extends ProcessHelper
Manages the life cycle of a zookeeper instance with extensions to send a
"kill" message to the service, periodically send "ruok" messages, etc.
- Version:
- $Id$
- Author:
- Bryan Thompson
- See Also:
QuorumPeerMain,
PurgeTxnLog- TODO:
- periodic [ruok] and alert operator if instance has failed (we could try
to restart, but an operator should really intervene).
PurgeTxnLog must be used to periodically release snapshots and
their associated logs which are no longer required for service restart., periodic purge of snapshots and logs, etc.
|
Method Summary |
int |
kill(boolean immediateShutdown)
Extended to send the kill message to the local zookeeper
instance. |
static int |
startZookeeper(net.jini.config.Configuration config,
IServiceListener listener)
(Re-)starts any zookeeper server(s) for the localhost that are identified
in the ConfigurationFile and are not currently running. |
clientPort
protected final int clientPort
thisInetAddr
protected static InetAddress thisInetAddr
ZookeeperProcessHelper
public ZookeeperProcessHelper(String name,
ProcessBuilder builder,
IServiceListener listener,
int clientPort)
throws IOException
- Parameters:
name - builder - running - clientPort - The zookeeper client port.
- Throws:
IOException
kill
public int kill(boolean immediateShutdown)
throws InterruptedException
- Extended to send the
kill message to the local zookeeper
instance.
Note: killing zookeeper requires sending a kill command
from the host on which it is executing. zookeeper appears to fork a
process which is the "real" zookeeper, so just killing the outer process
does not do what we want.
Note: Due to how zookeeper peers work, we don't really know which
instance is answering requests for the clientPort. It could be any
instance in the ensemble. Therefore, DO NOT run multiple zookeeper
instances on the same host with this class! It will kill the current
master!
- Overrides:
kill in class ProcessHelper
- Parameters:
immediateShutdown - processes with APIs that differentiate immediate shutdown and
normal shutdown will use the appropriate behavior as selected
by this parameter.
- Returns:
- The exitValue of the process.
- Throws:
InterruptedException
startZookeeper
public static int startZookeeper(net.jini.config.Configuration config,
IServiceListener listener)
throws net.jini.config.ConfigurationException,
IOException
- (Re-)starts any zookeeper server(s) for the localhost that are identified
in the
ConfigurationFile and are not currently running.
- Returns:
- the #of instances (re-)started.
- Throws:
net.jini.config.ConfigurationException
IOException- See Also:
ZookeeperServerConfiguration.newServiceStarter(IServiceListener, ZookeeperServerEntry)
Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.