Package com.sun.jna
Class CallbackReference
- All Implemented Interfaces:
Closeable
,AutoCloseable
Provides a reference to an association between a native callback closure
and a Java
Callback
closure.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Map<Callback,
CallbackReference> (package private) int
(package private) Pointer
(package private) Cleaner.Cleanable
(package private) static final Map<Callback,
CallbackReference> (package private) Method
(package private) CallbackProxy
(package private) Pointer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Free native resources associated with this callback.protected void
dispose()
Deprecated.(package private) static void
Dispose of all memory allocated for callbacks.(package private) static Class<?>
findCallbackClass
(Class<?> type) static Callback
getCallback
(Class<?> type, Pointer p) Return a Callback associated with the given function pointer.static Pointer
Return aPointer
to the native function address for the given callback.Obtain a pointer to the native glue code for this callback.(package private) static CallbackThreadInitializer
setCallbackThreadInitializer
(Callback cb, CallbackThreadInitializer initializer) Methods inherited from class java.lang.ref.Reference
clear, clone, enqueue, get, isEnqueued, reachabilityFence, refersTo
-
Field Details
-
callbackMap
-
directCallbackMap
-
pointerCallbackMap
-
allocations
-
cleanable
Cleaner.Cleanable cleanable -
cbstruct
Pointer cbstruct -
trampoline
Pointer trampoline -
proxy
CallbackProxy proxy -
method
Method method -
callingConvention
int callingConvention
-
-
Method Details
-
setCallbackThreadInitializer
static CallbackThreadInitializer setCallbackThreadInitializer(Callback cb, CallbackThreadInitializer initializer) - Parameters:
cb
- TheCallback
instanceinitializer
- TheCallbackThreadInitializer
- ifnull
then the associated initializer instance is removed- Returns:
- The previous initializer instance (may be
null
)
-
getCallback
Return a Callback associated with the given function pointer. If the pointer refers to a Java callback trampoline, return the original Java Callback. Otherwise, return a proxy to the native function pointer.- Throws:
IllegalStateException
- if the given pointer has already been mapped to a callback of a different type.
-
findCallbackClass
-
getTrampoline
Obtain a pointer to the native glue code for this callback. -
close
public void close()Free native resources associated with this callback.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
dispose
Deprecated. -
disposeAll
static void disposeAll()Dispose of all memory allocated for callbacks. -
getFunctionPointer
Return aPointer
to the native function address for the given callback.
-