Package org.eclipse.net4j.util.lifecycle

# Class LifecycleUtil

java.lang.Object
org.eclipse.net4j.util.lifecycle.LifecycleUtil

public final class LifecycleUtil extends Object
Various static helper methods for dealing with `lifecycles`.

Author:
  Eike Stepper

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static @interface`
`LifecycleUtil.Activator`
Annotates a method of a POJO class that's supposed to be called to activate a POJO object during `activate(Object)`.
`static @interface`
`LifecycleUtil.Deactivator`
Annotates a method of a POJO class that's supposed to be called to deactivate a POJO object during `deactivate(Object)`.
`static final class`
`LifecycleUtil.Delegator<T>`
The `invocation handler` of the `dynamic proxy` created in `LifecycleUtil.delegateLifecycle()`.
`static final class`
`LifecycleUtil.ReactivationTrigger`

## Method Summary

Modifier and Type
Method
Description
`static void`
`activate(Object object)`
`static void`
`activate(Object object, boolean useAnnotation)`
`static Exception`
`activateSilent(Object object)`
`static Exception`
`activateSilent(Object object, boolean useAnnotation)`
`static void`
`checkActive(Object object)`
`static void`
`checkInactive(Object object)`
`static Exception`
`deactivate(Object object)`
`static Exception`
`deactivate(Object object, boolean useAnnotation)`
`static void`
`deactivate(Object object, OMLogger.Level logLevel)`
`static void`
`deactivateNoisy(Object object)`
`static void`
`deactivateNoisy(Object object, boolean useAnnotation)`
`static Exception`
`deactivateSilent(Object object)`
`static <T> T`
`delegateLifecycle(ClassLoader loader, T pojo, Class<?> pojoInterface, ILifecycle delegate)`
`static <T> T`
`delegateLifecycle(ClassLoader loader, T pojo, ILifecycle delegate)`
`static LifecycleState`
`getLifecycleState(Object object)`
`static int`
`getRefCount(Object object)`
`static boolean`
`isActive(Object object)`
`static boolean`
`isDeferredActivation(Object object)`
`static void`
`triggerReactivation()`
`static void`
`triggerReactivation(Object lifecycle)`
Triggers a reactivation of the given lifecycle.
`static boolean`
`waitFor(Object object, long millis, LifecycleState state)`
`static boolean`
`waitForActive(Object object, long millis)`
`static boolean`
`waitForInactive(Object object, long millis)`
`static void`
`withoutChecks(Runnable runnable)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getRefCount

public static int getRefCount(Object object)

Since:
  3.5

### getLifecycleState

public static LifecycleState getLifecycleState(Object object)

Since:
  3.0

### isDeferredActivation

public static boolean isDeferredActivation(Object object)

Since:
  3.2

### isActive

public static boolean isActive(Object object)

### checkActive

public static void checkActive(Object object) throws LifecycleException

Throws:
  `LifecycleException`
Since:
  2.0

### checkInactive

public static void checkInactive(Object object) throws LifecycleException

Throws:
  `LifecycleException`
Since:
  2.0

### withoutChecks

public static void withoutChecks(Runnable runnable)

Since:
  3.17

### activate

public static void activate(Object object) throws LifecycleException

Throws:
  `LifecycleException`

### activate

public static void activate(Object object, boolean useAnnotation) throws LifecycleException

Throws:
  `LifecycleException`
See Also:
  - `LifecycleUtil.Activator`

### activateSilent

public static Exception activateSilent(Object object)

### activateSilent

public static Exception activateSilent(Object object, boolean useAnnotation)

See Also:
  - `LifecycleUtil.Activator`

### waitForActive

public static boolean waitForActive(Object object, long millis)

### waitForInactive

public static boolean waitForInactive(Object object, long millis)

Since:
  3.1

### waitFor

public static boolean waitFor(Object object, long millis, LifecycleState state)

Since:
  3.1

### deactivate

public static Exception deactivate(Object object)

### deactivate

public static Exception deactivate(Object object, boolean useAnnotation)

See Also:
  - `LifecycleUtil.Deactivator`

### deactivate

public static void deactivate(Object object, OMLogger.Level logLevel)

Since:
  2.0

### deactivateSilent

public static Exception deactivateSilent(Object object)

Since:
  3.26

### deactivateNoisy

public static void deactivateNoisy(Object object) throws LifecycleException

Throws:
  `LifecycleException`

### deactivateNoisy

public static void deactivateNoisy(Object object, boolean useAnnotation) throws LifecycleException

Throws:
  `LifecycleException`

### triggerReactivation

public static void triggerReactivation()

Since:
  3.29

### triggerReactivation

public static void triggerReactivation(Object lifecycle)
Triggers a reactivation of the given lifecycle.

The given lifecycle must be in the `Lifecycle.doActivate()` method or in the `Lifecycle.doAfterActivate()` method. Calling this method will abort the activation and cause the lifecycle to be deactivated and then activated again. If the lifecycle is not in one of the two methods, unexpected behavior will occur.

Since:
  3.29

### delegateLifecycle

public static <T> T delegateLifecycle(ClassLoader loader, T pojo, Class<?> pojoInterface, ILifecycle delegate)

Since:
  2.0

### delegateLifecycle

public static <T> T delegateLifecycle(ClassLoader loader, T pojo, ILifecycle delegate)

Since:
  2.0