Interface IJavaObjectBase
- Namespace
- MASES.JCOBridge.C2JBridge.JVMInterop
- Assembly
- C2JBridge.dll
Base interface for all objects allocated from JVM
public interface IJavaObjectBase
- Extension Methods
Properties
JVMType
The IJavaType of this IJavaObjectBase
IJavaType JVMType { get; }
Property Value
JniClassName
The JNI class name of this IJavaObjectBase
string JniClassName { get; }
Property Value
Pointer
The native pointer of the object
IntPtr Pointer { get; }
Property Value
Methods
MonitorEnter()
Enters the monitor associated with the underlying with this IJavaObjectBase
void MonitorEnter()
Remarks
Each Java object has a monitor associated with it. If the current thread already owns the monitor associated with IJavaObjectBase, the JVM increments a counter in the monitor indicating the number of times this thread has entered the monitor. If the monitor associated with IJavaObjectBase is not owned by any thread, the current thread becomes the owner of the monitor, setting the entry count of this monitor to 1. If another thread already owns the monitor associated with obj, the current thread waits until the monitor is released, then tries again to gain ownership.
A monitor entered through a <xref href="MASES.JCOBridge.C2JBridge.JVMInterop.IJavaObjectBase.MonitorEnter" data-throw-if-not-resolved="false"></xref> function call cannot be exited using the monitorexit Java virtual machine instruction or a synchronized method return.
A <xref href="MASES.JCOBridge.C2JBridge.JVMInterop.IJavaObjectBase.MonitorEnter" data-throw-if-not-resolved="false"></xref> function call and a monitorenter Java virtual machine instruction may race to enter the monitor associated with the same object.
To avoid deadlocks, a monitor entered through a <xref href="MASES.JCOBridge.C2JBridge.JVMInterop.IJavaObjectBase.MonitorEnter" data-throw-if-not-resolved="false"></xref> function call must be exited using the <xref href="MASES.JCOBridge.C2JBridge.JVMInterop.IJavaObjectBase.MonitorExit" data-throw-if-not-resolved="false"></xref> call, unless the DetachCurrentThread call is used to implicitly release JNI monitors.
MonitorExit()
Exits the monitor associated with the underlying with this IJavaObjectBase
void MonitorExit()
Remarks
The current thread must be the owner of the monitor associated with the underlying Java object referred to by IJavaObjectBase. The thread decrements the counter indicating the number of times it has entered this monitor. If the value of the counter becomes zero, the current thread releases the monitor. Native code must not use MonitorExit() to exit a monitor entered through a synchronized method or a monitorenter Java virtual machine instruction.
ToArray()
Converts this IJavaObjectBase to an array value
object ToArray()
Returns
- object
Return this instance converted to an array instance
ToPrimitive()
Converts this IJavaObjectBase to a primitive value
object ToPrimitive()
Returns
- object
Return this instance converted to a primitive instance
ToPrimitive<TReturn>()
Converts this IJavaObjectBase to a primitive value
TReturn ToPrimitive<TReturn>()
Returns
- TReturn
Return this instance converted to a primitive instance
Type Parameters
TReturn
The primitive type to be returned