org.apache.xbean.kernel
Class RunningServiceCondition

java.lang.Object
  extended by org.apache.xbean.kernel.RunningServiceCondition
All Implemented Interfaces:
ServiceCondition

public class RunningServiceCondition
extends Object
implements ServiceCondition

This condition that requires another service be in the RUNNING state to be satisfied.

Since:
2.0
Author:
Dain Sundstrom

Constructor Summary
RunningServiceCondition(ServiceName dependency, boolean ownedRelationship, boolean stopOnServiceShutdown)
          Creates a condition that requires the specified service be in the RUNNING state to be satisfied.
 
Method Summary
 void destroy()
          Destroys the condition.
 void initialize(ServiceConditionContext context)
          Initializes the condition.
 boolean isSatisfied()
          Gets statisfied state of this conditon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunningServiceCondition

public RunningServiceCondition(ServiceName dependency,
                               boolean ownedRelationship,
                               boolean stopOnServiceShutdown)
Creates a condition that requires the specified service be in the RUNNING state to be satisfied.

Parameters:
dependency - the service that must be running
ownedRelationship - if true the condition will register the relationship
stopOnServiceShutdown - if the our service should be stopped when the specified service shutsdown
Method Detail

initialize

public void initialize(ServiceConditionContext context)
Initializes the condition. The conition is now allowed reserve unique resources and start threads. mehtod should never block the thread nor should it throw any exceptions.

Note: this method is called from within a critical lock within the kernel, so do not block the thread or call back into the kernel. This method should never throw an exception.

Specified by:
initialize in interface ServiceCondition
Parameters:
context - context information for this condition

isSatisfied

public boolean isSatisfied()
Gets statisfied state of this conditon. Once a condition returns true from this method it is assumed to be satisfied until destroyed and reinitialized.

Note: this method is called from within a critical lock within the kernel, so do not block the thread or call back into the kernel. This method should never throw an exception.

Specified by:
isSatisfied in interface ServiceCondition
Returns:
true if this condition is satisfied; false otherwise

destroy

public void destroy()
Destroys the condition. The condition must release all resources and stop any started threads.

Note: this method is called from within a critical lock within the kernel, so do not block the thread or call back into the kernel. This method should never throw an exception.

Specified by:
destroy in interface ServiceCondition


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.