RE: [JBoss-dev] 2.4.1 instance pool and ejbCreate/Remove

2001-09-17 Thread Bill Burke

ejbRemove is called only when the bean is being removed from the datastore.
This is never invoked by the container.  You're thinking of ejbPassivate.


Instances are not returned to the pool because we determined that there were
a few unfound bugs in the code.  It may be reinstated later.


Bill

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Peter
> Antman
> Sent: Monday, September 17, 2001 9:01 AM
> To: [EMAIL PROTECTED]
> Subject: [JBoss-dev] 2.4.1 instance pool and ejbCreate/Remove
>
>
> Hi,
> I have to admit I am a little lost here. In the messaging forum a user
> have wondered why ejbCreate is called every time the bean is accessed,
> but never ejbRemove.
>
> In one of his examples sending 1000 messages he gets this:
>
> 1) 1001 calls to ejbCreate()
> 2) 1000 calls to onMessage()
> 3) Zero calls to ejbRemove()
>
> With an instence pool of 100 this does not seem reasonably. I checked
> with a somewhat old 2.4.(1) CVS version, but could not verrify the
> error. Then I downloaded the 2.4.1 binary, and yes, there it was.
>
> Looking into the code I found the following new stuff in
> AbstractInstancePool.free():
>
>  if (pool.size() < maxSize)
>   {
>
>  // We do not reuse but create a brand new instance
> simplifies the design
>  try {
> pool.push(create(container.createBeanClassInstance()));
>  } catch (Exception ignored) {}
>  //pool.push(ctx);
>   } else
>   {
>  discard(ctx);
>   }
>
> To me this does not look ok. If we look at the examples statistics I
> would guess he have serial behaviour. One actual object in the pool, but
> will have ejbCreate called in free (1000 times), which calles create,
> which created a new MDB container (same is vallid for Stateless
> Session), which calles ejbCreate().
>
> I don't know if there might be some other error somewhere, but this cind
> of behaviour does not seem to be spec compliant. We basically get this:
>
>
>   * Bean instance does not exists
>   |
>   |
>  -newInstance().
>-setSessionContext()
>-ejbCreate
>   |
>   * Pool of ready instances --> onMethod() ---|
>   ^   |
>   `--- ejbCreate() <-´
>
>
> It does not seems like correct behaviour that ejbCreate is called when
> the instance is returned to the pool.
>
> Or is it something I have missunderstood?
>
> //Peter
> --
> Jobba hos oss: http://www.tim.se/weblab
> 
> Peter Antman   Technology in Media, Box 34105 100 26 Stockholm
> Systems Architect  WWW: http://www.tim.se
> Email: [EMAIL PROTECTED]  WWW: http://www.backsource.org
> Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942
> 
>
>
> ___
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
>



___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



Re: [JBoss-dev] 2.4.1 instance pool and ejbCreate/Remove

2001-09-17 Thread Peter Antman

On 17 Sep, Bill Burke wrote:
> ejbRemove is called only when the bean is being removed from the datastore.
> This is never invoked by the container.  You're thinking of ejbPassivate.
> 

No I am not, since I talk about Stateless session beans and
MessageDriven beans-

The contract here is:

1. When bean goes from not exists to be added to the method ready pool:
   ejbCreate is called.
2. Methods are invoked on beans in method ready pool (removed from pool
   during invokation, returned to pool afterwards).
3. Bean is removed from method ready pool->ejbRemove is called and the
   bean instance is ready for GC.


The way it works now is that each time a method has been invoked a new
bean (from does not exist state) is added to the pool, but the old bean
is never removed/discarded, i.e ejbRemove is never called.

Take a look at the lifecykle diagrams of the two bean types to see if
this is not the correct interpretation.


>From StatelessSessionEnterpriseContext (looks the same for MDB):

   public void discard()
  throws RemoteException
   {
  ((SessionBean)instance).ejbRemove();
   }

This should be called whenever an instance of a bean is not more
referencable (i.e is no longer in the pool) which in the new code will
happen after every method call.

//Peter
> 
> Instances are not returned to the pool because we determined that there were
> a few unfound bugs in the code.  It may be reinstated later.
> 
> 
> Bill
> 
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]]On Behalf Of Peter
>> Antman
>> Sent: Monday, September 17, 2001 9:01 AM
>> To: [EMAIL PROTECTED]
>> Subject: [JBoss-dev] 2.4.1 instance pool and ejbCreate/Remove
>>
>>
>> Hi,
>> I have to admit I am a little lost here. In the messaging forum a user
>> have wondered why ejbCreate is called every time the bean is accessed,
>> but never ejbRemove.
>>
>> In one of his examples sending 1000 messages he gets this:
>>
>> 1) 1001 calls to ejbCreate()
>> 2) 1000 calls to onMessage()
>> 3) Zero calls to ejbRemove()
>>
>> With an instence pool of 100 this does not seem reasonably. I checked
>> with a somewhat old 2.4.(1) CVS version, but could not verrify the
>> error. Then I downloaded the 2.4.1 binary, and yes, there it was.
>>
>> Looking into the code I found the following new stuff in
>> AbstractInstancePool.free():
>>
>>  if (pool.size() < maxSize)
>>   {
>>
>>  // We do not reuse but create a brand new instance
>> simplifies the design
>>  try {
>> pool.push(create(container.createBeanClassInstance()));
>>  } catch (Exception ignored) {}
>>  //pool.push(ctx);
>>   } else
>>   {
>>  discard(ctx);
>>   }
>>
>> To me this does not look ok. If we look at the examples statistics I
>> would guess he have serial behaviour. One actual object in the pool, but
>> will have ejbCreate called in free (1000 times), which calles create,
>> which created a new MDB container (same is vallid for Stateless
>> Session), which calles ejbCreate().
>>
>> I don't know if there might be some other error somewhere, but this cind
>> of behaviour does not seem to be spec compliant. We basically get this:
>>
>>
>>  * Bean instance does not exists
>>  |
>>  |
>> -newInstance().
>>-setSessionContext()
>>-ejbCreate
>>  |
>>  * Pool of ready instances --> onMethod() ---|
>>  ^   |
>>  `--- ejbCreate() <-´
>>
>>
>> It does not seems like correct behaviour that ejbCreate is called when
>> the instance is returned to the pool.
>>
>> Or is it something I have missunderstood?
>>
>> //Peter
>> --
>> Jobba hos oss: http://www.tim.se/weblab
>> 
>> Peter Antman  Technology in Media, Box 34105 100 26 Stockholm
>> Systems Architect WWW: http://www.tim.se
>> Email: [EMAIL PROTECTED] WWW: http://www.backsource.org
>> Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942
>> 
>>
>>
>> ___
>> Jboss-development mailing list
>> [EMAIL PROTECTED]
>> https://lists.sourceforge.net/lists/listinfo/jboss-development
>>
> 
> 
> 
> ___
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development

-- 
Jobba hos oss: http://www.tim.se/weblab

Peter Antman Technology in Media, Box 34105 100 26 Stockholm
Systems ArchitectWWW: http://www.tim.se
Email: [EMAIL PROTECTED]WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 



___
Jboss-development mailing list
[EMAIL PROTECTE