public class ObjectManager extends Object
Modifier and Type | Field and Description |
---|---|
protected static long |
EVICT_UNUSED_OBJECT_MANAGER_PERIOD_MS |
protected static long |
EVICT_UNUSED_OBJECT_MANAGER_TIMEOUT_MS
Timeout after which an unused
ObjectManager is evicted. |
protected static long |
EVICT_ZERO_REFERENCE_OBJECT_REFS_PERIOD_MS |
protected static long |
EVICT_ZERO_REFERENCE_OBJECT_REFS_TIMEOUT_MS
The other side must notify us that an object is actually used (by invoking
incRefCount(Object, Uid) )
within this timeout. |
Modifier | Constructor and Description |
---|---|
protected |
ObjectManager(Uid clientId) |
protected static final long EVICT_UNUSED_OBJECT_MANAGER_TIMEOUT_MS
ObjectManager
is evicted.
If a client is closed normally (or crashes) we must make sure that the object-references held
by this ObjectManager
in the server's JVM are released and can be garbage-collected.
Therefore, we track the last use timestamp (e.g.
update it when getInstance(Uid)
is called).
Periodically, all ObjectManager
s not being used for a time period longer than this timeout
are "forgotten" and thus both the ObjectManager
s and all the objects they hold can be
garbage-collected.
This timeout must be (significantly) longer than InverseInvoker.POLL_INVERSE_SERVICE_REQUEST_TIMEOUT_MS
to make sure, the long-polling of inverse-service-invocation-requests serves additionally as a keep-alive for
the server-side ObjectManager
.
protected static final long EVICT_UNUSED_OBJECT_MANAGER_PERIOD_MS
protected static final long EVICT_ZERO_REFERENCE_OBJECT_REFS_TIMEOUT_MS
incRefCount(Object, Uid)
)
within this timeout.
Thus, this timeout must be longer than the maximum time it ever takes to (1) transmit the entire object graph from here to the other side and (2) notify in the inverse direction (increment reference count).
Note, that the inverse notification is deferred for performance reasons!
IncDecRefCountQueue.INC_DEC_REF_COUNT_PERIOD_MS
thus must be significantly shorter than this timeout
here.
protected static final long EVICT_ZERO_REFERENCE_OBJECT_REFS_PERIOD_MS
protected ObjectManager(Uid clientId)
public static ObjectManager getInstance(Uid clientId)
@Deprecated public static void clearObjectManagers()
protected Date getLastUseDate()
public boolean isNeverEvict()
public void setNeverEvict(boolean neverEvict)
public Uid getClientId()
ObjectManager
. This is either the remote client talking to a server
or it is the server (when the remote client holds references e.g. to listeners or other callbacks for the server).public Object getContextObject(String key)
public void putContextObject(String key, Object object)
protected ObjectRef createObjectRef(Class<?> clazz)
public Object getObjectRefOrObject(Object object)
public ObjectRef getObjectRefOrCreate(Object object)
public ObjectRef getObjectRefOrFail(Object object)
public ObjectRef getObjectRef(Object object)
public Object getObjectOrFail(ObjectRef objectRef)
public void incRefCount(Object object, Uid refId)
public void decRefCount(Object object, Uid refId)
public RemoteObjectProxyManager getRemoteObjectProxyManager()
public ClassManager getClassManager()
public static boolean isObjectRefMappingEnabled(Object object)
public ReferenceJanitorRegistry getReferenceCleanerRegistry()
public boolean isClosed()
protected void assertNotClosed()
public void close()
Copyright © 2013–2019. All rights reserved.