ResourcePool interface, providing
bookkeeping for the managed() method and support for sharing
resources amongst multiple pools.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | |
| private static final int | |
| pack-priv long | |
| private final Thread | |
| pack-priv final long | |
| pack-priv final long | |
| private static final int | |
| private static final int | |
| private BaseResourcePool. | |
| pack-priv final ResourcePool | |
| private static final String[] | |
| private static final BaseResourcePool. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: boolean indicating if the requested space is now availableClean up the resources in the indicated pool using a standard algorithm until at least the specified amount of resource units have been reclaimed. |
| private void | |
| pack-priv static String | |
| public void | freeDisposalRequestedAndCheckResources(boolean
true if the caller wishes to forgive
and unlock all outstanding locks on non-permanent resourcesImplements com. Check that all resources are in the correct state for an idle condition and free any resources which were disposed from a non-resource thread. |
| public boolean | isManagerThread()
Implements com. True if Thread.currentThread() is a thread that created this ResourcePool |
| public final long | managed()
Implements com. The amount of this resource currently being used to hold managed resources. |
| public final long | max()
Implements com. The total space available in this pool for allocating any kind of resource, even unmanaged resources, and including those resources already allocated. |
| public final long | origTarget()
Implements com. The initial target of the maximum amount of space in this resource pool that should be used so as to be friendly to other parts of the system. |
| public boolean | prepareForAllocation(long
the size of the resource that is about to be allocated size)Implements com. Prepare for an allocation of a resource from this pool of the indicated size by freeing up uninteresting resources until the allocation fits within the target() or max() sizes. |
| private static void | |
| public void | |
| private void | |
| public final void | recordAllocated(long
the amount of the resource to be indicated as managed. size)Implements com. Record the indicated amount of the resource as being allocated for
a |
| public final void | recordFree(long
the amount of the resource to remove from the managed amount. size)Implements com. Record the indicated amount of the resource as no longer being
held in a |
| public final void | resourceFreed(ManagedResource<T>
the resource that is freed, no longer being managed freed)Implements com. Record the |
| public final void | resourceManaged(ManagedResource<T>
the resource that is now being managed mr)Implements com. Record the |
| public final void | setTarget(long
the new current target to be set newTarget)Implements com. Sets a new current target of the maximum amount of space in this resource pool that should be used so as to be friendly to other parts of the system. |
| pack-priv static void | |
| public final long | target()
Implements com. The current target of the maximum amount of space in this resource pool that should be used so as to be friendly to other parts of the system. |
| public long | used()
Implements com. The amount of a resource currently being used to hold any kind of resource, whether managed or not. |
| curTarget | back to summary |
|---|---|
| pack-priv long curTarget | |
| FOREVER | back to summary |
|---|---|
| private static final int FOREVER | |
| managedSize | back to summary |
|---|---|
| pack-priv long managedSize | |
| managerThread | back to summary |
|---|---|
| private final Thread managerThread | |
| maxSize | back to summary |
|---|---|
| pack-priv final long maxSize | |
| origTarget | back to summary |
|---|---|
| pack-priv final long origTarget | |
| RECENT | back to summary |
|---|---|
| private static final int RECENT | |
| RECENTLY_USEFUL | back to summary |
|---|---|
| private static final int RECENTLY_USEFUL | |
| resourceHead | back to summary |
|---|---|
| private BaseResourcePool. | |
| sharedParent | back to summary |
|---|---|
| pack-priv final ResourcePool<T> sharedParent | |
| stageReasons | back to summary |
|---|---|
| private static final String[] stageReasons | |
| stageTesters | back to summary |
|---|---|
| private static final BaseResourcePool. | |
| BaseResourcePool | back to summary |
|---|---|
| protected BaseResourcePool(long target, long max) | |
| BaseResourcePool | back to summary |
|---|---|
| protected BaseResourcePool(ResourcePool<T> parent) | |
| BaseResourcePool | back to summary |
|---|---|
| protected BaseResourcePool(ResourcePool<T> parent, long target, long max) | |
| cleanup | back to summary |
|---|---|
| public boolean cleanup(long needed) Clean up the resources in the indicated pool using a standard algorithm until at least the specified amount of resource units have been reclaimed. The standard algorithm uses the following stages until it obtains enough room in the pool:
| |
| cleanup | back to summary |
|---|---|
| private void cleanup(BaseResourcePool. | |
| commas | back to summary |
|---|---|
| pack-priv static String commas(long v) | |
| freeDisposalRequestedAndCheckResources | back to summary |
|---|---|
| public void freeDisposalRequestedAndCheckResources(boolean forgiveStaleLocks) Implements com. Check that all resources are in the correct state for an idle condition
and free any resources which were disposed from a non-resource thread.
This method must be called on a thread that is appropriate for disposing
and managing resources for the resource pools.
The boolean
| |
| isManagerThread | back to summary |
|---|---|
| public boolean isManagerThread() Implements com. Doc from com. True if Thread.currentThread() is a thread that created this ResourcePool
| |
| managed | back to summary |
|---|---|
| public final long managed() Implements com. Doc from com. The amount of this resource currently being used to hold managed
resources.
This amount may be less than the amount returned by the
| |
| max | back to summary |
|---|---|
| public final long max() Implements com. Doc from com. The total space available in this pool for allocating any kind of resource, even unmanaged resources, and including those resources already allocated.
| |
| origTarget | back to summary |
|---|---|
| public final long origTarget() Implements com. Doc from com. The initial target of the maximum amount of space in this resource pool
that should be used so as to be friendly to other parts of the system.
This number must be less than or equal to the amount returned by the
| |
| prepareForAllocation | back to summary |
|---|---|
| public boolean prepareForAllocation(long size) Implements com. Doc from com. Prepare for an allocation of a resource from this pool of the indicated size by freeing up uninteresting resources until the allocation fits within the target() or max() sizes.
| |
| printpoolpercent | back to summary |
|---|---|
| private static void printpoolpercent(int stat, int total, String desc) | |
| printSummary | back to summary |
|---|---|
| public void printSummary(boolean printlocksources) | |
| pruneLastChance | back to summary |
|---|---|
| private void pruneLastChance(boolean desperate) | |
| recordAllocated | back to summary |
|---|---|
| public final void recordAllocated(long size) Implements com. Doc from com. Record the indicated amount of the resource as being allocated for
a
| |
| recordFree | back to summary |
|---|---|
| public final void recordFree(long size) Implements com. Doc from com. Record the indicated amount of the resource as no longer being
held in a
| |
| resourceFreed | back to summary |
|---|---|
| public final void resourceFreed(ManagedResource<T> freed) Implements com. Doc from com. Record the
| |
| resourceManaged | back to summary |
|---|---|
| public final void resourceManaged(ManagedResource<T> mr) Implements com. Doc from com. Record the
| |
| setTarget | back to summary |
|---|---|
| public final void setTarget(long newTarget) Implements com. Doc from com. Sets a new current target of the maximum amount of space in this
resource pool that should be used so as to be friendly to other parts
of the system.
The specified
| |
| showLink | back to summary |
|---|---|
| pack-priv static void showLink(String label, BaseResourcePool. | |
| target | back to summary |
|---|---|
| public final long target() Implements com. Doc from com. The current target of the maximum amount of space in this resource pool
that should be used so as to be friendly to other parts of the system.
This number must be less than or equal to the amount returned by the
| |
| used | back to summary |
|---|---|
| public long used() Implements com. Doc from com. The amount of a resource currently being used to hold any kind of resource, whether managed or not.
| |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| test | back to summary |
|---|---|
| public boolean test(ManagedResource<?> mr) | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv BaseResourcePool. | |
| pack-priv final long | |
| pack-priv final WeakReference |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv ManagedResource | |
| pack-priv void |
| next | back to summary |
|---|---|
| pack-priv BaseResourcePool. | |
| size | back to summary |
|---|---|
| pack-priv final long size | |
| theResourceRef | back to summary |
|---|---|
| pack-priv final WeakReference<ManagedResource<T>> theResourceRef | |
| WeakLinkedList | back to summary |
|---|---|
| pack-priv WeakLinkedList() | |
| WeakLinkedList | back to summary |
|---|---|
| pack-priv WeakLinkedList(ManagedResource<T> mresource, long size, BaseResourcePool. | |
| getResource | back to summary |
|---|---|
| pack-priv ManagedResource | |
| insert | back to summary |
|---|---|
| pack-priv void insert(ManagedResource<T> mresource, long size) | |