You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Gary <gl...@yahoo.com> on 2004/02/10 14:56:20 UTC
NullPointerException in RsIterator$ResourceWrapper.beforeClose
While running a multi-threaded stress test, I received
the following exception:
java.lang.NullPointerException
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at
java.lang.NullPointerException.<init>(NullPointerException.java:60)
at
org.apache.ojb.broker.accesslayer.RsIterator$ResourceWrapper.beforeClose(RsIterator.java)
at
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.notifiyStateListener(PersistenceBrokerAbstractImpl.java)
It looks like "ref" or "ref.get()" became null after
the check in the following method:
public void beforeClose(PBStateEvent event)
{
if(ref != null && ref.get() != null)
{
((RsIterator)ref.get()).releaseDbResources();
ref = null;
}
}
Is there a need to synchronize on the object(s)?
Gary
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: NullPointerException in RsIterator$ResourceWrapper.beforeClose
Posted by Armin Waibel <ar...@apache.org>.
Hi again,
I checked in a fix that prevents ResourceWrapper class to operate on a
reclaimed object.
Thanks for pointing to this.
regards,
Armin
Armin Waibel wrote:
> Hi Gary,
>
> >
> > Is there a need to synchronize on the object(s)?
>
> hmm, no synchronize shouldn't be necessary because PB instance isn't
> threadsafe all in all. Maybe the object was reclaimed by GC after the
> ref.get() call.
> Are you sure that each thread operates on its own PB instance while
> running your test?
>
> regards,
> Armin
>
> Gary wrote:
>
>> While running a multi-threaded stress test, I received
>> the following exception:
>>
>> java.lang.NullPointerException
>> at java.lang.Throwable.<init>(Throwable.java)
>> at java.lang.Throwable.<init>(Throwable.java)
>> at
>> java.lang.NullPointerException.<init>(NullPointerException.java:60)
>> at
>> org.apache.ojb.broker.accesslayer.RsIterator$ResourceWrapper.beforeClose(RsIterator.java)
>>
>> at
>> org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.notifiyStateListener(PersistenceBrokerAbstractImpl.java)
>>
>>
>> It looks like "ref" or "ref.get()" became null after
>> the check in the following method:
>>
>> public void beforeClose(PBStateEvent event)
>> {
>> if(ref != null && ref.get() != null)
>> {
>> ((RsIterator)ref.get()).releaseDbResources();
>> ref = null;
>> }
>> }
>>
>> Is there a need to synchronize on the object(s)?
>>
>> Gary
>>
>> __________________________________
>> Do you Yahoo!?
>> Yahoo! Finance: Get your refund fast by filing online.
>> http://taxes.yahoo.com/filing.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: NullPointerException in RsIterator$ResourceWrapper.beforeClose
Posted by Armin Waibel <ar...@apache.org>.
Hi Gary,
>
> Is there a need to synchronize on the object(s)?
hmm, no synchronize shouldn't be necessary because PB instance isn't
threadsafe all in all. Maybe the object was reclaimed by GC after the
ref.get() call.
Are you sure that each thread operates on its own PB instance while
running your test?
regards,
Armin
Gary wrote:
> While running a multi-threaded stress test, I received
> the following exception:
>
> java.lang.NullPointerException
> at java.lang.Throwable.<init>(Throwable.java)
> at java.lang.Throwable.<init>(Throwable.java)
> at
> java.lang.NullPointerException.<init>(NullPointerException.java:60)
> at
> org.apache.ojb.broker.accesslayer.RsIterator$ResourceWrapper.beforeClose(RsIterator.java)
> at
> org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.notifiyStateListener(PersistenceBrokerAbstractImpl.java)
>
> It looks like "ref" or "ref.get()" became null after
> the check in the following method:
>
> public void beforeClose(PBStateEvent event)
> {
> if(ref != null && ref.get() != null)
> {
>
> ((RsIterator)ref.get()).releaseDbResources();
> ref = null;
> }
> }
>
> Is there a need to synchronize on the object(s)?
>
> Gary
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org