-
- Type Parameters:
T
- The concrete type ofResource
that is owned.
public interface Owned<T>
This interface encapsulates the ownership of aResource
, and exposes a method that may be used to transfer this ownership to the specified recipient thread.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
transferOwnership(Drop<T> drop)
Transfer the ownership of the resource, to the calling thread.
-
-
-
Method Detail
-
transferOwnership
T transferOwnership(Drop<T> drop)
Transfer the ownership of the resource, to the calling thread. The resource instance is invalidated but without disposing of its internal state. Then a new resource instance with the given owner is produced in its stead.This method is called by
Send
implementations. These implementations will ensure that the transfer of ownership (the calling of this method) happens-before the new owner begins accessing the new object. This ensures that the new resource instance is safely published to the new owners.- Parameters:
drop
- The drop object that knows how to dispose of the state represented by thisResource
.- Returns:
- A new resource instance that is exactly the same as this resource.
-
-