com.ibm.websphere.samples.asynchbeans.wstrader.pricegen.ejb
Class PriceGenControlBean

java.lang.Object
  extended by com.ibm.websphere.samples.asynchbeans.wstrader.pricegen.ejb.PriceGenControlBean
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class PriceGenControlBean
extends java.lang.Object
implements javax.ejb.SessionBean

Contains all logic for starting and stopping a Price Generator. For each price publisher configured in the RawTickerConfig entity bean, we create alarms to publish each tick.

See Also:
Serialized Form

Field Summary
protected  javax.ejb.SessionContext mySessionCtx
           
 
Constructor Summary
PriceGenControlBean()
           
 
Method Summary
 void ejbActivate()
           
 void ejbCreate()
          ejbCreate
 void ejbPassivate()
           
 void ejbRemove()
           
 javax.ejb.SessionContext getSessionContext()
          getSessionContext
 void setSessionContext(javax.ejb.SessionContext arg0)
           
 boolean startPublishers()
          This method starts the price generator alarms when the application starts.
 boolean stopPublishers()
          Destroy the price publishers and all associated resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mySessionCtx

protected javax.ejb.SessionContext mySessionCtx
Constructor Detail

PriceGenControlBean

public PriceGenControlBean()
Method Detail

startPublishers

public boolean startPublishers()
                        throws java.lang.Exception
This method starts the price generator alarms when the application starts. We get all the configured pricers in the database and create an Alarm for each one to publish a message with the new synthetic price.

Returns:
boolean True if the publishers were started, False if the publishers were already started.
Throws:
java.lang.Exception

stopPublishers

public boolean stopPublishers()
                       throws java.lang.Exception
Destroy the price publishers and all associated resources.

Returns:
boolean True if the publishers were stopped. False if they were already stopped.
Throws:
java.lang.Exception

ejbActivate

public void ejbActivate()
                 throws javax.ejb.EJBException,
                        java.rmi.RemoteException
Specified by:
ejbActivate in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException
java.rmi.RemoteException
See Also:
SessionBean.ejbActivate()

ejbPassivate

public void ejbPassivate()
                  throws javax.ejb.EJBException,
                         java.rmi.RemoteException
Specified by:
ejbPassivate in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException
java.rmi.RemoteException
See Also:
SessionBean.ejbPassivate()

ejbRemove

public void ejbRemove()
               throws javax.ejb.EJBException,
                      java.rmi.RemoteException
Specified by:
ejbRemove in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException
java.rmi.RemoteException
See Also:
SessionBean.ejbRemove()

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
ejbCreate

Throws:
javax.ejb.CreateException

setSessionContext

public void setSessionContext(javax.ejb.SessionContext arg0)
                       throws javax.ejb.EJBException,
                              java.rmi.RemoteException
Specified by:
setSessionContext in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException
java.rmi.RemoteException
See Also:
SessionBean.setSessionContext(SessionContext)

getSessionContext

public javax.ejb.SessionContext getSessionContext()
getSessionContext