openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: Problems migrating to 1.0
Date Wed, 22 Aug 2007 20:04:57 GMT
> > The settings are mostly-independent. The agent settings configure what
> > the agent is capable of; the configuration setting configures what the
> > system requires in terms of preconditions.
> >
> > It is possible to use ClassLoadEnhancement=true and
> > openjpa.RuntimeUnenhancedClasses=false, but it is not possible to
> > meaningfully use ClassLoadEnhancement=false and
> > openjpa.RuntimeUnenhancedClasses=false without first running the
> > enhancer.
>
> How many config options are we talking about?

One option in OpenJPAConfiguration, and two (existing) options to be
specified for the javaagent.

> Your first entry above
> indicated ClassLoadEnhancement and RuntimeRedefinition. But, your most
> recent reply only talked about ClassLoadEnhancement and
> RuntimeUnenhancedClasses.  So, do we have two config options or three
> options?  And, how do they relate to each other?

ClassLoadEnhancement and RuntimeRedefinition are options for the
javaagent specification:

java -javaagent:openjpa.jar=RuntimeRedefinition=true,ClassLoadEnhancement=false
...

openjpa.RuntimeUnenhancedClasses is a configuration option with three
possible options: supported, unsupported, and warn.

When RuntimeUnenhancedClasses is set to unsupported or warn, the
developer must either run the enhancer or use the javaagent with
ClassLoadEnhancement=true (the default). This is the same as the
OpenJPA behavior two months ago.

When RuntimeUnenhancedClasses is set to supported, OpenJPA can be used
without running the enhnacer or specifying a javaagent.

It gets weird when you *do* specify a javaagent, with
ClassLoadEnhancement=false. This is really only there for testing
purposes, though, and is certainly not the normal behavior.

-Patrick

On 8/22/07, Kevin Sutter <kwsutter@gmail.com> wrote:
> Indenting is getting a little hairy, but I'll try again...  :-)
>
> On 8/22/07, Patrick Linskey <plinskey@gmail.com> wrote:
> >
> > Not too late -- I was just being optimistic.
> >
> > > > > 1. change the javaagent settings to ClassLoadEnhancement and
> > > > > RuntimeRedefinition (deprecate the RuntimeEnhancement setting, which
> > > > > is exactly the same as ClassLoadEnhancement, except that the latter
> > > > > better indicates the time that the enhancement happens)
> > > >
> > > > I think this sounds better.  The use of the two settings would
> > definitely
> > > > clarify what aspects of this support you want to enable.  My question
> > is how
> > > > would these two settings relate to each other?  Are they
> > independent?  I
> > > > suppose they could be.  These would be simple boolean settings?
> >
> > The settings are mostly-independent. The agent settings configure what
> > the agent is capable of; the configuration setting configures what the
> > system requires in terms of preconditions.
> >
> > It is possible to use ClassLoadEnhancement=true and
> > openjpa.RuntimeUnenhancedClasses=false, but it is not possible to
> > meaningfully use ClassLoadEnhancement=false and
> > openjpa.RuntimeUnenhancedClasses=false without first running the
> > enhancer.
>
>
> How many config options are we talking about?  Your first entry above
> indicated ClassLoadEnhancement and RuntimeRedefinition.  But, your most
> recent reply only talked about ClassLoadEnhancement and
> RuntimeUnenhancedClasses.  So, do we have two config options or three
> options?  And, how do they relate to each other?
>
> > > How about just UnenhancedClasses?  I suppose the Runtime prefix
> > indicates
> > > > when the extra processing would take place, but it would seem
> > > > straightforward to indicate support or non-support of
> > UnenhancedClasses.
> >
> > The thing is that even if UnenhancedClasses were set to 'unsupported',
> > you could still skip enhancement if you ran with a javaagent that
> > enhanced on classloading, or if deploying into an appserver.
>
>
> I see your point.  RuntimeUnenhancedClasses is fine with me (if we still go
> with this config option based on my previous comment).
>
> Thanks!
> Kevin
>
>
> -Patrick
> >
> > On 8/22/07, Kevin Sutter <kwsutter@gmail.com> wrote:
> > > Guess I was too late with my comments...  you already integrated the
> > > changes...  :-)
> > >
> > > On 8/22/07, Kevin Sutter <kwsutter@gmail.com> wrote:
> > > >
> > > > Patrick,
> > > >
> > > > On 8/22/07, Patrick Linskey <plinskey@gmail.com> wrote:
> > > > >
> > > > >
> > > > > 1. change the javaagent settings to ClassLoadEnhancement and
> > > > > RuntimeRedefinition (deprecate the RuntimeEnhancement setting, which
> > > > > is exactly the same as ClassLoadEnhancement, except that the latter
> > > > > better indicates the time that the enhancement happens)
> > > >
> > > >
> > > > I think this sounds better.  The use of the two settings would
> > definitely
> > > > clarify what aspects of this support you want to enable.  My question
> > is how
> > > > would these two settings relate to each other?  Are they
> > independent?  I
> > > > suppose they could be.  These would be simple boolean settings?
> > > >
> > > > 2. change the conf setting to
> > > > > RuntimeUnenhancedClasses=supported|unsupported|warn
> > > >
> > > >
> > > > How about just UnenhancedClasses?  I suppose the Runtime prefix
> > indicates
> > > > when the extra processing would take place, but it would seem
> > > > straightforward to indicate support or non-support of
> > UnenhancedClasses.
> > > >
> > > > Kevin
> > > >
> > > > -Patrick
> > > > >
> > > > > On 8/22/07, Patrick Linskey < plinskey@gmail.com> wrote:
> > > > > > > A couple of thoughts...  Could we come up with a different
name
> > for
> > > > > this
> > > > > > > configuration option.  RuntimeClassOptimization really
is a
> > > > > misnomer.  We're
> > > > > > > not optimizing anything.  And, actually, the info messages
that
> > > > > might be
> > > > > > > produced when using this support indicates that we're going
to
> > be
> > > > > slower and
> > > > > > > use more memory.  So, where's the optimization?  Maybe
something
> > > > > like
> > > > > > > AutomaticRuntimeEnhancement or AutomaticPersistenceCapable
or
> > > > > > > RuntimeClassEnhancement or something along those lines.
 I just
