|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.samples.asynchbeans.wstrader.tickstream.StreamListener
public class StreamListener
This is created the by stream servlet. It's job is to listen for events that need to be pushed over HTTP to the applet and push them. Each applet client will have a StreamListener associated with it. When the applet disconnects, the listener will remain, but the PrintWriter (associated with the response object of the Servlet) will become invalid. The client can then reconnect, look-up this listener instance and retrieve various settings, such at the Ticker symbols that were previously configured. If the client manually logs off, then this listener should be explicitly destroyed.
Constructor Summary | |
---|---|
StreamListener(StreamClientState cstate,
java.io.PrintWriter pw,
java.lang.String name)
Create a new Servlet Listener |
Method Summary | |
---|---|
void |
destroyed(com.ibm.websphere.asynchbeans.AsynchScope scope)
/** This is only called when either the client logs out or the SSM associated with the clienyt detected that the client is not responsive. |
void |
destroyed(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
|
java.lang.String |
getName()
This returns the name of this streamer. |
java.lang.String |
getSubscribedTickers()
Returns the subscribedTickers. |
void |
handleHeartBeat(ClientInstruction clientInstruction)
Handle pings from the Stream HeartBeat Alarm |
void |
listenerCountChanged(com.ibm.websphere.asynchbeans.EventSource es,
int oldCount,
int newCount)
|
void |
listenerExceptionThrown(com.ibm.websphere.asynchbeans.EventSource es,
java.lang.Object listener,
java.lang.String methodName,
java.lang.Throwable exception)
|
void |
sendMessages()
Send all ticker update messages from our buffer to the associated servlet's PrintWriter. |
void |
subsystemIsDead(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
This gets called when the SSM associated with the price generator detects the price generator has failed or been stopped. |
void |
subsystemIsFresh(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
This is called when the SSM associated with the price generator detects the price generator has done a lazerus and recovered from a failure. |
void |
subsystemIsStale(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
This is called when the SSM associated with the price generator detects that the price generator may fail. |
void |
tickerStopped(TickerSubscriber subscriber)
The ticker listener has stopped. |
void |
tickerUpdated(TickerSubscriber subscriber,
javax.jms.Message msg)
This is called whenever a new message is received for a ticker that we're interested in. |
void |
unexpectedException(com.ibm.websphere.asynchbeans.EventSource es,
java.lang.Object runnable,
java.lang.Throwable exception)
|
void |
updateTickers(java.lang.String tickers,
boolean duringDestroy)
This takes a new list of tickers to subscribe to. |
void |
wakeServlet()
Wakes all all routines waking on the PrintWriter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamListener(StreamClientState cstate, java.io.PrintWriter pw, java.lang.String name)
cstate
- the client state that this stream should be registered with. A client may have more than one
stream instance.pw
- the servlet's response object's PrintWriter.name
- the identity of this stream. The client can lookup this stream by name any time.Method Detail |
---|
public java.lang.String getName()
public void wakeServlet()
public void destroyed(com.ibm.websphere.asynchbeans.AsynchScope scope)
destroyed
in interface com.ibm.websphere.asynchbeans.AsynchScopeEvents
AsynchScopeEvents.destroyed(AsynchScope)
public void destroyed(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
destroyed
in interface com.ibm.websphere.asynchbeans.SubsystemMonitorEvents
SubsystemMonitorEvents.destroyed(SubsystemMonitor)
public void subsystemIsDead(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
subsystemIsDead
in interface com.ibm.websphere.asynchbeans.SubsystemMonitorEvents
SubsystemMonitorEvents.subsystemIsDead(SubsystemMonitor)
public void subsystemIsFresh(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
subsystemIsFresh
in interface com.ibm.websphere.asynchbeans.SubsystemMonitorEvents
SubsystemMonitorEvents.subsystemIsFresh(SubsystemMonitor)
public void subsystemIsStale(com.ibm.websphere.asynchbeans.SubsystemMonitor ssm)
subsystemIsStale
in interface com.ibm.websphere.asynchbeans.SubsystemMonitorEvents
SubsystemMonitorEvents.subsystemIsStale(SubsystemMonitor)
public void listenerCountChanged(com.ibm.websphere.asynchbeans.EventSource es, int oldCount, int newCount)
listenerCountChanged
in interface com.ibm.websphere.asynchbeans.EventSourceEvents
EventSourceEvents.listenerCountChanged(EventSource, int, int)
public void listenerExceptionThrown(com.ibm.websphere.asynchbeans.EventSource es, java.lang.Object listener, java.lang.String methodName, java.lang.Throwable exception)
listenerExceptionThrown
in interface com.ibm.websphere.asynchbeans.EventSourceEvents
EventSourceEvents.listenerExceptionThrown(EventSource, Object, String, Throwable)
public void unexpectedException(com.ibm.websphere.asynchbeans.EventSource es, java.lang.Object runnable, java.lang.Throwable exception)
unexpectedException
in interface com.ibm.websphere.asynchbeans.EventSourceEvents
EventSourceEvents.unexpectedException(EventSource, Object, Throwable)
public void tickerStopped(TickerSubscriber subscriber)
TickerUpdateEvents
tickerStopped
in interface TickerUpdateEvents
TickerUpdateEvents.tickerStopped(TickerSubscriber)
public void tickerUpdated(TickerSubscriber subscriber, javax.jms.Message msg)
The message is then sent by the sendMessages method on another thread. We return quickly here to avoid holding up the message receiver.
tickerUpdated
in interface TickerUpdateEvents
subscriber
- the information about the ticker.msg
- the received messageTickerUpdateEvents.tickerUpdated(TickerSubscriber, Message)
public void handleHeartBeat(ClientInstruction clientInstruction)
handleHeartBeat
in interface StreamHeartBeatEvents
clientInstruction
- the instruction to send to the client listenerStreamHeartBeatEvents.handleHeartBeat(ClientInstruction)
public void sendMessages()
public void updateTickers(java.lang.String tickers, boolean duringDestroy) throws javax.naming.NamingException, com.ibm.websphere.asynchbeans.WorkException, javax.jms.JMSException
tickers
- The new list of tickers for this client, can be empty meaning none.duringDestroy
- If true then the client has logged out or timed out and the AsynchScope for the client is being destroyed.
javax.naming.NamingException
com.ibm.websphere.asynchbeans.WorkException
javax.jms.JMSException
public java.lang.String getSubscribedTickers()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |