Port the 1.7 JNIManagedPeer code to Java 1.6