com.bigdata.jini.start
Class AbstractServicesManagerService

java.lang.Object
  extended by com.bigdata.service.AbstractService
      extended by com.bigdata.jini.start.AbstractServicesManagerService
All Implemented Interfaces:
IServiceListener, IServicesManagerService, IService, IServiceShutdown, Remote
Direct Known Subclasses:
ServicesManagerServer.AdministrableServicesManagerService

public abstract class AbstractServicesManagerService
extends AbstractService
implements IServicesManagerService, IServiceListener, IServiceShutdown

Core impl.

Version:
$Id$
Author:
Bryan Thompson

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bigdata.service.IServiceShutdown
IServiceShutdown.Options
 
Field Summary
protected  MonitorCreatePhysicalServiceLocksTask monitorCreatePhysicalServiceLocksTask
          The task used to start and restart services.
protected  boolean startupRunning
          true iff a ServicesManagerStartupTask is currently running.
 
Fields inherited from class com.bigdata.service.AbstractService
log
 
Constructor Summary
protected AbstractServicesManagerService(Properties properties)
           
 
Method Summary
 void add(ProcessHelper service)
           
abstract  JiniFederation<?> getFederation()
          Strengthen the return type.
 Properties getProperties()
          An object wrapping the properties specified to the ctor.
 Class getServiceIface()
          Return the most interesting interface for the service.
 boolean isOpen()
          Return true iff the service is running.
protected  void killChildProcesses(boolean immediateShutdown)
          Sets a flag to disallow new process starts and kills any running child processes.
 void remove(ProcessHelper service)
           
protected  void setup()
          Establish watchers for all nodes of interest and populate the federation configuration if the [zroot] does not exist.
 void shutdown()
          Kill the child processes, using RemoteDestroyAdmin.shutdown() where supported.
 void shutdownNow()
          Kill the child processes, using RemoteDestroyAdmin.shutdownNow() where supported.
 AbstractServicesManagerService start()
          Starts the AbstractService.
 
Methods inherited from class com.bigdata.service.AbstractService
clearLoggingContext, destroy, getHostname, getServiceName, getServiceUUID, setServiceUUID, setupLoggingContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.jini.start.IServicesManagerService
sighup
 

Field Detail

startupRunning

protected volatile boolean startupRunning
true iff a ServicesManagerStartupTask is currently running. An instance of that task is started during normal startup, but instances of that task can be started by the SIGHUP handler as well. This flag is used to prevent concurrent instances of that task from running.


monitorCreatePhysicalServiceLocksTask

protected MonitorCreatePhysicalServiceLocksTask monitorCreatePhysicalServiceLocksTask
The task used to start and restart services.

Constructor Detail

AbstractServicesManagerService

protected AbstractServicesManagerService(Properties properties)
Method Detail

getProperties

public Properties getProperties()
An object wrapping the properties specified to the ctor.


add

public void add(ProcessHelper service)
Specified by:
add in interface IServiceListener

remove

public void remove(ProcessHelper service)
Specified by:
remove in interface IServiceListener

shutdown

public void shutdown()
Kill the child processes, using RemoteDestroyAdmin.shutdown() where supported. FIXME This should also bring down any processes that are being managed on this host regardless of whether or not they are child processes. For example, you KILL -9 the ServicesManager [leaves children running], start it, and then kill -s TERM it [should have discovered processes on this host for which it has responsibility and sent them shutdown() requests].

Add a private killManagedProcesses() method for this.

Specified by:
shutdown in interface IServiceShutdown
Overrides:
shutdown in class AbstractService

shutdownNow

public void shutdownNow()
Kill the child processes, using RemoteDestroyAdmin.shutdownNow() where supported.

Specified by:
shutdownNow in interface IServiceShutdown
Overrides:
shutdownNow in class AbstractService

isOpen

public boolean isOpen()
Description copied from interface: IServiceShutdown
Return true iff the service is running.

Specified by:
isOpen in interface IServiceShutdown

killChildProcesses

protected void killChildProcesses(boolean immediateShutdown)
Sets a flag to disallow new process starts and kills any running child processes.

Parameters:
immediateShutdown - When true RemoteDestroyAdmin.shutdownNow() will be used by preference to terminate child processes which support RemoteDestroyAdmin. Otherwise RemoteDestroyAdmin.shutdown() will be used to terminat child processes supporting that interface.

getServiceIface

public Class getServiceIface()
Description copied from class: AbstractService
Return the most interesting interface for the service.

Specified by:
getServiceIface in interface IService
Specified by:
getServiceIface in class AbstractService

getFederation

public abstract JiniFederation<?> getFederation()
Strengthen the return type.

Specified by:
getFederation in class AbstractService

start

public AbstractServicesManagerService start()
Description copied from class: AbstractService
Starts the AbstractService.

Note: A AbstractService.start() is required in order to give subclasses an opportunity to be fully initialized before they are required to begin operations. It is impossible to encapsulate the startup logic cleanly without this ctor() + start() pattern. Those familiar with Objective-C will recognized this.

Specified by:
start in class AbstractService
Returns:
this (the return type should be strengthened by the concrete implementation to return the actual type).

setup

protected void setup()
              throws Exception
Establish watchers for all nodes of interest and populate the federation configuration if the [zroot] does not exist.

Throws:
Exception


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.