| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final BufferCleaner. | |
| private static Thread | |
| private static final ReferenceQueue |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Cleaner | |
| private static void | |
| public static boolean | Returns: true if a cleaner was found and executed, false if there weren't any cleaners in the queue.Try to do some cleaning. |
| cleanerList | back to summary |
|---|---|
| private static final BufferCleaner. | |
| cleaningThread | back to summary |
|---|---|
| private static Thread cleaningThread | |
| queue | back to summary |
|---|---|
| private static final ReferenceQueue<Object> queue | |
| BufferCleaner | back to summary |
|---|---|
| private BufferCleaner() | |
| register | back to summary |
|---|---|
| public static Cleaner register(Object obj, Runnable action) Construct a new Cleaner for obj, with the associated action. | |
| startCleaningThreadIfNeeded | back to summary |
|---|---|
| private static void startCleaningThreadIfNeeded() | |
| tryCleaning | back to summary |
|---|---|
| public static boolean tryCleaning() Try to do some cleaning. Takes a cleaner from the queue and executes it.
| |
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | BufferCleaner.
Segment node. |
| Modifier and Type | Field and Description |
|---|---|
| private BufferCleaner. | cache
Cached node instance to provide better behavior near NODE_CAPACITY threshold: if list size flips around NODE_CAPACITY, it would reuse the cached node instead of wasting and re-allocating a new node all the time. |
| private BufferCleaner. | head
Head node. |
| pack-priv static final int | NODE_CAPACITY
Capacity for a single node in the list. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public synchronized boolean | Returns: true if Cleaner was removed or false if not because it had already been removed beforeRemove this PhantomCleaner from the list. |
| cache | back to summary |
|---|---|
| private BufferCleaner. Cached node instance to provide better behavior near NODE_CAPACITY threshold: if list size flips around NODE_CAPACITY, it would reuse the cached node instead of wasting and re-allocating a new node all the time. | |
| head | back to summary |
|---|---|
| private BufferCleaner. Head node. This is the only node where PhantomCleanabls are added to or removed from. This is the only node with variable size, all other nodes linked from the head are always at full capacity. | |
| NODE_CAPACITY | back to summary |
|---|---|
| pack-priv static final int NODE_CAPACITY Capacity for a single node in the list. This balances memory overheads vs locality vs GC walking costs. | |
| CleanerList | back to summary |
|---|---|
| public CleanerList() | |
| insert | back to summary |
|---|---|
| public synchronized void insert(BufferCleaner. Insert this PhantomCleaner in the list. | |
| remove | back to summary |
|---|---|
| public synchronized boolean remove(BufferCleaner. Remove this PhantomCleaner from the list.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final BufferCleaner. | |
| pack-priv BufferCleaner. | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| arr | back to summary |
|---|---|
| pack-priv final BufferCleaner. | |
| next | back to summary |
|---|---|
| pack-priv BufferCleaner. | |
| size | back to summary |
|---|---|
| pack-priv int size | |
| Node | back to summary |
|---|---|
| pack-priv Node() | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| CleaningRunnable | back to summary |
|---|---|
| public CleaningRunnable() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Runnable | |
| pack-priv int | |
| pack-priv BufferCleaner. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| action | back to summary |
|---|---|
| private final Runnable action | |
| index | back to summary |
|---|---|
| pack-priv int index | |
| node | back to summary |
|---|---|
| pack-priv BufferCleaner. | |
| PhantomCleaner | back to summary |
|---|---|
| public PhantomCleaner(Object obj, Runnable action) | |
| clean | back to summary |
|---|---|
| public void clean() Implements sun. Doc from sun. Unregisters the cleaner and invokes the cleaning action.
The cleaner's cleaning action is invoked at most once,
regardless of the number of calls to
| |