V - public abstract class ReconfigurableAppClientAsync<V> extends java.lang.Object implements GigaPaxosClient<V>, AppRequestParser
| Modifier and Type | Class and Description |
|---|---|
class |
ReconfigurableAppClientAsync.BlockingRequestCallback
[ *
|
static class |
ReconfigurableAppClientAsync.ReconfigurationException |
| Modifier and Type | Field and Description |
|---|---|
static long |
CONNECTIVITY_CHECK_TIMEOUT
Default connectivity check timeout.
|
static long |
DEFAULT_GC_TIMEOUT
The default timeout for
ClientRequest as well as
ClientReconfigurationPacket requests. |
| Constructor and Description |
|---|
ReconfigurableAppClientAsync() |
ReconfigurableAppClientAsync(java.util.Set<java.net.InetSocketAddress> reconfigurators) |
ReconfigurableAppClientAsync(java.util.Set<java.net.InetSocketAddress> reconfigurators,
boolean checkConnectivity) |
ReconfigurableAppClientAsync(java.util.Set<java.net.InetSocketAddress> reconfigurators,
SSLDataProcessingWorker.SSL_MODES sslMode,
int clientPortOffset,
boolean checkConnectivity)
The constructor specifies the default set of reconfigurators.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkConnectivity()
A connectivity check with every known reconfigurator each with a default
timeout of
CONNECTIVITY_CHECK_TIMEOUT. |
protected boolean |
checkConnectivity(long timeout,
java.net.InetSocketAddress address)
Connectivity check with reconfigurator
address that will block
for up to timeout duration. |
protected boolean |
checkConnectivity(long attemptTimeout,
int numAttempts,
java.net.InetSocketAddress address)
Connectivity check that will be attempted up to
numAttempts times
each with a timeout of attemptTimeout with the reconfigurator
address. |
void |
close() |
ReconfigurableAppClientAsync<V> |
enableJSONPackets()
If true, the app will only be handed JSON formatted packets via
getJSONRequest(), not via
AppRequestParser.getRequest(String). |
java.util.Set<java.net.InetSocketAddress> |
getDefaultServers() |
protected java.lang.String |
getLabel() |
protected static void |
getMaxOutstandingCRPRequests(int n) |
Request |
getRequestFromJSON(org.json.JSONObject json) |
static void |
main(java.lang.String[] args) |
void |
sendReconfigurationRequest(ReconfigurationPacket.PacketType type,
java.lang.String name,
java.lang.String initialState,
RequestCallback callback) |
RequestFuture<ClientReconfigurationPacket> |
sendRequest(ClientReconfigurationPacket request) |
ClientReconfigurationPacket |
sendRequest(ClientReconfigurationPacket request,
long timeout) |
RequestFuture<ClientReconfigurationPacket> |
sendRequest(ClientReconfigurationPacket request,
RequestCallback callback)
This method exists for backwards compatibility and is slated for deprecation.
|
RequestFuture<V> |
sendRequest(ClientRequest request,
Callback<Request,V> callback) |
RequestFuture<V> |
sendRequest(ClientRequest request,
Callback<Request,V> callback,
NearestServerSelector redirector)
Sends
request to the nearest server as determined by
redirector, an interface that returns the nearest server from a
set of server addresses. |
Request |
sendRequest(ClientRequest request,
java.net.InetSocketAddress server) |
RequestFuture<V> |
sendRequest(ClientRequest request,
java.net.InetSocketAddress server,
Callback<Request,V> callback)
Sends
request to the specified server. |
Request |
sendRequest(ClientRequest request,
java.net.InetSocketAddress server,
long timeout) |
Request |
sendRequest(Request request)
A blocking method to retrieve the result of executing
request. |
RequestFuture<V> |
sendRequest(Request request,
Callback<Request,V> callback)
This method will convert an app request to a
ReplicableClientRequest and then send the request. |
Request |
sendRequest(Request request,
long timeout) |
void |
sendRequest(ServerReconfigurationPacket<?> rcPacket,
RequestCallback callback)
Server reconfiguration packets have to be privileged, so we authenticate
them implicitly by listening for them only on the server-server
MUTUAL_AUTH port.
|
Request |
sendRequestAnycast(ClientRequest request) |
RequestFuture<V> |
sendRequestAnycast(ClientRequest request,
Callback<Request,V> callback) |
Request |
sendRequestAnycast(ClientRequest request,
long timeout) |
void |
setGCTimeout(long timeout) |
protected static void |
setMaxOutstandingAppRequests(int n) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetMutualAuthRequestTypes, getRequest, getRequest, getRequestTypes, getServerAuthRequestTypespublic static final long DEFAULT_GC_TIMEOUT
ClientRequest as well as
ClientReconfigurationPacket requests.public static final long CONNECTIVITY_CHECK_TIMEOUT
public ReconfigurableAppClientAsync(java.util.Set<java.net.InetSocketAddress> reconfigurators,
SSLDataProcessingWorker.SSL_MODES sslMode,
int clientPortOffset,
boolean checkConnectivity)
throws java.io.IOException
reconfigurators - sslMode - clientPortOffset - checkConnectivity - If true, a connectivity check with at least one reconfigurator
will be enforced and an exception will be thrown if
unsuccessful.java.io.IOExceptionpublic ReconfigurableAppClientAsync(java.util.Set<java.net.InetSocketAddress> reconfigurators)
throws java.io.IOException
reconfigurators - java.io.IOExceptionpublic ReconfigurableAppClientAsync(java.util.Set<java.net.InetSocketAddress> reconfigurators,
boolean checkConnectivity)
throws java.io.IOException
reconfigurators - checkConnectivity - java.io.IOExceptionpublic ReconfigurableAppClientAsync()
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getLabel()
protected static void setMaxOutstandingAppRequests(int n)
protected static void getMaxOutstandingCRPRequests(int n)
public final void setGCTimeout(long timeout)
timeout - public Request sendRequest(Request request) throws java.io.IOException
GigaPaxosClientrequest.sendRequest in interface GigaPaxosClient<V>request - java.io.IOExceptionpublic Request sendRequest(Request request, long timeout) throws java.io.IOException
request - timeout - java.io.IOExceptionpublic RequestFuture<V> sendRequest(Request request, Callback<Request,V> callback) throws java.io.IOException
ReplicableClientRequest and then send the request.sendRequest in interface GigaPaxosClient<V>request - callback - java.io.IOExceptionpublic Request sendRequest(ClientRequest request, java.net.InetSocketAddress server) throws java.io.IOException
request - server - request.java.io.IOExceptionpublic Request sendRequest(ClientRequest request, java.net.InetSocketAddress server, long timeout) throws java.io.IOException
request - server - timeout - request.java.io.IOExceptionpublic RequestFuture<V> sendRequest(ClientRequest request, java.net.InetSocketAddress server, Callback<Request,V> callback) throws java.io.IOException
GigaPaxosClientrequest to the specified server.sendRequest in interface GigaPaxosClient<V>request - server - callback - java.io.IOExceptionpublic void sendReconfigurationRequest(ReconfigurationPacket.PacketType type, java.lang.String name, java.lang.String initialState, RequestCallback callback) throws java.io.IOException
type - name - initialState - Used only if type is
ReconfigurationPacket.PacketType.CREATE_SERVICE_NAME
.callback - java.io.IOExceptionpublic void sendRequest(ServerReconfigurationPacket<?> rcPacket, RequestCallback callback) throws java.io.IOException
rcPacket - callback - java.io.IOExceptionpublic RequestFuture<ClientReconfigurationPacket> sendRequest(ClientReconfigurationPacket request) throws java.io.IOException, ReconfigurableAppClientAsync.ReconfigurationException
request - request.java.io.IOExceptionReconfigurableAppClientAsync.ReconfigurationExceptionpublic ClientReconfigurationPacket sendRequest(ClientReconfigurationPacket request, long timeout) throws java.io.IOException, ReconfigurableAppClientAsync.ReconfigurationException
request - timeout - Timeout period in milliseconds; 0 means infinity.request.java.io.IOExceptionReconfigurableAppClientAsync.ReconfigurationExceptionpublic RequestFuture<ClientReconfigurationPacket> sendRequest(ClientReconfigurationPacket request, RequestCallback callback) throws java.io.IOException
request - callback - java.io.IOExceptionpublic RequestFuture<V> sendRequest(ClientRequest request, Callback<Request,V> callback) throws java.io.IOException
sendRequest in interface GigaPaxosClient<V>request - callback - java.io.IOExceptionpublic Request sendRequestAnycast(ClientRequest request) throws java.io.IOException
request - request.java.io.IOExceptionpublic Request sendRequestAnycast(ClientRequest request, long timeout) throws java.io.IOException
request - timeout - request.java.io.IOExceptionpublic RequestFuture<V> sendRequestAnycast(ClientRequest request, Callback<Request,V> callback) throws java.io.IOException
request - callback - java.io.IOExceptionpublic RequestFuture<V> sendRequest(ClientRequest request, Callback<Request,V> callback, NearestServerSelector redirector) throws java.io.IOException
GigaPaxosClientrequest to the nearest server as determined by
redirector, an interface that returns the nearest server from a
set of server addresses.sendRequest in interface GigaPaxosClient<V>request - callback - redirector - java.io.IOExceptionprotected boolean checkConnectivity(long timeout,
java.net.InetSocketAddress address)
address that will block
for up to timeout duration. If address is null, the check
will be performed against a random reconfigurator.timeout - address - protected boolean checkConnectivity(long attemptTimeout,
int numAttempts,
java.net.InetSocketAddress address)
numAttempts times
each with a timeout of attemptTimeout with the reconfigurator
address. If address is null, a random reconfigurator will
be chosen for each attempt.attemptTimeout - numAttempts - address - public void checkConnectivity()
throws java.io.IOException
CONNECTIVITY_CHECK_TIMEOUT.java.io.IOExceptionpublic void close()
public java.util.Set<java.net.InetSocketAddress> getDefaultServers()
public java.lang.String toString()
toString in class java.lang.Objectpublic Request getRequestFromJSON(org.json.JSONObject json) throws RequestParseException
json - jsonRequestParseExceptionpublic ReconfigurableAppClientAsync<V> enableJSONPackets()
AppRequestParser.getRequest(String). If this method is
invoked, the protected method #getJSONRequest(JSONObject) must be
overridden.this.public static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.InterruptedException
args - java.io.IOExceptionjava.lang.InterruptedException