fulmine
Class AbstractLifeCycle

java.lang.Object
  extended by fulmine.AbstractLifeCycle
All Implemented Interfaces:
IDestroyable, ILifeCycle
Direct Known Subclasses:
AbstractComponent, AbstractConnectionDiscoverer, ActiveEventListener, Channel, EventProcessor, FTContext, FTDistributionManager, FulmineContext, MultiEventListener, RpcManager, RpcRegistry, SelectorTasks, SubscriptionManager, TcpConnectionBroker, TcpConnectionParameters

public abstract class AbstractLifeCycle
extends Object
implements ILifeCycle

Base-class for all ILifeCycle instances.

Author:
Ramon Servadei

Constructor Summary
AbstractLifeCycle()
           
 
Method Summary
protected  void checkActive()
          Check if this instance is active.
 void destroy()
          This is called when the object is being removed from application use.
protected abstract  void doDestroy()
          Overridden in subclasses to perform custom logic on destruction.
protected abstract  void doStart()
          Overridden in subclasses to perform custom logic on activation.
protected  void finalize()
           
protected  AsyncLog getLog()
          Get the log to use for the object hierarchy
 boolean isActive()
          Determine if this life-cycle object is active.
 void start()
          Activate (start) this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractLifeCycle

public AbstractLifeCycle()
Method Detail

isActive

public final boolean isActive()
Description copied from interface: ILifeCycle
Determine if this life-cycle object is active.

Specified by:
isActive in interface ILifeCycle
Returns:
true if the object is active

doStart

protected abstract void doStart()
Overridden in subclasses to perform custom logic on activation. Any exceptions should be thrown as a RuntimeException or subclass thereof. When this method is called, the isActive() method will return true.


doDestroy

protected abstract void doDestroy()
Overridden in subclasses to perform custom logic on destruction. Any exceptions should be thrown as a RuntimeException or subclass thereof.


start

public final void start()
Description copied from interface: ILifeCycle
Activate (start) this object. This allocates system resources required for the object to operate. This operation is idempotent.

This method may throw a RuntimeException if it fails to activate the object.

Specified by:
start in interface ILifeCycle

destroy

public final void destroy()
Description copied from interface: IDestroyable
This is called when the object is being removed from application use. This releases all system resources and performs clean up prior to the object becoming redundant. This operation is idempotent.

This method must not throw a RuntimeException.

Specified by:
destroy in interface IDestroyable

finalize

protected final void finalize()
                       throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getLog

protected AsyncLog getLog()
Get the log to use for the object hierarchy

Returns:
the log to use for the object hierarchy

checkActive

protected void checkActive()
Check if this instance is active.

Throws:
IllegalStateException - if this is not active

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2009. All Rights Reserved.