public interface NDResource
extends java.lang.AutoCloseable
NDManager
and tracks the manager it is attached to.Modifier and Type | Method and Description |
---|---|
void |
attach(NDManager manager)
Attaches this
NDResource to the specified NDManager . |
void |
close() |
void |
detach()
Detaches the
NDResource from current NDManager 's lifecycle. |
NDManager |
getManager()
Returns the
NDManager that manages this. |
void |
tempAttach(NDManager manager)
Temporarily attaches this
NDResource to the specified NDManager . |
NDManager getManager()
NDManager
that manages this.NDManager
that manages this.void attach(NDManager manager)
NDResource
to the specified NDManager
.
Attached resource will be closed when the NDManager
is closed.
manager
- the NDManager
to be attached tovoid tempAttach(NDManager manager)
NDResource
to the specified NDManager
.
Attached resource will be returned to the original manager when the NDManager
is
closed.
manager
- the NDManager
to be attached tovoid detach()
NDResource
from current NDManager
's lifecycle.
This becomes un-managed and it is the user's responsibility to close this. Failure to close the resource might cause your machine to run out of native memory.
NDManager
void close()
close
in interface java.lang.AutoCloseable