py4j
Class DefaultGateway
java.lang.Object
py4j.DefaultGateway
- All Implemented Interfaces:
- Gateway
- Direct Known Subclasses:
- BufferGateway, DefaultSynchronizedGateway, ExampleGateway, StackGateway
public class DefaultGateway
- extends Object
- implements Gateway
Provides default implementation of a JavaGateway.
This class is not thread-safe. If the GatewayServer
allows multiple connections to the same gateway (acceptOnlyOne
== false), the javascript engine might be invoked by multiple threads with
unexpected consequences. The object and argument identifiers used by the
script engine are allocated in a thread-safe manner though.
If you plan to allow concurrent connections to a gateway, use
DefaultSynchronizedGateway
instead.
- Author:
- Barthelemy Dagenais
- See Also:
DefaultSynchronizedGateway
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultGateway
public DefaultGateway()
getMethodNames
public List<String> getMethodNames(Object obj)
- Specified by:
getMethodNames
in interface Gateway
getMethodNamesAsString
public String getMethodNamesAsString(Object obj)
- Specified by:
getMethodNamesAsString
in interface Gateway
shutdown
public void shutdown()
- Specified by:
shutdown
in interface Gateway
startup
public void startup()
- Specified by:
startup
in interface Gateway
getObject
public Object getObject(String objectId)
- Specified by:
getObject
in interface Gateway
isStarted
public boolean isStarted()
setStarted
public void setStarted(boolean isStarted)
getNextObjectId
protected String getNextObjectId()
getObjCounter
protected AtomicInteger getObjCounter()
getArgCounter
protected AtomicInteger getArgCounter()
putNewObject
protected String putNewObject(Object object)
getBindings
protected Bindings getBindings()
invoke
public ReturnObject invoke(String methodName,
String targetObjectId,
List<Argument> args)
- Specified by:
invoke
in interface Gateway
getReturnObject
public ReturnObject getReturnObject(Object object)
- Specified by:
getReturnObject
in interface Gateway
isPrimitiveObject
protected boolean isPrimitiveObject(Object object)
isList
protected boolean isList(Object object)