|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cometd.server.AbstractServerTransport
public abstract class AbstractServerTransport
The base class of all server transports.
Each derived Transport class should declare all options that it supports
by calling setOption(String, Object) for each option.
Then during the call the init(), each transport should
call the variants of getOption(String) to obtained the configured
value for the option.
| Nested Class Summary | |
|---|---|
static interface |
AbstractServerTransport.OneTimeScheduler
|
static interface |
AbstractServerTransport.Scheduler
|
| Field Summary | |
|---|---|
static String |
INTERVAL_OPTION
|
static String |
MAX_INTERVAL_OPTION
|
static String |
MAX_LAZY_OPTION
|
static String |
META_CONNECT_DELIVERY_OPTION
|
static String |
TIMEOUT_OPTION
|
| Constructor Summary | |
|---|---|
protected |
AbstractServerTransport(BayeuxServerImpl bayeux,
String name)
Construct a ServerTransport. |
| Method Summary | |
|---|---|
Object |
getAdvice()
|
BayeuxServerImpl |
getBayeux()
Get the bayeux. |
long |
getInterval()
Get the interval. |
long |
getMaxInterval()
Get the maxInterval. |
long |
getMaxLazyTimeout()
Get the max time before dispatching lazy message. |
String |
getName()
|
Object |
getOption(String name)
Get an option value. |
boolean |
getOption(String option,
boolean dftValue)
Get option or default value. |
int |
getOption(String option,
int dftValue)
Get option or default value. |
long |
getOption(String option,
long dftValue)
Get option or default value. |
String |
getOption(String option,
String dftValue)
Get option or default value. |
Set<String> |
getOptionNames()
|
String |
getOptionPrefix()
|
long |
getTimeout()
Get the timeout. |
protected void |
init()
Initialise the transport. |
boolean |
isMetaConnectDeliveryOnly()
|
void |
setAdvice(Object advice)
Set the advice. |
void |
setInterval(long interval)
Set the interval. |
void |
setMaxInterval(long maxInterval)
Set the maxInterval. |
void |
setMaxLazyTimeout(long maxLazyTimeout)
Set the maxLazyTimeout. |
void |
setMetaConnectDeliveryOnly(boolean meta)
|
void |
setOption(String name,
Object value)
|
void |
setOptionPrefix(String prefix)
Set the option name prefix segment. |
void |
setTimeout(long timeout)
Set the timeout. |
protected void |
sweep()
Housekeeping sweep, called a regular intervals |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.cometd.bayeux.server.ServerTransport |
|---|
getContext, getCurrentLocalAddress, getCurrentRemoteAddress |
| Field Detail |
|---|
public static final String TIMEOUT_OPTION
public static final String INTERVAL_OPTION
public static final String MAX_INTERVAL_OPTION
public static final String MAX_LAZY_OPTION
public static final String META_CONNECT_DELIVERY_OPTION
| Constructor Detail |
|---|
protected AbstractServerTransport(BayeuxServerImpl bayeux,
String name)
The construct is passed the BayeuxServerImpl instance for
the transport. The BayeuxServerImpl.getOptions() map is
populated with the default options known by this transport. The options
are then inspected again when init() is called, to set the
actual values used. The options are arranged into a naming hierarchy
by derived classes adding prefix segments by calling add #addPrefix(String).
Calls to getOption(String) will use the list of prefixes
to search for the most specific option set.
| Method Detail |
|---|
public Object getAdvice()
getAdvice in interface ServerTransportpublic long getInterval()
getInterval in interface ServerTransportpublic long getMaxInterval()
getMaxInterval in interface ServerTransportpublic long getMaxLazyTimeout()
getMaxLazyTimeout in interface ServerTransportpublic String getName()
getName in interface TransportTransport.getName()public Object getOption(String name)
BayeuxServerImpl.getOptions() is
searched for the option name with the most specific prefix.
If this transport was initialised with calls:
addPrefix("long-polling");
addPrefix("jsonp");
then a call to getOption("foobar") will look for the
most specific value with names:long-polling.json.foobar long-polling.foobar foobar
getOption in interface Transport
public boolean getOption(String option,
boolean dftValue)
option - The option name.dftValue - The default value.
getOption(String)
public int getOption(String option,
int dftValue)
option - The option name.dftValue - The default value.
getOption(String)
public long getOption(String option,
long dftValue)
option - The option name.dftValue - The default value.
getOption(String)
public String getOption(String option,
String dftValue)
option - The option name.dftValue - The default value.
getOption(String)public Set<String> getOptionNames()
getOptionNames in interface TransportAbstractTransport.getOptionNames()public String getOptionPrefix()
getOptionPrefix in interface Transportpublic void setOptionPrefix(String prefix)
Normally this is called by the super class constructors to establish
a naming hierarchy for options and iteracts with the setOption(String, Object)
method to create a naming hierarchy for options.
For example the following sequence of calls:
setOption("foo","x");
setOption("bar","y");
setOptionPrefix("long-polling");
setOption("foo","z");
setOption("whiz","p");
setOptionPrefix("long-polling.jsonp");
setOption("bang","q");
setOption("bar","r");
will establish the following option names and values:foo: x bar: y long-polling.foo: z long-polling.whiz: p long-polling.jsonp.bang: q long-polling.jsonp.bar: rThe various
getOption(String) methods will search this
name tree for the most specific match.
segment - name
IllegalArgumentException - if the new prefix is not prefixed by the old prefix.public long getTimeout()
getTimeout in interface ServerTransportpublic boolean isMetaConnectDeliveryOnly()
isMetaConnectDeliveryOnly in interface ServerTransportpublic void setMetaConnectDeliveryOnly(boolean meta)
public void setOption(String name,
Object value)
name - value - protected void init()
#getMutableOptions() set should
be reset to reflect only the options that can be changed on a running
transport.
This implementation clears the mutable options set.
public BayeuxServerImpl getBayeux()
public void setInterval(long interval)
interval - the interval to setpublic void setMaxInterval(long maxInterval)
maxInterval - the maxInterval to setpublic void setTimeout(long timeout)
timeout - the timeout to setpublic void setMaxLazyTimeout(long maxLazyTimeout)
maxLazyTimeout - the maxLazyTimeout to setpublic void setAdvice(Object advice)
advice - the advice to setprotected void sweep()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||