org.curjent.impl.agent
Class MethodInfo

java.lang.Object
  extended by org.curjent.impl.agent.MethodInfo

final class MethodInfo
extends Object

Information for bytecode generation of methods. An instance of this class is created for each unique interface method. The associated task method is included, and the two are evaluated for behavior, such as whether or not the agent call is synchronous.

See ResultInfo for details on identifying unique methods. One or many interface methods map to a single task method. One MethodInfo instance is created for each unique interface method, whereas the associated task method may be assigned to multiple MethodInfo instances.

See Also:
ParamInfo, ResultInfo, TypeInfo

Field Summary
(package private)  boolean call
          true if the agent call is asynchronous and the interface method returns an AgentCall.
(package private)  long expirationTimeout
          Default call site expiration timeout.
(package private)  TimeUnit expirationUnit
          Default call site expiration timeout unit.
(package private)  boolean future
          true if the agent call is asynchronous and the interface method returns a Future or AgentCall.
(package private)  String key
          Lookup key for this method.
(package private)  MarkerType markerType
          Type of Marker.
(package private)  String messageInternal
          Internal JVM name for the message class.
(package private)  String messageName
          Name of the message class generated for this method.
(package private)  String name
          Method's name.
(package private)  ParamInfo[] params
          Information for the method's parameters.
(package private)  int paramTotal
          Total stack size for the method's arguments.
(package private)  boolean reentrant
          true if the task's method is annotated with Reentrant.
(package private)  ResultInfo result
          Information on the interface and task results.
(package private)  boolean synchronous
          true if the agent call is synchronous.
(package private)  String taskDescriptor
          JVM descriptor for the task's method.
(package private)  Method taskMethod
          Associated task method.
(package private)  String typeDescriptor
          JVM descriptor for the interface's method.
(package private)  boolean[] typeExceptionCanonicals
          Exception blocks are generated only for canonical checked exceptions.
(package private)  String[] typeExceptionInternals
          Internal JVM names for the interface's declared exceptions.
(package private)  Class<?>[] typeExceptions
          Interface method's declared exceptions.
(package private)  Method typeMethod
          Interface's method.
 
Constructor Summary
MethodInfo(Method typeMethod)
          Initializes this instance with information from the interface's method.
 
Method Summary
(package private) static String getKey(Method method)
          Returns the unique key for the given method.
private static String getKey(String name, String descriptor)
          Returns the unique key for a method's name and its JVM descriptor.
(package private)  void setTaskMethod(Method taskMethod)
          Associates the interface method with the given task method.
(package private)  void setTypeIndex(TypeInfo typeInfo, int index)
          Creates the name of the message class based on the interface method's unique index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

String key
Lookup key for this method.

See Also:
getKey(Method)

name

String name
Method's name.

See Also:
Method.getName()

typeMethod

Method typeMethod
Interface's method. There is a one-to-one association between MethodInfo instances and interface methods.


taskMethod

Method taskMethod
Associated task method. The same task method may be assigned to multiple MethodInfo instances.


typeDescriptor

String typeDescriptor
JVM descriptor for the interface's method. For example, the descriptor for this class's getKey(Method) method is "(Ljava/lang/reflect/Method;)Ljava/lang/String;".


taskDescriptor

String taskDescriptor
JVM descriptor for the task's method.


params

ParamInfo[] params
Information for the method's parameters. Possibly empty but never null.


paramTotal

int paramTotal
Total stack size for the method's arguments.

See Also:
ParamInfo.size

result

ResultInfo result
Information on the interface and task results.


typeExceptions

Class<?>[] typeExceptions
Interface method's declared exceptions.

See Also:
Method.getExceptionTypes()

typeExceptionInternals

String[] typeExceptionInternals
Internal JVM names for the interface's declared exceptions. For example, "java/lang/Exception" for Exception. This value is null if there are no declared exceptions.


typeExceptionCanonicals

boolean[] typeExceptionCanonicals
Exception blocks are generated only for canonical checked exceptions. For example, if a method declares that it throws IOException and FileNotFoundException, a try-catch declaration is only generated for IOException.


messageName

String messageName
Name of the message class generated for this method.


messageInternal

String messageInternal
Internal JVM name for the message class.


markerType

MarkerType markerType
Type of Marker. null for non-marker calls.


future

boolean future
true if the agent call is asynchronous and the interface method returns a Future or AgentCall.

See Also:
ResultInfo.messageFuture

call

boolean call
true if the agent call is asynchronous and the interface method returns an AgentCall.

See Also:
ResultInfo.messageCall

synchronous

boolean synchronous
true if the agent call is synchronous.

See Also:
ResultInfo.messageSynchronous

reentrant

boolean reentrant
true if the task's method is annotated with Reentrant.


expirationTimeout

long expirationTimeout
Default call site expiration timeout. NIL unless the method is configured with an Expiration annotation.


expirationUnit

TimeUnit expirationUnit
Default call site expiration timeout unit. NANOSECONDS unless the method is configured with an Expiration annotation.

Constructor Detail

MethodInfo

MethodInfo(Method typeMethod)
Initializes this instance with information from the interface's method.

Method Detail

getKey

static String getKey(Method method)
Returns the unique key for the given method. This includes the method's name and the JVM descriptor for the method, less the return type. For example, the key for this method is "getKey(Ljava/lang/reflect/Method;)".

The return type is excluded in order to map interface methods to task methods. This mapping includes the methods' names and parameters but not their return types. See ResultInfo for details on uniquely identified methods.


getKey

private static String getKey(String name,
                             String descriptor)
Returns the unique key for a method's name and its JVM descriptor.

See Also:
getKey(Method)

setTypeIndex

void setTypeIndex(TypeInfo typeInfo,
                  int index)
Creates the name of the message class based on the interface method's unique index. The order of methods is not significant. The index value is only used to ensure unique class names.


setTaskMethod

void setTaskMethod(Method taskMethod)
Associates the interface method with the given task method.



Copyright 2009-2011 Tom Landon
Apache License 2.0