public class DefaultDispatcher extends java.lang.Object implements Dispatcher
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_DISPATCH_INTERVAL| Constructor and Description |
|---|
DefaultDispatcher(EventCache eventCache,
Connectivity connectivity,
PacketFactory packetFactory,
PacketSender packetSender) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
To clear the dispatchers queue
|
boolean |
forceDispatch()
Starts the dispatcher for one cycle if it is currently not working.
|
void |
forceDispatchBlocking()
Dispatch all events in the EventCache and return only after the dispatch is complete.
|
int |
getConnectionTimeOut()
Connection timeout in milliseconds
|
boolean |
getDispatchGzipped() |
long |
getDispatchInterval() |
DispatchMode |
getDispatchMode() |
java.util.List<Packet> |
getDryRunTarget()
For debugging purposes
Mind thread-safety!
|
void |
setConnectionTimeOut(int timeOut)
Timeout when trying to establish connection and when trying to read a response.
|
void |
setDispatchGzipped(boolean dispatchGzipped)
Packets are collected and dispatched in batches.
|
void |
setDispatchInterval(long dispatchInterval)
Packets are collected and dispatched in batches, this intervals sets the pause between batches.
|
void |
setDispatchMode(DispatchMode dispatchMode) |
void |
setDryRunTarget(java.util.List<Packet> dryRunTarget)
For debugging purposes
When this is non null then instead of sending data over the network it will be written into this list.
|
void |
submit(TrackMe trackMe)
Submit for transmission
|
public DefaultDispatcher(EventCache eventCache, Connectivity connectivity, PacketFactory packetFactory, PacketSender packetSender)
public int getConnectionTimeOut()
getConnectionTimeOut in interface Dispatcherpublic void setConnectionTimeOut(int timeOut)
setConnectionTimeOut in interface DispatchertimeOut - timeout in millisecondspublic void setDispatchInterval(long dispatchInterval)
setDispatchInterval in interface DispatcherdispatchInterval - in millisecondspublic long getDispatchInterval()
getDispatchInterval in interface Dispatcherpublic void setDispatchGzipped(boolean dispatchGzipped)
setDispatchGzipped in interface DispatcherdispatchGzipped - booleanpublic boolean getDispatchGzipped()
getDispatchGzipped in interface Dispatcherpublic void setDispatchMode(DispatchMode dispatchMode)
setDispatchMode in interface Dispatcherpublic DispatchMode getDispatchMode()
getDispatchMode in interface Dispatcherpublic boolean forceDispatch()
forceDispatch in interface Dispatcherpublic void forceDispatchBlocking()
DispatcherforceDispatchBlocking in interface Dispatcherpublic void clear()
Dispatcherclear in interface Dispatcherpublic void submit(TrackMe trackMe)
Dispatchersubmit in interface Dispatcherpublic void setDryRunTarget(java.util.List<Packet> dryRunTarget)
DispatchersetDryRunTarget in interface Dispatcherpublic java.util.List<Packet> getDryRunTarget()
DispatchergetDryRunTarget in interface Dispatcher