> > > > > think we
> > > > > > > need to remove the "Optimization" aspect.  We also need
to be
> > clear
> > > > > that
> > > > > > > this is different from the automatic agent or container
> > classloading
> > > > >
> > > > > > > mechanisms.
> > > > > >
> > > > > > I used the word 'optimization' because as Marc pointed out to
me,
> > the
> > > > > > enhancer is becoming a build-time optimization. However, I think
> > that
> > > > > > I agree that "optimization" might not be appropriate here.
> > > > > >
> > > > > > The thing is, "enhancement" isn't either, since this turns off
the
> > > > > > redefinition and subclassing capabilities.
> > > > > >
> > > > > > We could go the other direction, and say
> > > > > > "BuildtimeClassEnhancement=required|optional|warn", but this
> > doesn't
> > > > > > really reflect the nature of the setting, since the setting
> > controls
> > > > > > not the build-time processes but the runtime requirements.
> > > > > >
> > > > > > > Now, getting back to your original question -- warning
or
> > error?  If
> > > > > the
> > > > > > > user has specified that they do not want this automatic
> > enhancement
> > > > > to take
> > > > > > > place, then we should issue an error.  Or, are you thinking
of
> > > > > providing
> > > > > > > multiple values for this setting:  true, warn (false),
and error
> > > > > (false)?  I
> > > > > > > suppose that would work.
> > > > > >
> > > > > > I was thinking of changing it to "enabled", "disabled" (current
> > > > > > behaviof for false), or "warn".
> > > > > >
> > > > > > > But, in general, either I want processing to take
> > > > > > > place or I don't.
> > > > > >
> > > > > > That was my thought as well. However, given this new flakiness
in
> > the
> > > > > > isAssignableFrom check, it doesn't seem that simple.
> > > > > >
> > > > > > >  And, looking at your code in ManagedClassSubclasser, it
> > > > > > > looks like we are already issuing an informational message
for
> > all
> > > > > of the
> > > > > > > classes that fall into this processing.  So, isn't that
similar
> > to
> > > > > the
> > > > > > > warn(false) setting?
> > > > > >
> > > > > > In the error case, we throw an exception from
> > ManagedClassSubclasser.
> > > > > > In the new warn case, we warn and just return from the method.
> > There
> > > > > > will be a failure later, no doubt.
> > > > > >
> > > > > > > BTW, due to these potential problems and questions, does
that
> > mean
> > > > > that Marc
> > > > > > > has to respin?
> > > > > >
> > > > > > I think so, since it seems like the user has a fairly standard
> > > > > > configuration (OpenJPA + Spring + Java 6).
> > > > > >
> > > > > > I'm going to check in something that uses a conf setting called
> > > > > > 'RuntimeUnenhancedClassSupport". We might want to tweak this
> > later,
> > > > > > but it is very easy to provide backward-compat for simple config
> > > > > > properties.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > On 8/22/07, Kevin Sutter < kwsutter@gmail.com> wrote:
> > > > > > > Patrick,
> > > > > > >
> > > > > > > On 8/22/07, Patrick Linskey <plinskey@gmail.com>
wrote:
> > > > > > > >
> > > > > > > > Well, the only thing that I can think of is that there
is some
> > > > > sort of
> > > > > > > > classloader confusion preventing the isAssignableFrom
check to
> > > > > pass.
> > > > > > > > This would also potentially explain why the com.sun
class is
> > not
> > > > > being
> > > > > > > > found.
> > > > > > >
> > > > > > >
> > > > > > > Could it also be related to something in the JDK 6
> > > > > implementation?  We're
> > > > > > > tracking a semi-related problem on iSeries and one of the
> > possible
> > > > > points of
> > > > > > > failure is the isAssignableFrom.  But, it's just a guess
at this
> > > > > point.
> > > > > > >
> > > > > > > I think that maybe it makes sense to change the new
> > configuration
> > > > > > > > option to allow the user to select between a warning
and an
> > error.
> > > > >
> > > > > > > > Thoughts?
> > > > > > >
> > > > > > >
> > > > > > > A couple of thoughts...  Could we come up with a different
name
> > for
> > > > > this
> > > > > > > configuration option.  RuntimeClassOptimization really
is a
> > > > > misnomer.  We're
> > > > > > > not optimizing anything.  And, actually, the info messages
that
> > > > > might be
> > > > > > > produced when using this support indicates that we're going
to
> > be
> > > > > slower and
> > > > > > > use more memory.  So, where's the optimization?  Maybe
something
> > > > > like
> > > > > > > AutomaticRuntimeEnhancement or AutomaticPersistenceCapable
or
> > > > > > > RuntimeClassEnhancement or something along those lines.
 I just
