Package one.nio.rpc
Class RpcClient
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<T>
-
- one.nio.pool.Pool<Socket>
-
- one.nio.pool.SocketPool
-
- one.nio.rpc.RpcClient
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Serializable,java.lang.AutoCloseable,java.lang.Cloneable,java.lang.Iterable<Socket>,java.lang.reflect.InvocationHandler,java.util.Collection<Socket>,java.util.Deque<Socket>,java.util.List<Socket>,java.util.Queue<Socket>,SocketPoolMXBean
public class RpcClient extends SocketPool implements java.lang.reflect.InvocationHandler
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StackTraceElementremoteMarkerElementprotected static byte[][]uidLocks-
Fields inherited from class one.nio.pool.SocketPool
connectTimeout, host, port, proxy, readTimeout, sslContext, thinLto, tos
-
Fields inherited from class one.nio.pool.Pool
closed, createdCount, fifo, initialCount, keepEmpty, maxCount, timeout, timeouts, waitingThreads
-
-
Constructor Summary
Constructors Constructor Description RpcClient(ConnectionString conn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddLocalStack(java.lang.Throwable e, java.lang.Object remoteRequest)java.lang.Objectinvoke(java.lang.Object request)java.lang.Objectinvoke(java.lang.Object request, int timeout)java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object... args)private java.lang.ObjectinvokeRaw(java.lang.Object request, int timeout)protected java.lang.ObjectinvokeServiceRequest(java.lang.Object request)protected voidprovideSerializer(Serializer serializer)protected SerializerrequestSerializer(long uid)private voidsendRequest(Socket socket, byte[] buffer, int timeout)private byte[]serialize(java.lang.Object request)protected static java.lang.ObjectuidLockFor(long uid)-
Methods inherited from class one.nio.pool.SocketPool
createObject, destroyObject, getBusyCount, getConnectTimeout, getFifo, getIdleCount, getMaxCount, getProxy, getReadTimeout, getSslContext, getTimeout, getTimeouts, getWaitingThreads, name, setConnectTimeout, setFifo, setMaxCount, setProperties, setProxy, setReadTimeout, setSslContext, setTimeout
-
Methods inherited from class one.nio.pool.Pool
borrowObject, close, initialize, invalidateAll, invalidateObject, isClosed, returnObject
-
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
Methods inherited from interface one.nio.pool.SocketPoolMXBean
invalidateAll, isClosed
-
-
-
-
Constructor Detail
-
RpcClient
public RpcClient(ConnectionString conn)
-
-
Method Detail
-
invoke
public java.lang.Object invoke(java.lang.Object request) throws java.lang.Exception- Throws:
java.lang.Exception
-
invoke
public java.lang.Object invoke(java.lang.Object request, int timeout) throws java.lang.Exception- Throws:
java.lang.Exception
-
addLocalStack
private void addLocalStack(java.lang.Throwable e, java.lang.Object remoteRequest)
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object... args) throws java.lang.Exception- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Exception
-
uidLockFor
protected static java.lang.Object uidLockFor(long uid)
-
provideSerializer
protected void provideSerializer(Serializer serializer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
requestSerializer
protected Serializer requestSerializer(long uid) throws java.lang.Exception
- Throws:
java.lang.Exception
-
invokeServiceRequest
protected java.lang.Object invokeServiceRequest(java.lang.Object request) throws java.lang.Exception- Throws:
java.lang.Exception
-
invokeRaw
private java.lang.Object invokeRaw(java.lang.Object request, int timeout) throws java.lang.Exception- Throws:
java.lang.Exception
-
serialize
private byte[] serialize(java.lang.Object request) throws java.io.IOException- Throws:
java.io.IOException
-
sendRequest
private void sendRequest(Socket socket, byte[] buffer, int timeout) throws java.io.IOException
- Throws:
java.io.IOException
-
-