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

## com.google.common.util.concurrent
Interface Service.Listener

Enclosing interface:
  Service

    @Beta
    public static interface Service.Listener

A listener for the various state changes that a `Service` goes through in its lifecycle.

Since:
  13.0
Author:
  Luke Sandberg

Method Summary
`void` | `failed(Service.State from, Throwable failure)` Called when the service transitions to the FAILED state.
`void` | `running()` Called when the service transitions from STARTING to RUNNING.
`void` | `starting()` Called when the service transitions from NEW to STARTING.
`void` | `stopping(Service.State from)` Called when the service transitions to the STOPPING state.
`void` | `terminated(Service.State from)` Called when the service transitions to the TERMINATED state.

Method Detail

### starting

    void starting()

  Called when the service transitions from NEW to STARTING. This occurs when `Service.start()` or `Service.startAndWait()` is called the first time.

### running

    void running()

  Called when the service transitions from STARTING to RUNNING. This occurs when a service has successfully started.

### stopping

    void stopping(Service.State from)

  Called when the service transitions to the STOPPING state. The only valid values for `from` are STARTING or RUNNING. This occurs when `Service.stop()` is called.

  Parameters:
    `from` - The previous state that is being transitioned from.

### terminated

    void terminated(Service.State from)

  Called when the service transitions to the TERMINATED state. The TERMINATED state is a terminal state in the transition diagram. Therefore, if this method is called, no other methods will be called on the `Service.Listener`.

  Parameters:
    `from` - The previous state that is being transitioned from. The only valid values for this are NEW, RUNNING or STOPPING.

### failed

    void failed(Service.State from,
                Throwable failure)

  Called when the service transitions to the FAILED state. The FAILED state is a terminal state in the transition diagram. Therefore, if this method is called, no other methods will be called on the `Service.Listener`.

  Parameters:
    `from` - The previous state that is being transitioned from. Failure can occur in any state with the exception of NEW or TERMINATED.
    `failure` - The exception that caused the failure.

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

Copyright © 2010-2012. All Rights Reserved.