| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private Drop | |
| private final LifecycleTracer |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static < The type of the acquired object, given by target-typing. T> T | Returns: The acquired object.The object we wish to acquire (increment reference count) on. obj)Encapsulation bypass for calling |
| protected final T | |
| protected < The concrete exception type. E extends Throwable> E | Returns: The given exception, which can then be thrown.The throwable to attach a life-cycle trace to. throwable)Attach a trace of the life-cycle of this object as suppressed exceptions to the given throwable. |
| public final void | close()
Implements io. |
| pack-priv static int | Returns: The number of borrows, or outstanding acquires, if any, of the given object.The object to count borrows on. obj)Encapsulation bypass to call |
| protected int | Returns: The number of borrows, if any, of this object.Count the number of borrows of this object. |
| protected abstract RuntimeException | |
| pack-priv static LifecycleTracer | Returns: TheLifecycleTracer that is attached to the given object.The object to get the obj)LifecycleTracer from.Encapsulation bypass for getting the |
| private T | |
| public boolean | |
| pack-priv static boolean | Returns: true if the given object is owned, otherwise false.The object to query the ownership state on. obj)Encapsulation bypass to call |
| protected boolean | |
| protected void | |
| protected IllegalStateException | Returns: AnIllegalStateException to be thrown when this object cannot be sent.Create an |
| protected abstract Owned | Returns: This resource instance in a deactivated state.Prepare this instance for ownership transfer. |
| private I | |
| public final Send | send()
Implements io. |
| public I | touch(Object
An optional hint about this access and its context. May be hint)null.Overrides default io. |
| protected Drop | Returns: TheDrop object used by this reference counted object.Get access to the underlying |
| protected void | unsafeSetDrop(Drop<T>
The new replacement)Drop object to use instead of the current one.Replace the current underlying |
| acquires | back to summary |
|---|---|
| private int acquires | |
| drop | back to summary |
|---|---|
| private Drop<T> drop | |
| tracer | back to summary |
|---|---|
| private final LifecycleTracer tracer | |
| ResourceSupport | back to summary |
|---|---|
| protected ResourceSupport(Drop<T> drop) | |
| acquire | back to summary |
|---|---|
| pack-priv static <T> T acquire(ResourceSupport<?, ?> obj) Encapsulation bypass for calling Note this
| |
| acquire | back to summary |
|---|---|
| protected final T acquire() Increment the reference count. Note, this method is not thread-safe because Resources are meant to thread-confined.
| |
| attachTrace | back to summary |
|---|---|
| protected <E extends Throwable> E attachTrace(E throwable) Attach a trace of the life-cycle of this object as suppressed exceptions to the given throwable.
| |
| close | back to summary |
|---|---|
| public final void close() Implements io. Decrement the reference count, and dispose of the resource if the last reference is closed. Note, this method is not thread-safe because Resources are meant to be thread-confined.
Subclasses who wish to attach behaviour to the close action should override the
| |
| countBorrows | back to summary |
|---|---|
| pack-priv static int countBorrows(ResourceSupport<?, ?> obj) Encapsulation bypass to call
| |
| countBorrows | back to summary |
|---|---|
| protected int countBorrows() Count the number of borrows of this object.
Note that even if the number of borrows is
| |
| createResourceClosedException | back to summary |
|---|---|
| protected abstract RuntimeException createResourceClosedException() | |
| getTracer | back to summary |
|---|---|
| pack-priv static LifecycleTracer getTracer(ResourceSupport<?, ?> obj) Encapsulation bypass for getting the
| |
| impl | back to summary |
|---|---|
private T impl()
| |
| isAccessible | back to summary |
|---|---|
| public boolean isAccessible() Implements io. Doc from io. Check if this object is accessible. | |
| isOwned | back to summary |
|---|---|
| pack-priv static boolean isOwned(ResourceSupport<?, ?> obj) Encapsulation bypass to call
| |
| isOwned | back to summary |
|---|---|
| protected boolean isOwned() Query if this object is in an "owned" state, which means no other references have been acquired to it. This would usually be the case, since there are no public methods for acquiring references to these objects.
| |
| makeInaccessible | back to summary |
|---|---|
| protected void makeInaccessible() Called when this resource needs to be considered inaccessible.
This is called at the correct points, by the | |
| notSendableException | back to summary |
|---|---|
| protected IllegalStateException notSendableException() Create an
| |
| prepareSend | back to summary |
|---|---|
| protected abstract Owned Prepare this instance for ownership transfer. This method is called from
| |
| self | back to summary |
|---|---|
private I self()
| |
| send | back to summary |
|---|---|
| public final Send Implements io. Send this Resource instance to another Thread, transferring the ownership to the recipient. This method can be used when the receiving thread is not known up front.
This instance immediately becomes inaccessible, and all attempts at accessing this resource will throw.
Calling
| |
| touch | back to summary |
|---|---|
| public I touch(Object hint) Overrides default io. Doc from io. Record the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect. | |
| unsafeGetDrop | back to summary |
|---|---|
| protected Drop Get access to the underlying | |
| unsafeSetDrop | back to summary |
|---|---|
| protected void unsafeSetDrop(Drop<T> replacement) Replace the current underlying | |