[
https://issues.apache.org/jira/browse/OPENJPA-952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Curtis updated OPENJPA-952:
--------------------------------
Attachment: OPENJPA-952.patch
Kevin -
Thanks for all the comments! The latest patch should have addressed all of your
comments. The only comment I'd like to address directly is,
Question: I like the getAgentJar processing for when running within Eclipse.
Should make testing even easier. Thanks. But... (always a but)... Shouldn't
there be a way to turn this feature off? Just in case we're debugging a
particular situation, I think we need a means of turning off this dynamic
support. Don't you think?
Answer: That processing is out of necessity, not a feature. To dynamically load
an agent, a jar file is needed that has an Agent-class defined. Under normal
circumstances the PersistenceProviderImpl is loaded from the OpenJPA jar and we
can load the agent with that jar. When running a test the OpenJPA jar doesn't
exist and the only way to get around this would be to setup your test to run
off a compiled OpenJPA jar.
To run the news test suite associated with this patch the following steps need
to be followed:
* Compile OpenJPA with the 1.5 JDK and make sure to skip the tests.
(-DskipTests=true ... We need to skip the tests so that the build time enhancer
doesn't run)
* Switch to the Sun 1.6 JDK.
* Run mvn test -P test-dynamic-enhancer,test-derby (or which ever DB you want
to run with, I've only tried derby)
Notes:
* See openjpa-persistence-jdbc ->
org.apache.openjpa.persistence.enhance.DynamicEnhancementSuite for a detailed
list of the tests that are run.
* By specifying mvn test -P test-dynamic-enhancer,test-derby
-DdynamicTest=org.apache.openjpa.... allows you to run a single test with the
dynamic enhancer.
-Rick
> 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
> Attachments: OPENJPA-952.patch, OPENJPA-952.patch
>
>
> 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.