public class RemoteActorConnection extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.http.impl.nio.client.CloseableHttpAsyncClient |
asyncHttpClient |
protected ConcurrentHashMap<Long,Callback> |
callbackMap
callback id => promise or callback
|
protected org.nustaq.serialization.FSTConfiguration |
conf |
protected ConnectionListener |
connectionListener |
static boolean |
DumpProtocol |
protected String |
id |
protected AtomicLong |
idCount
used to generate unique ids for callbacks/promises/actors
|
protected boolean |
isConnected |
protected String |
jwt |
protected long |
lastPing |
protected int |
lastSeenSeq |
static int |
LONG_POLL_MAX_TIME |
static int |
MAX_CONN_PER_ROUTE |
static int |
MAX_CONN_TOTAL |
protected static ExecutorService |
myExec |
protected AtomicInteger |
openFutureRequests
number of unreplied 'ask' calls.
|
protected ArrayList<RemoteCallEntry> |
requests
buffered requests to be sent, will be batched
|
protected boolean |
requestUnderway |
protected String |
sessionId |
protected String |
sessionUrl |
protected long |
timeout |
protected static Timer |
timer |
| Constructor and Description |
|---|
RemoteActorConnection(ConnectionListener connectionListener)
create a default configures (json serialization, no shared refs, no pretty print)
|
RemoteActorConnection(ConnectionListener connectionListener,
boolean sharedRefs)
note that shared refs support requires the server to be also configured for json shared refs.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addRequest(RemoteCallEntry remoteCallEntry,
Promise res) |
protected void |
checkTimeout() |
void |
close() |
Promise<RemoteActor> |
connect(String url,
boolean longPoll) |
protected org.apache.http.client.methods.HttpPost |
createRequest(String url,
byte[] message) |
protected void |
delayed(Runnable runnable,
long millis)
util to semd delayed jobs to processing/callback thread
|
protected void |
disconnect(String s) |
org.apache.http.impl.nio.client.CloseableHttpAsyncClient |
getClient() |
ConnectionListener |
getConnectionListener() |
String |
getId() |
String |
getJwt() |
int |
getOpenFutureRequests() |
long |
getTimeout() |
RemoteActorConnection |
id(String id) |
protected void |
initConf(boolean sharedRefs) |
RemoteActorConnection |
jwt(String jwt) |
protected void |
log(String s) |
protected void |
log(Throwable e) |
protected void |
processDecodedResultArray(Object[] o) |
protected int |
processResponse(byte[] b) |
protected long |
registerCallback(Callback res) |
protected Promise<Integer> |
sendCallArray(Object[] req)
encodes amd semds (incl seqNo).
|
protected void |
sendRequests()
sends pending requests async.
|
void |
sendShortPoll()
send an empty request polling for messages on server side.
|
void |
setTimeout(long timeout) |
protected void |
startLongPoll() |
public static final int LONG_POLL_MAX_TIME
public static int MAX_CONN_PER_ROUTE
public static int MAX_CONN_TOTAL
public static boolean DumpProtocol
protected static org.apache.http.impl.nio.client.CloseableHttpAsyncClient asyncHttpClient
protected volatile boolean isConnected
protected org.nustaq.serialization.FSTConfiguration conf
protected static ExecutorService myExec
protected String sessionId
protected String sessionUrl
protected int lastSeenSeq
protected ConnectionListener connectionListener
protected volatile long timeout
protected long lastPing
protected String jwt
protected String id
protected ConcurrentHashMap<Long,Callback> callbackMap
protected AtomicLong idCount
protected boolean requestUnderway
protected ArrayList<RemoteCallEntry> requests
protected AtomicInteger openFutureRequests
protected static Timer timer
public RemoteActorConnection(ConnectionListener connectionListener)
connectionListener - public RemoteActorConnection(ConnectionListener connectionListener, boolean sharedRefs)
sharedRefs - public org.apache.http.impl.nio.client.CloseableHttpAsyncClient getClient()
public ConnectionListener getConnectionListener()
protected void initConf(boolean sharedRefs)
public long getTimeout()
public void setTimeout(long timeout)
public Promise<RemoteActor> connect(String url, boolean longPoll)
protected void startLongPoll()
protected void checkTimeout()
protected void delayed(Runnable runnable, long millis)
runnable - millis - protected void addRequest(RemoteCallEntry remoteCallEntry, Promise res)
public int getOpenFutureRequests()
public void sendShortPoll()
protected void sendRequests()
protected Promise<Integer> sendCallArray(Object[] req)
public String getJwt()
public String getId()
public RemoteActorConnection jwt(String jwt)
public RemoteActorConnection id(String id)
protected int processResponse(byte[] b)
public void close()
protected void disconnect(String s)
protected void processDecodedResultArray(Object[] o)
protected long registerCallback(Callback res)
protected void log(Throwable e)
protected void log(String s)
protected org.apache.http.client.methods.HttpPost createRequest(String url, byte[] message)
Copyright © 2017. All rights reserved.