|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.jeri.internal.runtime.JvmLifeSupport
public class JvmLifeSupport
This class maintains a thread if necessary, in the wait state, to prevent the jvm shutting down while remote objects hold strong references in the DGC. This implementation is more about scalability than performance, when a jvm only has a small number of remote objects exported, blocking is not likely to cause a performance problem, access to keepAliveCount blocked. However with very large numbers of remote objects exported, in a dynamic environment, blocking is unlikely to be an issue, in this case the read locks will remain uncontended as the blocking write lock is only required as the number of exported object approach zero. If the thread is interrupted, it will pass away, regardless of the number of objects exported.
Field Summary | |
---|---|
private java.util.concurrent.atomic.AtomicInteger |
keepAliveCount
number of objects exported with keepAlive == true |
private Thread |
keeper
thread to keep VM alive while keepAliveCount > 0 |
private java.util.concurrent.locks.Lock |
rl
|
private java.util.concurrent.locks.ReadWriteLock |
rwl
lock guarding keepAliveCount and keeper |
private java.util.concurrent.locks.Lock |
wl
|
Constructor Summary | |
---|---|
JvmLifeSupport()
|
Method Summary | |
---|---|
private void |
check()
|
(package private) void |
decrementKeepAliveCount()
Decrements the count of objects exported with keepAlive true, stopping the non-daemon thread if decremented to zero. |
(package private) void |
incrementKeepAliveCount()
Increments the count of objects exported with keepAlive true, starting a non-daemon thread if necessary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.util.concurrent.locks.ReadWriteLock rwl
private final java.util.concurrent.locks.Lock rl
private final java.util.concurrent.locks.Lock wl
private final java.util.concurrent.atomic.AtomicInteger keepAliveCount
private volatile Thread keeper
Constructor Detail |
---|
JvmLifeSupport()
Method Detail |
---|
void incrementKeepAliveCount()
void decrementKeepAliveCount()
private void check()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |