| java.lang.Object com.tc.asm.ClassAdapter com.tc.object.bytecode.JavaUtilConcurrentHashMapAdapter
Method Summary | |
public void | visitEnd() | public MethodVisitor | visitMethod(int access, String name, String desc, String signature, String[] exceptions) We need to instrument the size(), isEmpty(), and containsValue() methods because the original implementation in JDK
1.5 has an optimization which uses a volatile variable and does not require locking of the segments. |
JavaUtilConcurrentHashMapAdapter | public JavaUtilConcurrentHashMapAdapter(ClassVisitor cv)(Code) | | |
visitEnd | public void visitEnd()(Code) | | |
visitMethod | public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)(Code) | | We need to instrument the size(), isEmpty(), and containsValue() methods because the original implementation in JDK
1.5 has an optimization which uses a volatile variable and does not require locking of the segments. It resorts to
locking only after several unsuccessful attempts. For instance, the original implementation of the size() method
looks at the count and mod_count volatile variables of each segment and makes sure that there is no update during
executing the size() method. If it detects any update while the size() method is being executed, it will resort to
locking. Since ConcurrentHashMap is supported logically, it is possible that while the application is obtaining the
size of the map while there are still pending updates. Therefore, when ConcurrentHashMap is shared, the
instrumented code will always use an locking scheme to make sure all updates are applied before returning the size.
The same is true for isEmpty() and containsValue methods().
|
Methods inherited from com.tc.asm.ClassAdapter | public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)(Code)(Java Doc) public AnnotationVisitor visitAnnotation(String desc, boolean visible)(Code)(Java Doc) public void visitAttribute(Attribute attr)(Code)(Java Doc) public void visitEnd()(Code)(Java Doc) public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)(Code)(Java Doc) public void visitInnerClass(String name, String outerName, String innerName, int access)(Code)(Java Doc) public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)(Code)(Java Doc) public void visitOuterClass(String owner, String name, String desc)(Code)(Java Doc) public void visitSource(String source, String debug)(Code)(Java Doc)
|
|
|