Top Inners Fields Constructors Methods
com.kenai.jffi

public Class CallContextCache

extends Object
Class Inheritance
Imports
java.lang.ref.ReferenceQueue, .SoftReference, java.util.Map, java.util.concurrent.ConcurrentHashMap

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
CallContextCache.SingletonHolder

Holder class to do lazy allocation of the ClosureManager instance

Field Summary

Modifier and TypeField and Description
private final Map<CallContextCache.Signature, CallContextCache.CallContextRef>
private final ReferenceQueue<CallContext>

Constructor Summary

AccessConstructor and Description
private
CallContextCache()

Constructs a ClosureManager

Method Summary

Modifier and TypeMethod and Description
public final CallContext
getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention)

public final CallContext
getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno)

public final CallContext
getCallContext(Type returnType, int fixedParamCount, Type[] parameterTypes, CallingConvention convention, boolean saveErrno)

public final CallContext
getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)

public final CallContext
getCallContext(Type returnType, int fixedParamCount, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)

public static CallContextCache

Returns:

An instance of a CallContextCache
getInstance
()

Gets the global instance of the CallContextCache

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextCacheback to summary
private final Map<CallContextCache.Signature, CallContextCache.CallContextRef> contextCache
contextReferenceQueueback to summary
private final ReferenceQueue<CallContext> contextReferenceQueue

Constructor Detail

CallContextCacheback to summary
private CallContextCache()

Constructs a ClosureManager

Method Detail

getCallContextback to summary
public final CallContext getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention)
getCallContextback to summary
public final CallContext getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno)
getCallContextback to summary
public final CallContext getCallContext(Type returnType, int fixedParamCount, Type[] parameterTypes, CallingConvention convention, boolean saveErrno)
getCallContextback to summary
public final CallContext getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)
getCallContextback to summary
public final CallContext getCallContext(Type returnType, int fixedParamCount, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)
getInstanceback to summary
public static CallContextCache getInstance()

Gets the global instance of the CallContextCache

Returns:CallContextCache

An instance of a CallContextCache

com.kenai.jffi back to summary

private final Class CallContextCache.CallContextRef

extends SoftReference<CallContext>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final CallContextCache.Signature

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.ref.SoftReference:
get

Field Detail

signatureback to summary
pack-priv final CallContextCache.Signature signature

Constructor Detail

CallContextRefback to summary
public CallContextRef(CallContextCache.Signature signature, CallContext ctx, ReferenceQueue<CallContext> queue)
com.kenai.jffi back to summary

private final Class CallContextCache.Signature

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final CallingConvention
private final boolean
private int
private final Type[]
private final Type
returnType

Keep references to the return and parameter types so they do not get garbage collected until the closure does.

private final boolean

Constructor Summary

AccessConstructor and Description
public
Signature(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)

Method Summary

Modifier and TypeMethod and Description
private final int
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

conventionback to summary
private final CallingConvention convention
faultProtectback to summary
private final boolean faultProtect
hashCodeback to summary
private int hashCode
parameterTypesback to summary
private final Type[] parameterTypes
returnTypeback to summary
private final Type returnType

Keep references to the return and parameter types so they do not get garbage collected until the closure does.

saveErrnoback to summary
private final boolean saveErrno

Constructor Detail

Signatureback to summary
public Signature(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)

Method Detail

calculateHashCodeback to summary
private final int calculateHashCode()
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
com.kenai.jffi back to summary

private final Class CallContextCache.SingletonHolder

extends Object
Class Inheritance

Holder class to do lazy allocation of the ClosureManager instance

Field Summary

Modifier and TypeField and Description
pack-priv static final CallContextCache

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final CallContextCache INSTANCE

Constructor Detail

SingletonHolderback to summary
private SingletonHolder()