com.bigdata.jini.start
Class MonitorCreatePhysicalServiceLocksTask.CreatePhysicalServiceTask

java.lang.Object
  extended by com.bigdata.jini.start.MonitorCreatePhysicalServiceLocksTask.CreatePhysicalServiceTask
All Implemented Interfaces:
Callable<Boolean>
Enclosing class:
MonitorCreatePhysicalServiceLocksTask

public class MonitorCreatePhysicalServiceLocksTask.CreatePhysicalServiceTask
extends Object
implements Callable<Boolean>

Task contends for the ZLock. If the lock is obtained, the ServiceConfiguration is fetched using the zpath written into the data of the lock node and the service constraints are checked. If the constraints are satisified by this host, then the task attempts to start the service. If the service can be started successfully, then the lock node is destroyed and the task exits. Otherwise the task releases the lock and sleeps a bit. Either it or another task running on another ServicesManagerServer will gain the lock and try again. (If the lock node is invalidated or destroyed, then the task will quit.)

Version:
$Id$
Author:
Bryan Thompson

Field Summary
protected  String lockNodeZPath
          The zpath of the lock node.
 
Constructor Summary
MonitorCreatePhysicalServiceLocksTask.CreatePhysicalServiceTask(String lockNodeZPath)
           
 
Method Summary
 Boolean call()
          Contends for the ZLock and then invokes runWithZLock(), which will verify the constraints and attempt to start the service.
protected  void startService(ManagedServiceConfiguration config, String logicalServiceZPath)
          Start the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lockNodeZPath

protected final String lockNodeZPath
The zpath of the lock node. The data in this node is the xpath of the logical service whose instance needs to be created.

Constructor Detail

MonitorCreatePhysicalServiceLocksTask.CreatePhysicalServiceTask

public MonitorCreatePhysicalServiceLocksTask.CreatePhysicalServiceTask(String lockNodeZPath)
Parameters:
lockNodeZPath - The path to the lock node.
lockNodeZPath -
Method Detail

call

public Boolean call()
             throws Exception
Contends for the ZLock and then invokes runWithZLock(), which will verify the constraints and attempt to start the service.

Note: If we are unable to create the service while we are holding the lock then we wait a little bit and try again. This covers the case where there are preconditions for the service start which have not been met but which might become satisified at any time.

Note: If the lock node is deleted, then we will exit and return false.

Specified by:
call in interface Callable<Boolean>
Returns:
true if we started the service.
Throws:
Exception - if we could not start the service.

startService

protected void startService(ManagedServiceConfiguration config,
                            String logicalServiceZPath)
                     throws Exception
Start the service.

Parameters:
config - The service configuration.
logicalServiceZPath - The zpath of the logical service.
Throws:
TimeoutException - if the service did not start within the configured timeout.
Exception


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