Would this work :(?)

1. Auto load all the non-lazy fields on ejbLoad().
2. Keep a boolean (initialized to false) indicating if
the media has been loaded.
3. When the media accessor function is called
(getImage()), if the boolean is false, load the image
and set the boolean to true. Then return the image.

As far as the passivation, I would ditch the image and
set the boolean false.

//Nicholas





--- "Bolt, Dave" <[EMAIL PROTECTED]> wrote:
> I have an bean-managed entity bean which reads an
> image from a custom
> multimedia repository. The image is stored inside my
> bean as a byte array
> and can be served to a web client via a servlet. The
> bean is read-only in
> regards to the repository, it is not used as the
> mechanism for updating the
> binary data.
>
> I'd like to lazy load my bean, by only talking to
> the media repository (via
> sockets) when absolutely needed. This will keep the
> load on the server down.
> The only reliable scheme I have found is to code the
> read into my ejbLoad()
> callback so that it happens every time.
>
> Here is what I'd like.
>
> 1) Load the media only when the media is requested,
> once it is requested, it
> can stay in memory until passivated.
> 2) If the media has been loaded, I need the bean to
> dump it and reload it
> when my bean instance is swapped out.
>
> Thus loading the media is defered, until absolutely
> necessary, but once
> loaded it is maintained in memory until the bean is
> swapped out.
>
> What scheme can I use that combines ejbActivate(),
> ejbPassivate(), and
> ejbLoad() to get this behavior.
>
> Dave Bolt
> There is always plenty of bandwidth, just none for
> you.
>
>
===========================================================================
> 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".
>


=====
Nicholas Whitehead
Home: (973) 377 9335
Cell: (973) 615 9646
[EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

===========================================================================
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