|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.datasource.ExhibitDataTunnelSource.HIRPCCache
public static final class ExhibitDataTunnelSource.HIRPCCache
Cache/lock to improve performance of inbound RPC. Meant to be opaque to all but handleInboundRPC() and is used to provide a better overall responsiveness, especially from expensive calls by vetoing concurrent expensive calls and by cacheing the responses from especially expensive calls.
Not all possibilities are exploited, just those that in practice seem to be important.
Can be registered to free its own content automagically if the system is very short of memory.
| Field Summary | |
|---|---|
private Tuple.Triple<AllExhibitPropertiesDelta,CompressionLevel,ExhibitDataTunnelSource.RawPacket> |
_AEP_diff_response
Cache of extra-compressed AEP diff as tuple of longHash, compression format, and response packet for diff AEP fetch RPC; mutable. |
private Tuple.Pair<java.lang.Long,Tuple.Pair<CompressionLevel,ExhibitDataTunnelSource.RawPacket>> |
_AEP_extracomp_response
Cache of full extra-compressed AEP as tuple of longHash, compression format, and response packet for diff AEP fetch RPC; mutable. |
private Tuple.Pair<java.lang.Long,ExhibitDataTunnelSource.RawPacket> |
_AEP_response
Cache of current AEP as pair of longHash and response packet for simple AEP fetch RPC; mutable. |
private AllExhibitProperties |
aepPrev
Cache of previous AEP value to assist with AEP diffs; initially null. |
private long |
currentAEPResponseCreatedOrLastUsed
Time of creation / last use of basic AEP response; initially zero. |
private SoftReferenceMap<java.lang.Long,AllExhibitProperties> |
prevAEPs
Soft cache of older AEP values to assist with AEP diffs; never null. |
private java.util.concurrent.locks.ReentrantLock |
slowResponseLock
Lock to prevent servicing more than one very expensive call at once. |
| Constructor Summary | |
|---|---|
ExhibitDataTunnelSource.HIRPCCache()
|
|
| Method Summary | |
|---|---|
void |
run()
Can be called to purge most or all internal state when very short of memory. |
| 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.ReentrantLock slowResponseLock
private volatile long currentAEPResponseCreatedOrLastUsed
private volatile Tuple.Pair<java.lang.Long,ExhibitDataTunnelSource.RawPacket> _AEP_response
Elements of this pair are never null.
Marked volatile for safe multi-threaded access.
Currently held for at least for a minimum period, until the AEP fetched has a new hash, not for example held via a SoftReference since a SoftReference would probably be cleared too soon for this to be effective.
This is likely to be many MB in size.
private volatile Tuple.Pair<java.lang.Long,Tuple.Pair<CompressionLevel,ExhibitDataTunnelSource.RawPacket>> _AEP_extracomp_response
Elements of this tuple are never null.
Marked volatile for safe multi-threaded access.
Currently held for at least for a minimum period, until the AEP fetched has a new hash, not for example held via a SoftReference since a SoftReference would probably be cleared too soon for this to be effective.
This is likely to be many MB in size.
private volatile Tuple.Triple<AllExhibitPropertiesDelta,CompressionLevel,ExhibitDataTunnelSource.RawPacket> _AEP_diff_response
Elements of this tuple are never null.
Marked volatile for safe multi-threaded access.
Currently held for at least for a minimum period, until the AEP fetched has a new hash, not for example held via a SoftReference since a SoftReference would probably be cleared too soon for this to be effective.
This is likely relatively small.
private volatile AllExhibitProperties aepPrev
This should generally share most of its state with the current AEP and therefore should not represent a significant extra memory burden.
private final SoftReferenceMap<java.lang.Long,AllExhibitProperties> prevAEPs
Thread-safe cache of SoftReferences to older AEPs, mapped from the Long hash values.
Map is not auto-clear()ed on memory stress other than the individual SoftReferences themselves during GC.
It is possible to synchronise on this instance to exclude other activity.
| Constructor Detail |
|---|
public ExhibitDataTunnelSource.HIRPCCache()
| Method Detail |
|---|
public void run()
May not purge some elements which are not (or likely not) using significant memory but usually save a lot of time for us and for clients. To that end we try and estimate the space they are taking vs actual current free heap space.
run in interface java.lang.Runnable
|
DHD Multimedia Gallery V1.60.69 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||