org.apache.xbean.kernel.standard
Class AggregateCondition

java.lang.Object
  extended byorg.apache.xbean.kernel.standard.AggregateCondition
Direct Known Subclasses:
NonRestartableStopCondition

public class AggregateCondition
extends java.lang.Object

Aggregates a set of ServiceConditions together so the ServiceManager can treat them as a single unit.

Since:
2.0
Version:
$Id$
Author:
Dain Sundstrom

Constructor Summary
AggregateCondition(Kernel kernel, ServiceName serviceName, java.lang.ClassLoader classLoader, edu.emory.mathcs.backport.java.util.concurrent.locks.Lock lock, java.util.Set conditions)
          Creates an aggregate condition.
 
Method Summary
protected  void addCondition(ServiceCondition condition)
          Adds a new condition if not already registered.
 void awaitSatisfaction()
          Causes the current thread to wait until the conditons is satisfied.
 java.util.List destroy()
          Destroys all condtions.
protected  java.util.Set getConditions()
          Gets a snapshot of the current conditions.
 java.util.Set getUnsatisfied()
          Gets the unsatisfied conditions.
 void initialize()
          Initializes the conditions.
 boolean isDestroyed()
          Gets the destroyed status.
protected  void removeCondition(ServiceCondition condition)
          Removes a condition from the registry if present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateCondition

public AggregateCondition(Kernel kernel,
                          ServiceName serviceName,
                          java.lang.ClassLoader classLoader,
                          edu.emory.mathcs.backport.java.util.concurrent.locks.Lock lock,
                          java.util.Set conditions)
Creates an aggregate condition.

Parameters:
kernel - the kernel in which the service is registered
serviceName - the name of the service
classLoader - the class loader for the service
lock - the lock for the service manager
conditions - the conditions
Method Detail

getConditions

protected java.util.Set getConditions()
Gets a snapshot of the current conditions.

Returns:
a snapshot of the current conditions

addCondition

protected final void addCondition(ServiceCondition condition)
Adds a new condition if not already registered.

Parameters:
condition - the new condition

removeCondition

protected final void removeCondition(ServiceCondition condition)
Removes a condition from the registry if present.

Parameters:
condition - the condition to remove

initialize

public void initialize()
Initializes the conditions.


getUnsatisfied

public java.util.Set getUnsatisfied()
Gets the unsatisfied conditions.

Returns:
the unstatisfied conditions

isDestroyed

public boolean isDestroyed()
Gets the destroyed status.

Returns:
true if this AggregateCondition been destroyed; false otherwise

destroy

public java.util.List destroy()
Destroys all condtions.

Returns:
a list of the Exceptions or Errors that occured while destroying the conditon objects.

awaitSatisfaction

public void awaitSatisfaction()
                       throws java.lang.InterruptedException
Causes the current thread to wait until the conditons is satisfied.

Throws:
java.lang.InterruptedException - if the thread is interrupted


Copyright © {inceptionYear}-2006 Apache Software Foundation. All Rights Reserved.