LifeSupport (Neo4j Community 1.8.RC1 API)
Date: 2012-09-07

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neo4j Community
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.kernel.lifecycle
Class LifeSupport

    java.lang.Object
      org.neo4j.kernel.lifecycle.LifeSupport

All Implemented Interfaces:
  Lifecycle

    public class LifeSupport

extends Object
implements Lifecycle

Support class for handling collections of Lifecycle instances. Manages the transitions from one state to another. To use this, first add instances to it that implement the Lifecycle interface. When lifecycle methods on this class are called it will try to invoke the same methods on the registered instances. Components that internally owns other components that has a lifecycle can use this to control them as well.

Constructor Summary
`LifeSupport()`

Method Summary
`
`<T> T`
` | `add(T instance)`
`void` | `addLifecycleListener(LifecycleListener listener)`
`void` | `dump(org.neo4j.kernel.impl.util.StringLogger logger)`
`LifecycleStatus` | `getStatus()`
`void` | `init()` Initialize all registered instances, transitioning from status NONE to STOPPED.
`void` | `removeLifecycleListener(LifecycleListener listener)`
`void` | `restart(Lifecycle instance)` Restart an individual instance.
`void` | `shutdown()` Shutdown all registered instances, transitioning from either STARTED or STOPPED to SHUTDOWN.
`void` | `start()` Start all registered instances, transitioning from STOPPED to STARTED.
`void` | `stop()` Stop all registered instances, transitioning from STARTED to STOPPED.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LifeSupport

    public LifeSupport()

Method Detail

### add

    public <T> T add(T instance)

### getStatus

    public LifecycleStatus getStatus()

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

### init

    public void init()
              throws LifecycleException

  Initialize all registered instances, transitioning from status NONE to STOPPED. If transition fails, then it goes to STOPPED and then SHUTDOWN, so it cannot be restarted again.

  Specified by:
    `init` in interface `Lifecycle`
  Throws:
    `LifecycleException`

### start

    public void start()
               throws LifecycleException

  Start all registered instances, transitioning from STOPPED to STARTED. If it was previously not initialized, it will be initialized first. If any instance fails to start, the already started instances will be stopped, so that the overall status is STOPPED.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `LifecycleException`

### stop

    public void stop()
              throws LifecycleException

  Stop all registered instances, transitioning from STARTED to STOPPED. If any instance fails to stop, the rest of the instances will still be stopped, so that the overall status is STOPPED.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `Exception`
    `LifecycleException`

### shutdown

    public void shutdown()
                  throws LifecycleException

  Shutdown all registered instances, transitioning from either STARTED or STOPPED to SHUTDOWN. If any instance fails to shutdown, the rest of the instances will still be shut down, so that the overall status is SHUTDOWN.

  Specified by:
    `shutdown` in interface `Lifecycle`
  Throws:
    `Exception`
    `LifecycleException`

### restart

    public void restart(Lifecycle instance)
                 throws LifecycleException,
                        IllegalArgumentException

  Restart an individual instance. All instances "after" the instance will be stopped first, so that they don't try to use it during the restart. A restart is effectively a stop followed by a start.

  Parameters:
    `instance` -
  Throws:
    `Throwable` - if any start or stop fails
    `IllegalArgumentException` - if instance is not registered
    `LifecycleException`

### dump

    public void dump(org.neo4j.kernel.impl.util.StringLogger logger)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neo4j Community
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.