org.gcube.common.ghn.service.lifetime
Class DefaultLifecycle

java.lang.Object
  extended by org.gcube.common.ghn.service.lifetime.DefaultLifecycle
All Implemented Interfaces:
Lifecycle

public class DefaultLifecycle
extends Object
implements Lifecycle


Field Summary
 
Fields inherited from interface org.gcube.common.ghn.service.lifetime.Lifecycle
failed, ready, started, stopped
 
Constructor Summary
DefaultLifecycle(org.gcube.common.events.Hub hub, String serviceName)
           
 
Method Summary
 void moveTo(State next)
          Transition this lifecycle to a given state.
 State previous()
          Returns the state from which this lifecycle transitioned to its current state.
 State state()
          Returns the current state of this lifecycle.
 void tryMoveTo(State next)
          Attempts to transition this lifecycle to a given state, but does not fail if the transition is illegal for this lifecycle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLifecycle

public DefaultLifecycle(org.gcube.common.events.Hub hub,
                        String serviceName)
Method Detail

state

public State state()
Description copied from interface: Lifecycle
Returns the current state of this lifecycle.

Specified by:
state in interface Lifecycle
Returns:
the current state.

moveTo

public void moveTo(State next)
Description copied from interface: Lifecycle
Transition this lifecycle to a given state.

Specified by:
moveTo in interface Lifecycle
Parameters:
next - the state

tryMoveTo

public void tryMoveTo(State next)
Description copied from interface: Lifecycle
Attempts to transition this lifecycle to a given state, but does not fail if the transition is illegal for this lifecycle.

Specified by:
tryMoveTo in interface Lifecycle
Parameters:
next - the state

previous

public State previous()
Description copied from interface: Lifecycle
Returns the state from which this lifecycle transitioned to its current state.

Specified by:
previous in interface Lifecycle
Returns:
the previous state


Copyright © 2013. All Rights Reserved.