throws Exception
{
super(properties, systemRegistry, txnProxy, logger);
logger.log(Level.CONFIG, "Creating WatchdogServiceImpl");
PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
// Setup the KernelShutdownController object
if (ctrl == null) {
throw new NullPointerException("null shutdown controller");
}
shutdownController = ctrl;
try {
localHost = InetAddress.getLocalHost().getHostName();
NodeType nodeType =
wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
NodeType.class,
NodeType.singleNode);
boolean startServer = nodeType != NodeType.appNode;
boolean isFullStack = nodeType != NodeType.coreServerNode;
int clientPort = wrappedProps.getIntProperty(
CLIENT_PORT_PROPERTY, DEFAULT_CLIENT_PORT, 0, 65535);
String clientHost = wrappedProps.getProperty(
CLIENT_HOST_PROPERTY, localHost);
/*
* Check service version.
*/
transactionScheduler.runTask(
new AbstractKernelRunnable("CheckServiceVersion") {
public void run() {
checkServiceVersion(
VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
} }, taskOwner);
clientImpl = new WatchdogClientImpl();
exporter = new Exporter<WatchdogClient>(WatchdogClient.class);
exporter.export(clientImpl, clientPort);
clientProxy = exporter.getProxy();
String host;
int serverPort;
if (startServer) {
serverImpl = new WatchdogServerImpl(
properties, systemRegistry, txnProxy,
clientHost, clientProxy, isFullStack);
host = localHost;
serverPort = serverImpl.getPort();
} else {
host = wrappedProps.getProperty(
HOST_PROPERTY,
wrappedProps.getProperty(
StandardProperties.SERVER_HOST));
if (host == null) {
throw new IllegalArgumentException(
"A server host must be specified");
}
serverPort = wrappedProps.getIntProperty(
SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 1, 65535);
}
Registry rmiRegistry = LocateRegistry.getRegistry(host, serverPort);
serverProxy = (WatchdogServer)
rmiRegistry.lookup(WatchdogServerImpl.WATCHDOG_SERVER_NAME);
int jmxPort = wrappedProps.getIntProperty(
StandardProperties.SYSTEM_JMX_REMOTE_PORT, -1);
localNodeId = dataService.getLocalNodeId();
if (startServer) {
renewInterval = serverImpl.renewInterval;
} else {
renewInterval = serverProxy.registerNode(
localNodeId, clientHost, clientProxy, jmxPort);
}
renewThread.start();
timesyncInterval = wrappedProps.getLongProperty(
TIMESYNC_INTERVAL_PROPERTY, DEFAULT_TIMESYNC_INTERVAL,
1000, Long.MAX_VALUE);
// create our profiling info and register our MBean
ProfileCollector collector =