public class RemoteMultiplexerServer extends Object
Different ways to create a remote object:
Constructor and Description |
---|
RemoteMultiplexerServer(MultiplexerServer server)
Create a new RemoteServer using multiplexer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_invokeByRemoteThread(OARemoteThread rt,
RequestInfo ri,
com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session session) |
protected void |
afterInvokeForCtoS(RequestInfo ri)
Called after a CtoS remote method is called.
|
protected void |
afterInvokeForStoC(RequestInfo ri)
Called after a StoC remote method is called.
|
Object |
createBroadcast(String bindName,
Class interfaceClass,
String queueName,
int queueSize) |
Object |
createBroadcast(String bindName,
Object callback,
Class interfaceClass,
String queueName,
int queueSize)
Allows sending messages to server and all clients.
|
void |
createLookup(String name,
Object obj,
Class interfaceClass)
Register/Bind an Object so that it can be used by clients
|
void |
createLookup(String name,
Object obj,
Class interfaceClass,
String queueName,
int queueSize) |
protected Object |
createProxyForStoC(com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session session,
Class c,
String bindName)
This will create a server side proxy instance for a remote object sent from a client.
|
void |
createSession(Socket socket,
int connectionId)
This can be called when MultiplexerServer.onClientConnect(..) is called.
|
protected BindInfo |
getBindInfo(BindInfo biParent,
String name,
Object obj,
Class interfaceClass,
boolean bDontUseQueue) |
protected BindInfo |
getBindInfo(BindInfo biParent,
String name,
Object obj,
Class interfaceClass,
boolean bIsBroadcast,
String queueName,
int queueSize,
boolean bDontUseQueue) |
protected BindInfo |
getBindInfo(Object obj)
Get the Bind information for a remote object.
|
protected BindInfo |
getBindInfo(String name)
Get the Bind information for the name assigned to a remote object.
|
protected BindInfo |
getBindInfo(String name,
Object obj,
Class interfaceClass,
String queueName,
int queueSize) |
long |
getMethodCallCount()
number of remote methods called.
|
MultiplexerServer |
getMultiplexerServer() |
long |
getQueueHeadPos() |
long |
getReceivedMethodCount() |
com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session |
getSession(int connectionId,
boolean bCreateIfNull) |
protected void |
invokeUsingRemoteThread(RequestInfo ri,
boolean bFromServerQueueThread)
This will have the currentThread wait for a RemoteThread to process the request using invokeCtoS _invokeCtoS
|
protected void |
notifyMethodInvoked(RequestInfo ri) |
protected void |
notifyProcessedByServer(RequestInfo ri) |
protected void |
onException(int connectionId,
String title,
String msg,
Exception e,
boolean bWillDisconnect) |
protected RequestInfo |
onInvokeBroadcast(BindInfo bind,
Method method,
Object[] args) |
protected Object |
onInvokeForStoC(Object proxyInstance,
com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session session,
String bindName,
Method method,
Object[] args) |
protected void |
onNewConnectionForCtoS(Socket socket) |
protected void |
onNewConnectionForStoC(Socket socket)
a client has created a new server to client (StoC) vsocket, that can be used for the server to
call methods on a client's remote object.
|
void |
performDGC() |
protected void |
processSocketCtoS(VirtualSocket socket) |
boolean |
removeLookup(String name)
Remove an object that was previously used for a bind.
|
void |
removeSession(int connectionId)
This can be called when MultiplexerServer.onClientDisconnect(..) is called.
|
protected void |
setupBroadcastQueueReader(String asyncQueueName,
String bindName) |
void |
start()
starts serverSockets for remote messages.
|
protected void |
startServerSocketForCtoS() |
protected void |
startServerSocketForStoC()
VServerSocket that is used for vsockets that are used when a method is called on the server that
needs to be invoked on the client where the object came from.
|
protected boolean |
waitForMethodInvoked(RequestInfo ri) |
protected boolean |
waitForMethodInvoked(RequestInfo ri,
int maxSeconds) |
protected void |
waitForProcessedByServer(RequestInfo ri) |
public RemoteMultiplexerServer(MultiplexerServer server)
public MultiplexerServer getMultiplexerServer()
public void removeSession(int connectionId)
public void createSession(Socket socket, int connectionId)
public com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session getSession(int connectionId, boolean bCreateIfNull)
public void start() throws Exception
Exception
to have the server allow for client connections.
protected void startServerSocketForCtoS() throws Exception
Exception
protected void onNewConnectionForCtoS(Socket socket)
protected void processSocketCtoS(VirtualSocket socket) throws Exception
Exception
protected void afterInvokeForCtoS(RequestInfo ri)
protected void startServerSocketForStoC() throws Exception
Exception
protected void onNewConnectionForStoC(Socket socket)
protected Object createProxyForStoC(com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session session, Class c, String bindName)
protected Object onInvokeForStoC(Object proxyInstance, com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session session, String bindName, Method method, Object[] args) throws Exception
Exception
protected void afterInvokeForStoC(RequestInfo ri)
public void performDGC()
public void createLookup(String name, Object obj, Class interfaceClass)
name
- obj
- remote object to createinterfaceClass
- Important: a weakref is used to store the remote object "obj"public void createLookup(String name, Object obj, Class interfaceClass, String queueName, int queueSize)
name
- obj
- interfaceClass
- queueName
- used to have return value use an async circular queue for responses.queueSize
- public boolean removeLookup(String name)
protected BindInfo getBindInfo(String name)
protected BindInfo getBindInfo(Object obj)
protected BindInfo getBindInfo(BindInfo biParent, String name, Object obj, Class interfaceClass, boolean bDontUseQueue)
protected BindInfo getBindInfo(String name, Object obj, Class interfaceClass, String queueName, int queueSize)
protected BindInfo getBindInfo(BindInfo biParent, String name, Object obj, Class interfaceClass, boolean bIsBroadcast, String queueName, int queueSize, boolean bDontUseQueue)
public Object createBroadcast(String bindName, Class interfaceClass, String queueName, int queueSize)
public Object createBroadcast(String bindName, Object callback, Class interfaceClass, String queueName, int queueSize)
bindName
- name for clients to use to lookup the objectcallback
- object to use when receiving a broadcast from a clientinterfaceClass
- queueName
- name of circularQueue used to hold messagesqueueSize
- size of circularQueueprotected RequestInfo onInvokeBroadcast(BindInfo bind, Method method, Object[] args) throws Exception
Exception
protected void setupBroadcastQueueReader(String asyncQueueName, String bindName)
protected void invokeUsingRemoteThread(RequestInfo ri, boolean bFromServerQueueThread) throws Exception
Exception
protected void _invokeByRemoteThread(OARemoteThread rt, RequestInfo ri, com.viaoa.remote.multiplexer.RemoteMultiplexerServer.Session session) throws Exception
Exception
protected void onException(int connectionId, String title, String msg, Exception e, boolean bWillDisconnect)
protected void notifyMethodInvoked(RequestInfo ri)
protected boolean waitForMethodInvoked(RequestInfo ri)
protected boolean waitForMethodInvoked(RequestInfo ri, int maxSeconds)
protected void notifyProcessedByServer(RequestInfo ri)
protected void waitForProcessedByServer(RequestInfo ri)
public long getMethodCallCount()
public long getReceivedMethodCount()
public long getQueueHeadPos()
Copyright © 1999–2019 ViaOA. All rights reserved.