|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tc.asm.ClassAdapter
com.tc.object.bytecode.rwsync.LockingClassAdapter
public abstract class LockingClassAdapter
A base for class adapters that wrap methods inside read or write locks. Creates and initializes the lock fields, and defines a table-based approach to specifying locking strategy.
Field Summary | |
---|---|
protected static MethodStrategy |
INIT_STRATEGY
|
protected static MethodStrategy |
NOLOCK_STRATEGY
|
protected static MethodStrategy |
READLOCK_STRATEGY
|
protected static MethodStrategy |
WRITELOCK_STRATEGY
|
Fields inherited from class com.tc.asm.ClassAdapter |
---|
cv |
Constructor Summary | |
---|---|
LockingClassAdapter(ClassVisitor cv)
|
Method Summary | |
---|---|
protected void |
addLockFields()
Helper function to add the necessary lock fields to a class. |
protected abstract java.util.Map<MethodId,MethodStrategy> |
getLockingStrategy()
|
protected abstract java.lang.String |
getOuterDesc()
|
protected abstract java.lang.String |
getOuterType()
|
protected abstract java.lang.String |
getOwnerType()
|
protected abstract java.lang.String |
getOwnerTypeDots()
|
MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
Modify existing methods and create new wrapped methods. |
Methods inherited from class com.tc.asm.ClassAdapter |
---|
visit, visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitOuterClass, visitSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final MethodStrategy INIT_STRATEGY
protected static final MethodStrategy NOLOCK_STRATEGY
protected static final MethodStrategy READLOCK_STRATEGY
protected static final MethodStrategy WRITELOCK_STRATEGY
Constructor Detail |
---|
public LockingClassAdapter(ClassVisitor cv)
Method Detail |
---|
protected abstract java.lang.String getOwnerType()
protected abstract java.lang.String getOwnerTypeDots()
protected abstract java.lang.String getOuterType()
protected abstract java.lang.String getOuterDesc()
protected abstract java.util.Map<MethodId,MethodStrategy> getLockingStrategy()
public MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
visitMethod
in interface ClassVisitor
visitMethod
in class ClassAdapter
access
- the method's access flags (see Opcodes
). This
parameter also indicates if the method is synthetic and/or
deprecated.name
- the method's name.desc
- the method's descriptor (see Type
).signature
- the method's signature. May be null if the
method parameters, return type and exceptions do not use generic
types.exceptions
- the internal names of the method's exception classes
(see getInternalName
). May be
null.
protected void addLockFields()
ClassVisitor.visitEnd()
of the class adapter that is instrumenting the base class of a hierarchy. That is,
if B extends A, and methods in A and B are both being locked, this should be called from A's class adapter. Don't
call it from B's adapter, or you'll be using different locks for the A and B methods on the same object!
Class adapters which call this method should also map constructor methods to the InitMethodStrategy
strategy to initialize the fields.
cv
- can be the originating ClassVisitor or its delegate, it doesn't matterInitMethodStrategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |