openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roger.keays" <roger.ke...@ninthavenue.com.au>
Subject Re: Shared classloader and subclasses
Date Thu, 12 Apr 2007 02:50:05 GMT



Abe White wrote:
> 
> I've committed an equivalent patch to 0.9.7 in SVN revision 522623.   
> Can you confirm whether this fixes your problem and, if so, close any  
> CR you might have opened on this?
> 
I've tested with /branches/0.9.7-incubating:527748 and it seems fine.



>> This works for me :) Here's a patch for 0.9.6 source. I've gone for  
>> the
>> simplest solution, but it might be improved by looping over pcNames  
>> instead
>> of _registered (?).
>>
>> http://www.nabble.com/file/7398/openjpa-diff openjpa-diff
>>
>> Index: MetaDataRepository.java
>> ===================================================================
>> --- MetaDataRepository.java
>> (.../tags/0.9.6/openjpa-kernel/src/main/java/org/apache/openjpa/meta)
>> (revision 3)
>> +++ MetaDataRepository.java
>> (.../branches/0.9.6-ninthavenue/openjpa-kernel/src/main/java/org/ 
>> apache/openjpa/meta)
>> (working copy)
>> @@ -302,7 +302,7 @@
>>              return null;
>>
>>          // check cache
>> -        processRegisteredClasses();
>> +        processRegisteredClasses(envLoader);
>>          List classList = (List) _aliases.get(alias);
>>
>>          // multiple classes may have been defined with the same  
>> alias: we
>> @@ -928,7 +928,7 @@
>>          }
>>
>>          // check cache
>> -        processRegisteredClasses();
>> +        processRegisteredClasses(envLoader);
>>          Class cls = (Class) _oids.get(oid.getClass());
>>          if (cls != null)
>>              return getMetaData(cls, envLoader, mustExist);
>> @@ -944,7 +944,7 @@
>>          // if still not match, register any classes that look  
>> similar to
>> the
>>          // oid class and check again
>>          resolveIdentityClass(oid);
>> -        if (processRegisteredClasses().length > 0) {
>> +        if (processRegisteredClasses(envLoader).length > 0) {
>>              cls = (Class) _oids.get(oid.getClass());
>>              if (cls != null)
>>                  return getMetaData(cls, envLoader, mustExist);
>> @@ -1262,7 +1262,7 @@
>>       * Parses the metadata for all registered classes.
>>       */
>>      private void loadRegisteredClassMetaData(ClassLoader envLoader) {
>> -        Class[] reg = processRegisteredClasses();
>> +        Class[] reg = processRegisteredClasses(envLoader);
>>          for (int i = 0; i < reg.length; i++) {
>>              try {
>>                  getMetaData(reg[i], envLoader, false);
>> @@ -1276,7 +1276,7 @@
>>      /**
>>       * Updates our datastructures with the latest registered classes.
>>       */
>> -    Class[] processRegisteredClasses() {
>> +    Class[] processRegisteredClasses(ClassLoader envLoader) {
>>          if (_registered.isEmpty())
>>              return EMPTY_CLASSES;
>>
>> @@ -1289,9 +1289,18 @@
>>          }
>>
>>          Collection failed = null;
>> +        Collection pcNames = getPersistentTypeNames(false,  
>> envLoader);
>>          for (int i = 0; i < reg.length; i++) {
>>              try {
>> -                processRegisteredClass(reg[i]);
>> +
>> +                /*
>> +                 * Only process classes known to this  
>> MetaDataRepository,
>> +                 * since _registered contains all classes loaded by
>> +                 * PCRegistry.
>> +                 */
>> +                if (pcNames.contains(reg[i].getName())) {
>> +                    processRegisteredClass(reg[i]);
>> +                }
>>              } catch (Throwable t) {
>>                  if (!_conf.getRetryClassRegistration())
>>                      throw new
>> MetaDataException(_loc.get("error-registered",
>> Index: ClassMetaData.java
>> ===================================================================
>> --- ClassMetaData.java
>> (.../tags/0.9.6/openjpa-kernel/src/main/java/org/apache/openjpa/meta)
>> (revision 4)
>> +++ ClassMetaData.java
>> (.../branches/0.9.6-ninthavenue/openjpa-kernel/src/main/java/org/ 
>> apache/openjpa/meta)
>> (working copy)
>> @@ -309,7 +309,7 @@
>>          if (_owner != null)
>>              return _repos.EMPTY_CLASSES;
>>
>> -        _repos.processRegisteredClasses();
>> +        _repos.processRegisteredClasses(getEnvClassLoader());
>>          if (_subs == null) {
>>              Collection subs = _repos.getPCSubclasses(_type);
>>              _subs = (Class[]) subs.toArray(new Class[subs.size()]);
>>
>> -- 
>> View this message in context: http://www.nabble.com/Shared- 
>> classloader-and-subclasses-tf3431312.html#a9655900
>> Sent from the open-jpa-dev mailing list archive at Nabble.com.
>>
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> 
> 

-- 
View this message in context: http://www.nabble.com/Shared-classloader-and-subclasses-tf3431312.html#a9952092
Sent from the open-jpa-dev mailing list archive at Nabble.com.


Mime
View raw message