com.bigdata.jini.start.process
Class JiniServiceProcessHelper

java.lang.Object
  extended by com.bigdata.jini.start.process.ProcessHelper
      extended by com.bigdata.jini.start.process.JiniServiceProcessHelper

public class JiniServiceProcessHelper
extends ProcessHelper

Class for managing a service written using the jini framework. This extends the base class to prefer RemoteDestroyAdmin for kill(boolean). It will use RemoteDestroyAdmin.shutdown() (normal shutdown, allowing a service to be restarted) if defined and otherwise DestroyAdmin.destroy() (destroys the service along with its persistent state).

Note: RemoteDestroyAdmin is defined for the bigdata services.

Version:
$Id$
Author:
Bryan Thompson

Field Summary
 
Fields inherited from class com.bigdata.jini.start.process.ProcessHelper
log, name
 
Constructor Summary
JiniServiceProcessHelper(String name, ProcessBuilder builder, IServiceListener listener)
           
 
Method Summary
 int kill(boolean immediateShutdown)
          If setServiceItem(ServiceItem) was invoked and the service implements RemoteAdministrable, then uses RemoteAdministrable to obtain the Administrable object and then requests RemoteDestroyAdmin.shutdown() if defined (the bigdata services define this method which shuts down the services without destroying its persistent state) and otherwise RemoteDestroyAdmin.destroy(), which destroy both the service and its persistent state.
 void setServiceItem(net.jini.core.lookup.ServiceItem serviceItem)
           
 
Methods inherited from class com.bigdata.jini.start.process.ProcessHelper
consumeOutput, equals, exitValue, exitValue, getCommandString, getEnvironment, interruptWhenProcessDies, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JiniServiceProcessHelper

public JiniServiceProcessHelper(String name,
                                ProcessBuilder builder,
                                IServiceListener listener)
                         throws IOException
Parameters:
name -
builder -
listener -
Throws:
IOException
Method Detail

setServiceItem

public void setServiceItem(net.jini.core.lookup.ServiceItem serviceItem)

kill

public int kill(boolean immediateShutdown)
         throws InterruptedException
If setServiceItem(ServiceItem) was invoked and the service implements RemoteAdministrable, then uses RemoteAdministrable to obtain the Administrable object and then requests RemoteDestroyAdmin.shutdown() if defined (the bigdata services define this method which shuts down the services without destroying its persistent state) and otherwise RemoteDestroyAdmin.destroy(), which destroy both the service and its persistent state. In any of those methods was defined, we then wait for the exit value of the process before messaging the listener.

If none of those options was available, we delegate the behavior to the super class.

Note: Normal termination of some services can have significant latency (seconds or more). For example, services may refuse new operations while permitting running operations to complete.

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 - if interrupted - the process may or may not have been killed and the listener will not have been notified.


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