|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.cometd.client.BayeuxClient
public class BayeuxClient
Bayeux protocol Client.
Implements a Bayeux Ajax Push client as part of the cometd project.
The HttpClient attributes are used to share a Timer and MessagePool instance between all Bayeux clients sharing the same HttpClient.
http://cometd.org| Nested Class Summary | |
|---|---|
protected class |
BayeuxClient.Connect
The Bayeux Connect exchange. |
protected class |
BayeuxClient.Exchange
The base class for all bayeux exchanges. |
protected class |
BayeuxClient.Handshake
The Bayeux handshake exchange. |
protected class |
BayeuxClient.Publish
Publish message exchange. |
| Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener |
| Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
|---|
org.eclipse.jetty.util.component.LifeCycle.Listener |
| Field Summary | |
|---|---|
protected MessagePool |
_msgPool
|
| Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| Constructor Summary | |
|---|---|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
String uri)
|
|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
String path,
Timer timer)
|
|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
String url)
|
|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
String url,
Timer timer)
|
|
| Method Summary | |
|---|---|
void |
abort()
Aborts the connection with the server without disconnecting. |
void |
addExtension(Extension ext)
|
void |
addListener(ClientListener listener)
|
protected void |
customize(org.eclipse.jetty.client.HttpExchange exchange)
Customize an Exchange. |
void |
deliver(Client from,
Message message)
(non-Javadoc) |
void |
deliver(Client from,
String toChannel,
Object data,
String id)
|
void |
disconnect()
Disconnect this client. |
protected void |
doStart()
|
protected void |
doStop()
|
void |
endBatch()
|
protected void |
extendIn(Message message)
Called to extend inbound messages |
protected void |
extendOut(Message message)
Called to extend outbound messages |
protected String |
extendOut(String msg)
Called to extend outbound string messages. |
int |
getBackoffIncrement()
|
int |
getBackoffInterval()
|
int |
getBackoffMaxInterval()
|
int |
getBackoffMaxRetries()
Deprecated. |
javax.servlet.http.Cookie |
getCookie(String name)
|
String |
getId()
|
Listener |
getListener()
Deprecated. |
int |
getMaxQueue()
|
Queue<Message> |
getQueue()
|
boolean |
hasMessages()
|
protected boolean |
isInitialized()
|
boolean |
isLocal()
|
boolean |
isPolling()
|
protected void |
metaConnect(boolean success,
Message message)
Called with the results of a /meta/connect message |
protected void |
metaHandshake(boolean success,
boolean reestablish,
Message message)
Called with the results of a /meta/handshake message |
protected void |
metaPublishFail(Throwable e,
Message[] messages)
Called with the results of a failed publish |
void |
publish(String toChannel,
Object data,
String msgId)
|
void |
remove()
Deprecated. use disconnect() |
void |
removeExtension(Extension ext)
|
void |
removeListener(ClientListener listener)
|
protected boolean |
send(BayeuxClient.Exchange exchange,
boolean backoff)
Send the exchange, possibly using a backoff. |
protected void |
send(org.eclipse.jetty.client.HttpExchange exchange)
Send the exchange. |
void |
setBackoffIncrement(int interval)
. |
void |
setBackOffInterval(int interval)
If unable to connect/handshake etc, even if following the interval in the advice, wait for this interval initially, and try again. |
void |
setBackoffMaxInterval(int interval)
|
void |
setBackoffMaxRetries(int retries)
Deprecated. We retry an infinite number of times. use getBackoffIncrement() to set limits |
void |
setCookie(javax.servlet.http.Cookie cookie)
|
protected void |
setInitialized(boolean value)
False when we have received a success=false message in response to a Connect, or we have had an exception when sending or receiving a Connect. |
void |
setListener(Listener listener)
Deprecated. |
void |
setMaxQueue(int max)
|
void |
startBatch()
|
void |
subscribe(String toChannel)
|
List<Message> |
takeMessages()
|
void |
unsubscribe(String toChannel)
|
| Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected MessagePool _msgPool
| Constructor Detail |
|---|
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
String url)
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
String url,
Timer timer)
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
String path,
Timer timer)
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
String uri)
| Method Detail |
|---|
public void addExtension(Extension ext)
addExtension in interface Clientpublic void removeExtension(Extension ext)
removeExtension in interface Clientpublic void setBackOffInterval(int interval)
interval - the time to wait before retrying in millisecondspublic int getBackoffInterval()
public void setBackoffMaxRetries(int retries)
getBackoffIncrement() to set limits
retries - the max number of retriespublic int getBackoffMaxRetries()
public void setBackoffIncrement(int interval)
getBackoffMaxInterval()
interval - the interval to increase the backoff, in millisecondspublic int getBackoffIncrement()
public void setBackoffMaxInterval(int interval)
public int getBackoffMaxInterval()
public String getId()
getId in interface Client
protected void doStart()
throws Exception
doStart in class org.eclipse.jetty.util.component.AbstractLifeCycleException
protected void doStop()
throws Exception
doStop in class org.eclipse.jetty.util.component.AbstractLifeCycleExceptionpublic void abort()
disconnecting.
public boolean isPolling()
public void deliver(Client from,
Message message)
from - The client from which the message arrives or null if no such client can be identifiedmessage - The message to deliver
public void deliver(Client from,
String toChannel,
Object data,
String id)
deliver in interface Clientpublic Listener getListener()
public boolean hasMessages()
hasMessages in interface Clientpublic boolean isLocal()
isLocal in interface Client
public void publish(String toChannel,
Object data,
String msgId)
public void subscribe(String toChannel)
public void unsubscribe(String toChannel)
public void remove()
disconnect()
public void disconnect()
disconnect in interface Clientpublic void setListener(Listener listener)
listener - The listenerpublic List<Message> takeMessages()
takeMessages in interface Clientpublic void endBatch()
endBatch in interface Clientpublic void startBatch()
startBatch in interface Clientprotected void customize(org.eclipse.jetty.client.HttpExchange exchange)
exchange - The exchange to customizepublic void setCookie(javax.servlet.http.Cookie cookie)
public javax.servlet.http.Cookie getCookie(String name)
public void addListener(ClientListener listener)
addListener in interface Clientpublic void removeListener(ClientListener listener)
removeListener in interface Clientpublic int getMaxQueue()
getMaxQueue in interface Clientpublic Queue<Message> getQueue()
getQueue in interface Clientpublic void setMaxQueue(int max)
setMaxQueue in interface Client
protected boolean send(BayeuxClient.Exchange exchange,
boolean backoff)
exchange - The exchange to sendbackoff - if true, use backoff algorithm to send
protected void send(org.eclipse.jetty.client.HttpExchange exchange)
throws IOException
exchange - The exchange to send
IOException - If the send failsprotected void setInitialized(boolean value)
value - the value for initializedprotected boolean isInitialized()
protected void metaConnect(boolean success,
Message message)
success - Whether the connect response is successfulmessage - The connect response
protected void metaHandshake(boolean success,
boolean reestablish,
Message message)
success - Whether the handshake response is successfulreestablish - Whether the client was previously connectedmessage - The handshake response
protected void metaPublishFail(Throwable e,
Message[] messages)
e - The exception that caused the failuremessages - The messages that could not be sentprotected String extendOut(String msg)
extendOut(Message) method to efficiently cater for these
preformatted strings.
This method calls the Extensions added by addExtension(Extension)
msg - The message to pass through extensions
protected void extendOut(Message message)
This method calls the Extensions added by addExtension(Extension)
message - The message to pass through the extensionsprotected void extendIn(Message message)
This method calls the Extensions added by addExtension(Extension)
message - The message to pass through the extensions
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||