> > > > > think we
> > > > > > > need to remove the "Optimization" aspect.  We also need
to be
> > clear
> > > > > that
> > > > > > > this is different from the automatic agent or container
> > classloading
> > > > > > > mechanisms.
> > > > > > >
> > > > > > > Now, getting back to your original question -- warning
or
> > error?  If
> > > > > the
> > > > > > > user has specified that they do not want this automatic
> > enhancement
> > > > > to take
> > > > > > > place, then we should issue an error.  Or, are you thinking
of
> > > > > providing
> > > > > > > multiple values for this setting:  true, warn (false),
and error
> > > > > (false)?  I
> > > > > > > suppose that would work.  But, in general, either I want
> > processing
> > > > > to take
> > > > > > > place or I don't.  And, looking at your code in
> > > > > ManagedClassSubclasser, it
> > > > > > > looks like we are already issuing an informational message
for
> > all
> > > > > of the
> > > > > > > classes that fall into this processing.  So, isn't that
similar
> > to
> > > > > the
> > > > > > > warn(false) setting?
> > > > > > >
> > > > > > > BTW, due to these potential problems and questions, does
that
> > mean
> > > > > that Marc
> > > > > > > has to respin?
> > > > > > >
> > > > > > > Kevin
> > > > > > >
> > > > > > > -Patrick
> > > > > > > >
> > > > > > > > On 8/22/07, Prashant Bhat < prashant.mr@gmail.com>
wrote:
> > > > > > > > > Here is the output of javap run on one of the
entity.
> > > > > > > > >
> > > > > > > > > public class com.sample.accounts.entity.Account
extends
> > > > > > > > > com.sample.company.base.CompanyEntity implements
> > org.apache.op
> > > > > > > > > enjpa.enhance.PersistenceCapable{
> > > > > > > > >     static
> > java.lang.Classclass$Lcom$sample$company$base$CompanyEntity;
> > > > > > > > >     static java.lang.Class class$Ljava$lang$String;
> > > > > > > > >     static
> > > > > java.lang.Classclass$Lcom$sample$accounts$entity$AccountType ;
> > > > > > > > >     static
> > > > > java.lang.Classclass$Lcom$sample$company$entity$BusinessPartner;
> > > > > > > > >     static
> > java.lang.Classclass$Lcom$sample$accounts$entity$Currency;
> > > > > > > > >     static java.lang.Class class$Ljava$math$BigDecimal;
> > > > > > > > >     static
> > java.lang.Classclass$Lcom$sample$accounts$entity$Account;
> > > > > > > > >     static
> > java.lang.Classclass$Lcom$sample$accounts$entity$TaxRate;
> > > > > > > > >     public com.sample.accounts.entity.Account
();
> > > > > > > > >     public com.sample.accounts.entity.Account(long,
> > > > > java.lang.String,
> > > > > > > > > java.lang.String, com.sample.accounts.entity.Acc
> > > > > > > > > ountType, java.math.BigDecimal);
> > > > > > > > >     public long getId();
> > > > > > > > >     public void setId(long);
> > > > > > > > >     public java.lang.String getName();
> > > > > > > > >     public void setName(java.lang.String);
> > > > > > > > >     public java.lang.String getDescription();
> > > > > > > > >     public void setDescription(java.lang.String);
> > > > > > > > >     public java.lang.String getAccountNumber();
> > > > > > > > >     public void setAccountNumber(java.lang.String);
> > > > > > > > >     public com.sample.accounts.entity.CurrencygetCurrency();
> > > > > > > > >     public void setCurrency(
> > com.sample.accounts.entity.Currency);
> > > > > > > > >     public com.sample.accounts.entity.TaxRategetRelatedTax();
> > > > > > > > >     public void setRelatedTax(
> > com.sample.accounts.entity.TaxRate
> > > > > );
> > > > > > > > >     public
> > com.sample.accounts.entity.AccountgetParentAccount();
> > > > > > > > >     public void setParentAccount(
> > > > > com.sample.accounts.entity.Account);
> > > > > > > > >     public
> > com.sample.accounts.entity.AccountTypegetAccountType();
> > > > > > > > >     public void setAccountType(
> > > > > com.sample.accounts.entity.AccountType );
> > > > > > > > >     public
> > > > > com.samooha.company.entity.BusinessPartnergetBusinessPartner();
> > > > > > > > >     public void setBusinessPartner(
> > > > > > > > com.sample.company.entity.BusinessPartner
> > > > > > > > > );
> > > > > > > > >     public boolean isPostable();
> > > > > > > > >     public void setPostable(boolean);
> > > > > > > > >     public int getSequenceNumber();
> > > > > > > > >     public void setSequenceNumber(int);
> > > > > > > > >     public boolean isSplitAccount();
> > > > > > > > >     public void setSplitAccount(boolean);
> > > > > > > > >     public boolean isGroupingAccount();
> > > > > > > > >     public void setGroupingAccount(boolean);
> > > > > > > > >     public java.math.BigDecimal getCurrentBalance();
> > > > > > > > >     public void setCurrentBalance(java.math.BigDecimal
);
> > > > > > > > >     public int pcGetEnhancementContractVersion();
> > > > > > > > >     static final {};
> > > > > > > > >     static java.lang.Class class$(java.lang.String);
> > > > > > > > >     protected void pcClearFields();
> > > > > > > > >     public
> > org.apache.openjpa.enhance.PersistenceCapablepcNewInstance(
> > > > > > > > > org.apache.openjpa.enhance.StateManager, java.lan
> > > > > > > > > g.Object, boolean);
> > > > > > > > >     public
> > org.apache.openjpa.enhance.PersistenceCapablepcNewInstance(
> > > > > > > > > org.apache.openjpa.enhance.StateManager , boolean)
> > > > > > > > > ;
> > > > > > > > >     protected static int pcGetManagedFieldCount();
> > > > > > > > >     public void pcReplaceField(int);
> > > > > > > > >     public void pcReplaceFields(int[]);
> > > > > > > > >     public void pcProvideField(int);
> > > > > > > > >     public void pcProvideFields(int[]);
> > > > > > > > >     protected void pcCopyField(
> > > > > com.sample.accounts.entity.Account, int);
> > > > > > > > >     public void pcCopyFields(java.lang.Object,
int[]);
> > > > > > > > >     public void pcCopyKeyFieldsToObjectId(
> > > > > > > > > org.apache.openjpa.enhance.FieldSupplier, java.lang.Object);
> > > > > > > > >     public void pcCopyKeyFieldsToObjectId(java.lang.Object);
> > > > > > > > >     public void pcCopyKeyFieldsFromObjectId(
> > > > > > > > > org.apache.openjpa.enhance.FieldConsumer , java.lang.Object
> > );
> > > > > > > > >     public void pcCopyKeyFieldsFromObjectId(java.lang.Object
> > );
> > > > > > > > >     public java.lang.Object pcNewObjectIdInstance(
> > > > > java.lang.Object);
> > > > > > > > >     public java.lang.Object pcNewObjectIdInstance();
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > As from the above output, it is enhanced properly,
but I
> > still
> > > > > get the
> > > > > > > > > following exception:
> > > > > > > > >
> > > > > > > > > <openjpa-0.0.0-r420667:568385 nonfatal user
error>
> > > > > > > > > org.apache.openjpa.persistence.ArgumentException
: This
> > > > > configuration
> > > > > > > > > disallows runtime optimization, but the following
listed
> > types
> > > > > were not
> > > > > > > > > enhanced at build time or at class load time
with a
> > javaagent:
> > > > > "[..]".
> > > > > > > > >     at
> > > > > > > > >
> > > > > > > >
> > > > >
> > org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses
> > > > > (
> > > > > > > > > ManagedClassSubclasser.java:90)
> > > > > > > > >
> > > > > > > > > Thanks,
> > > > > > > > > Prashant.
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Patrick Linskey
> > > > > > > > 202 669 5907
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > 202 669 5907
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > 202 669 5907
> > > > >
> > > >
> > > >
> > >
> >
> >
> > --
> > Patrick Linskey
> > 202 669 5907
> >
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message