openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: [jira] Commented: (OPENJPA-952) Utilize Sun JDK's Attach API to dynamically load the OpenJPA enhancer agent
Date Wed, 04 Mar 2009 13:50:26 GMT
Pinaki,
We need this "runtime enhancement" for the initial out-of-the-box
experience.  We have two issues (at least) to resolve by improving this
support:

1)  Our current fallback mechanism for runtime enhancement is the
subclassing support.  And, that just plain doesn't cut it.  There are a slew
of Issues already open against this support.  We need to either improve it
or get rid of it.

2)  Besides the functional short-comings of the subclassing support, there
is also the performance concern.  Most of us have seen that flawed benchmark
that compared JPA providers with out-of-the-box configurations.  OpenJPA
didn't fair as well as we would like.  And, we can complain all that we want
about how flawed this benchmark was, it was still posted and customers
reference it.  It's easily explained and customers love our performance once
they figure out that enhancement is a required step.

So, why not make this required step as transparent as possible?  If we can
hook in our enhancement processing dynamically as an agent, with no
additional work on the customer's part, why wouldn't we want to do this?  It
would be very similar to hooking into the container's classloader when
running in an app server.

That's my interest in it.
Kevin

On Tue, Mar 3, 2009 at 9:54 PM, Pinaki Poddar <ppoddar@apache.org> wrote:

>
> Hi,
>  Can someone explain this deep interest to 'runtime enhancement'? In
> production, no one in sane mind will attempt it. In development, what is
> the
> real reason of bypassing build-time enhancement? An extra build step? Or is
> it that there is a 'cool factor' in redefining a class on the fly?
>   No doubt, runtime enhancement is a difficult problem -- but what extra
> value does it add?
>
>
>
>
> JIRA jira@apache.org wrote:
> >
> >
> >     [
> >
> 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[])<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses%28java.lang.instrument.ClassDefinition%5B%5D%29>
> > ...
> > 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.
> >
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/-jira--Created%3A-%28OPENJPA-952%29-Utilize-Sun-JDK%27s-Attach-API-to-dynamically-load-the-OpenJPA-enhancer-agent-tp2417786p2420237.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message