The only instance's fields that the container is allowed to manipulate are the
fields designated for container-managed persistence. All the other fields
are in the hands of the bean developer, and the container should not modify
them under the covers.

Vlada

-----Original Message-----
From: Imre Kifor <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, March 18, 1999 9:50 AM
Subject: Re: (TO SUN: please clarify) Re: ejbCreate( ) - initialize instance variables


>Constantine,
>
>>So it is not safe to reset anything except container managed fields
>>during instance lifetime. So I think that Ejipt behaviour is
>>incorrect one because they reset all fileds.
>>
>>I would like if Vlada of other author of EJB spec will clarify
>>the issue.
>>
>>Constantine
>
>The issue boils down to resource management. We view bean instances as
>reusable resources and have applied the same resource management principles
>to them as to all the other shared resources we manage in our servers.
>
>Guaranteeing a consistent and predictable state for all pooled resources is
>crucial for a robust and scalable server implementation. Resetting fields in
>a generic fashion is not possible in JDK1.1. However, that restriction
>should not be extended to the spec itself, especially now that Java 2 lifted
>the restriction in a secure and highly controllable fashion.
>
>Imre Kifor
>Valto Systems
>
>>
>>Jim Frentress wrote:
>>>
>>> to reduce object creation, this might be better:
>>>
>>> class TestBean
>>> {
>>>    List l = null;
>>>    void ejbCreate() {
>>>         init();
>>>    }
>>>    void ejbActivate()
>>>    {
>>>         init();
>>>    }
>>>
>>>   void init()
>>>   {
>>>       if (l == null)
>>>                 l = new ArrayList();
>>>         l.clear();
>>>   }
>>>
>>>     void test(String a)
>>>    {
>>>       l.add(a);
>>>    }
>>> }
>>>
>>> > -----Original Message-----
>>> > From: Imre Kifor [SMTP:[EMAIL PROTECTED]]
>>> > Sent: Wednesday, March 17, 1999 2:20 PM
>>> > To:   [EMAIL PROTECTED]
>>> > Subject:      Re: ejbCreate( ) - initialize instance variables
>>> >
>>> > Sachin,
>>> >
>>> >
>>> > >> class TestBean
>>> > >> {
>>> > >>    List l = null;
>>> > >>
>>> > >>    void ejbCreate()
>>> > >>    {
>>> > >>    }
>>> > >>
>>> > >>    void ejbActivate()
>>> > >>    {
>>> > >>       l = new ArrayList();
>>> > >>    }
>>> > >>
>>> > >>    void test(String a)
>>> > >>    {
>>> > >>       l.add(a);
>>> > >>    }
>>> > >> }
>>> > >
>>> > >Imre,
>>> > >
>>> > >don't we need to have " l = new ArrayList();" in the ejbCreate( )
>also
>>> > as
>>> > >ejbActivate is not called for every ejbCreate( ) ? In essence does the
>>> > bean
>>> > >developer end up initializing in activate as well as create methods.
>>> >
>>> >
>>> > Of course, sorry about that. You have to do initialization in both
>>> > ejbActivate and ejbCreate methods (or ejbPostCreate in the case of
>entity
>>> > beans).
>>> >
>>> > Imre
>>> >
>>> > >Thanks,
>>> > >
>>> > >Sachin.
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >>
>>> > >> The example (combined with our mechanism) will guarantee that 1)
>your
>>> > deep
>>> > >> hierarchies are ready before your business methods hit 2) pooled
>>> > instances
>>> > >> don't use up resources by storing deep hierarchies associated with a
>>> > >> specific EJBObject 3) left over deep hierarchies are not accessible
>by
>>> > >> accident when a pooled instance is re-attached to a different
>>> > >> EJBObject and
>>> > >> 4) and the whole thing is fast :-)
>>> > >>
>>> > >> Imre Kifor
>>> > >> Valto Systems
>>> > >>
>>> > >> >
>>> > >> >Constantine
>>> > >> >
>>> > >> >> -----Original Message-----
>>> > >> >> From: Constantine Plotnikov <[EMAIL PROTECTED]>
>>> > >> >> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>>> > >> >> Date: Wednesday, March 17, 1999 8:50 AM
>>> > >> >> Subject: Re: ejbCreate( ) - initialize instance variables
>>> > >> >>
>>> > >> >> >Hi!
>>> > >> >> >
>>> > >> >> >1. Do I understand it correctly?  In your server, initial
>>> > >> values for all
>>> > >> >> >   fields are saved for each instance and they are restored
>>> > >> right before
>>> > >> >> >   creation.
>>> > >> >> >
>>> > >> >> >2. If yes, how do you save values?
>>> > >> >> >   a) in serialized form
>>> > >> >> >   b) just pointers to values recived as Field.get()
>>> > >> >> >   c) other, please clarify what.
>>> > >> >> >
>>> > >> >> >3. If no, could you please clarify semantics of restoring values
>>> > >> >> >   in your server.
>>> > >> >> >
>>> > >> >> >Constantine
>>> > >> >> >
>>> > >> >> >Imre Kifor wrote:
>>> > >> >> >>
>>> > >> >> >> We believe that bean instances retrieved from the instance
>>> > >> pool should
>>> > >> >> >> always be in their initial state (i.e. the state right after
>>> > >> >> construction)
>>> > >> >> >> regardless of the used persistence management type.
>>> > >> >> >>
>>> > >> >> >> This means that with Ejipt your 'country' member will be
>>> > predictably
>>> > >> set
>>> > >> >> to
>>> > >> >> >> "USA" upon entering ejbCreate, ejbFindXXX and ejbActivate.
>>> > Moreover,
>>> > >> >> since
>>> > >> >> >> Ejipt resets all instances before returning them to the
>>> > >> pool, you will
>>> > >> >> also
>>> > >> >> >> be assured that your possibly sensitive or very large member
>data
>>> > is
>>> > >> not
>>> > >> >> >> held by pooled instances.
>>> > >> >> >>
>>> > >> >> >> Imre Kifor
>>> > >> >> >> Valto Systems
>>> > >> >> >>
>>> > >> >> >> -----Original Message-----
>>> > >> >> >> From: Sachin Aggarwal <[EMAIL PROTECTED]>
>>> > >> >> >> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>>> > >> >> >> Date: Tuesday, March 16, 1999 11:26 PM
>>> > >> >> >> Subject: ejbCreate( ) - initialize instance variables
>>> > >> >> >>
>>> > >> >> >> >The spec mentions that ejbCreate( ) initializes instance
>>> > variables.
>>> > >> >> >> >
>>> > >> >> >> >Question 1. Who's reponsibility is that in CMP beans ? The
>>> > >> containers
>>> > >> or
>>> > >> >> >> the
>>> > >> >> >> >bean developers?
>>> > >> >> >> >
>>> > >> >> >> >If the answer to above is Bean Developer, then:
>>> > >> >> >> >Q2. If the instance variable is declared as public String
>county
>>> > =
>>> > >> >> "USA";
>>> > >> >> >> >and the bean developer does not reinitialize it in
>>> > >> ejbCreate(), then
>>> > >> >> does
>>> > >> >> >> >the container have the right to initialize it to
>unpredicatable
>>> > >> values ?
>>> > >> >> >> >
>>> > >> >> >> >Thanks for your help.
>>> > >> >> >> >
>>> > >> >> >>
>>> > >> >>
>>> > >> >=================================================================
>>> > >> ==========
>>> > >> >> >> >To unsubscribe, send email to [EMAIL PROTECTED] and
>include
>>> > in
>>> > >> the
>>> > >> >> body
>>> > >> >> >> >of the message "signoff EJB-INTEREST".  For general help,
>>> > >> send email
>>> > >> to
>>> > >> >> >> >[EMAIL PROTECTED] and include in the body of the
>>> > >> message "help".
>>> > >> >> >> >
>>> > >> >> >> >
>>> > >> >> >>
>>> > >> >> >>
>>> > >> >>
>>> > >> ==================================================================
>>> > >> =========
>>> > >> >> >> To unsubscribe, send email to [EMAIL PROTECTED] and
>>> > >> include in the
>>> > >> >> body
>>> > >> >> >> of the message "signoff EJB-INTEREST".  For general help, send
>>> > email
>>> > >> to
>>> > >> >> >> [EMAIL PROTECTED] and include in the body of the message
>>> > "help".
>>> > >> >> >
>>> > >> >>
>>> > >> >=================================================================
>>> > >> ==========
>>> > >> >> >To unsubscribe, send email to [EMAIL PROTECTED] and include
>in
>>> > the
>>> > >> body
>>> > >> >> >of the message "signoff EJB-INTEREST".  For general help,
>>> > >> send email to
>>> > >> >> >[EMAIL PROTECTED] and include in the body of the message
>>> > "help".
>>> > >> >> >
>>> > >> >>
>>> > >> >>
>>> > >> ==================================================================
>>> > >> =========
>>> > >> >> To unsubscribe, send email to [EMAIL PROTECTED] and include
>in
>>> > the
>>> > >> body
>>> > >> >> of the message "signoff EJB-INTEREST".  For general help, send
>email
>>> > to
>>> > >> >> [EMAIL PROTECTED] and include in the body of the message
>"help".
>>> > >> >
>>> > >> >=================================================================
>>> > >> ==========
>>> > >> >To unsubscribe, send email to [EMAIL PROTECTED] and include
>>> > >> in the body
>>> > >> >of the message "signoff EJB-INTEREST".  For general help, send
>email
>>> > to
>>> > >> >[EMAIL PROTECTED] and include in the body of the message
>"help".
>>> > >> >
>>> > >>
>>> > >> ==================================================================
>>> > >> =========
>>> > >> To unsubscribe, send email to [EMAIL PROTECTED] and include
>>> > >> in the body
>>> > >> of the message "signoff EJB-INTEREST".  For general help, send email
>to
>>> > >> [EMAIL PROTECTED] and include in the body of the message "help".
>>> > >>
>>> > >>
>>> > >
>>> >
>>=========================================================================
>>> > ==
>>> > >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>>> > body
>>> > >of the message "signoff EJB-INTEREST".  For general help, send email
>to
>>> > >[EMAIL PROTECTED] and include in the body of the message "help".
>>> > >
>>> >
>>> >
>==========================================================================
>>> > =
>>> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>>> > body
>>> > of the message "signoff EJB-INTEREST".  For general help, send email to
>>> > [EMAIL PROTECTED] and include in the body of the message "help".
>>>
>>>
>===========================================================================
>>> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>>> of the message "signoff EJB-INTEREST".  For general help, send email to
>>> [EMAIL PROTECTED] and include in the body of the message "help".
>>
>>===========================================================================
>>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>>of the message "signoff EJB-INTEREST".  For general help, send email to
>>[EMAIL PROTECTED] and include in the body of the message "help".
>>
>>
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff EJB-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to