|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnl.justobjects.pushlet.core.Subscriber
public class Subscriber
Handles data channel between dispatcher and client.
| Field Summary | |
|---|---|
private boolean |
active
Are we able to accept/send events ?. |
private EventQueue |
eventQueue
Blocking queue. |
(package private) long |
lastAlive
|
private java.lang.String |
mode
Transfer mode (stream, pull, poll). |
private long |
queueReadTimeoutMillis
URL to be used in refresh requests in pull/poll modes. |
private long |
queueWriteTimeoutMillis
|
private long |
refreshTimeoutMillis
|
private Session |
session
|
private java.util.Map |
subscriptions
Map of active subscriptions, keyed by their subscription id. |
| Fields inherited from interface nl.justobjects.pushlet.core.Protocol |
|---|
DEFAULT_SERVLET_URI, E_ABORT, E_DATA, E_HEARTBEAT, E_HEARTBEAT_ACK, E_JOIN, E_JOIN_ACK, E_JOIN_LISTEN, E_JOIN_LISTEN_ACK, E_LEAVE, E_LEAVE_ACK, E_LISTEN, E_LISTEN_ACK, E_NACK, E_PUBLISH, E_PUBLISH_ACK, E_REFRESH, E_REFRESH_ACK, E_SUBSCRIBE, E_SUBSCRIBE_ACK, E_UNSUBSCRIBE, E_UNSUBSCRIBE_ACK, FORMAT_JAVASCRIPT, FORMAT_SERIALIZED_JAVA_OBJECT, FORMAT_XML, FORMAT_XML_STRICT, MODE_POLL, MODE_PULL, MODE_STREAM, P_EVENT, P_FORMAT, P_FROM, P_ID, P_MODE, P_REASON, P_SEQ, P_SUBJECT, P_SUBSCRIPTION_ID, P_SUBSCRIPTION_LABEL, P_TIME, P_TO, P_URL, P_WAIT, SUBJECT_META, SUBJECT_META_JOINS, SUBJECT_META_SUBS |
| Constructor Summary | |
|---|---|
protected |
Subscriber()
Protected constructor as we create through factory method. |
| Method Summary | |
|---|---|
Subscription |
addSubscription(java.lang.String aSubject,
java.lang.String aLabel)
Add a subscription. |
void |
bailout()
|
static Subscriber |
create(Session aSession)
Create instance through factory method. |
protected void |
debug(java.lang.String s)
Exceptional print util. |
void |
fetchEvents(Command aCommand)
Get events from queue and push to client. |
java.lang.String |
getId()
Get (session) id. |
java.lang.String |
getMode()
|
long |
getRefreshTimeMillis()
|
Session |
getSession()
Return client session. |
Subscription[] |
getSubscriptions()
Return subscriptions. |
protected void |
info(java.lang.String s)
Info. |
boolean |
isActive()
Are we still active to handle events. |
Subscription |
match(Event event)
Determine if we should receive event. |
void |
onEvent(Event theEvent)
Event from Dispatcher: enqueue it. |
Subscription |
removeSubscription(java.lang.String aSubscriptionId)
Remove a subscription. |
void |
removeSubscriptions()
Remove all subscriptions. |
protected void |
sendRefresh(ClientAdapter aClientAdapter,
java.lang.String aRefreshURL)
Send refresh command to pull/poll clients. |
void |
setMode(java.lang.String aMode)
|
void |
start()
|
void |
stop()
|
java.lang.String |
toString()
|
protected void |
warn(java.lang.String s)
Exceptional print util. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private Session session
private EventQueue eventQueue
private long queueReadTimeoutMillis
private long queueWriteTimeoutMillis
private long refreshTimeoutMillis
volatile long lastAlive
private java.util.Map subscriptions
private volatile boolean active
private java.lang.String mode
| Constructor Detail |
|---|
protected Subscriber()
| Method Detail |
|---|
public static Subscriber create(Session aSession)
throws PushletException
aSession - the parent Session
PushletException - exception, usually misconfigurationpublic void start()
public void stop()
public void bailout()
public boolean isActive()
public Session getSession()
public java.lang.String getId()
public Subscription[] getSubscriptions()
public Subscription addSubscription(java.lang.String aSubject,
java.lang.String aLabel)
throws PushletException
PushletExceptionpublic Subscription removeSubscription(java.lang.String aSubscriptionId)
public void removeSubscriptions()
public java.lang.String getMode()
public void setMode(java.lang.String aMode)
public long getRefreshTimeMillis()
public void fetchEvents(Command aCommand)
throws PushletException
PushletExceptionpublic Subscription match(Event event)
public void onEvent(Event theEvent)
protected void sendRefresh(ClientAdapter aClientAdapter,
java.lang.String aRefreshURL)
protected void info(java.lang.String s)
protected void warn(java.lang.String s)
protected void debug(java.lang.String s)
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||