Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 591 invoked from network); 3 Mar 2009 22:17:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Mar 2009 22:17:21 -0000 Received: (qmail 66471 invoked by uid 500); 3 Mar 2009 22:17:19 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 66449 invoked by uid 500); 3 Mar 2009 22:17:19 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 66422 invoked by uid 99); 3 Mar 2009 22:17:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2009 14:17:19 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2009 22:17:17 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 350E5234C4B2 for ; Tue, 3 Mar 2009 14:16:56 -0800 (PST) Message-ID: <1155121620.1236118616216.JavaMail.jira@brutus> Date: Tue, 3 Mar 2009 14:16:56 -0800 (PST) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-952) Utilize Sun JDK's Attach API to dynamically load the OpenJPA enhancer agent In-Reply-To: <974566385.1236112856292.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678483#action_12678483 ] Rick Curtis commented on OPENJPA-952: ------------------------------------- Yes I think it would be possible to move the loading of the agent into the factory ctor. It would close the window a little, but the window will still exit. I'll update the patch I'm working on. If an Entity class is loaded by the JVM before the agent is loaded, that class will fallback to subclassing enhancement. In the small tests that I have run on my machine, bytecode enhacement plays nicely with subclassing enhancement. I'll look into whether or not it would be possible to redefine a class that has already been loaded. I'll tell you that it doesn't look promising... see below. http://java.sun.com/j2se/1.5.0/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses(java.lang.instrument.ClassDefinition[]) ... The redefinition may change method bodies, the constant pool and attributes. The redefinition must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. These restrictions maybe be lifted in future versions. ... > Utilize Sun JDK's Attach API to dynamically load the OpenJPA enhancer agent > --------------------------------------------------------------------------- > > Key: OPENJPA-952 > URL: https://issues.apache.org/jira/browse/OPENJPA-952 > Project: OpenJPA > Issue Type: Improvement > Components: kernel > Affects Versions: 2.0.0 > Environment: Sun 1.6 JDK. > Note: The Attach API is ONLY a part of the JDK, not the SDK. > Reporter: Rick Curtis > > When running in a JSE environment, OpenJPA could use the Attach API to dynamically load the enhancer agent at runtime. Dynamically loading the enhancer means that an OpenJPA developer doesn't need to configure a -javaagent. Doing this would dramatically improve the out of box performance, and also improve the ease of use. > This improvement has the following caveats: > 1.) This API is ONLY a part of the 1.6 JDK. > 2.) This API is supported by only the Sun JDK. > 3.) If the agent is loaded from the earliest OpenJPA code, the agent will be laoded when creating an EntityManager in the EntityManagerFactoryImpl. If an Entity class is loaded by the JVM before the enhancer agent is loaded, that class' byte code will not be enhanced. > Attach API - http://java.sun.com/javase/6/docs/technotes/guides/attach/index.html -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.