Assaf Arkin wrote:

> Laird Nelson wrote:
> >
> > Assaf Arkin wrote:
> >
> > [lots of good stuff]
> >
> > Could you additionally address dan's point from a later message that is
> > related to this, viz:
> >
> > > It is hard for me to believe that synchronize is not allowed (even as wrappers 
>around
> > > code within method calls).  For example suppose that I have created a multi-safe 
>data
> > > structure using synchronize.   Are you saying that I cant use that data structure
> > > within the bean?  Surely some of the jdk datastructures have synchronized 
>methods.
> >
> > Does this mean, for example, that I cannot use Hashtable or Vector in my
> > bean classes?
>
> Yes you can, as long as they are not shared between two threads.
>

This answer doesn't make sense to me. Either you can use a hashtable in an entity bean 
or you
cannot.   Why should I worry about threads now?

>
> If you use a Vector or Hashtable from one thread and something happens
> to your thread inside the synchronized stuff, your Hashtable/Vector
> might be corrupted. But you shouldn't care. IF something happens to your
> thread, the EJB server will discard that bean (always).
>
> If you are using two threads and something happens to thread A that
> leaves the Vector in an indeterminate state, then thread B might break
> and you have no control over that.
>
> I've just implemented some piece of the CMP engine that manages locks
> using synchronized. I expect that something might happen to the thread
> since the EJB server controls it, and have extra (even redundant) code
> just to make sure that never happens.
>
> In the Java 1.2 collections Sun addressed that by writing the collectors
> so they do not rely on synchronized.
>
> arkin
>
> >
> > Cheers,
> > Laird
> >
> > ===========================================================================
> > 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".
>
> --
> ----------------------------------------------------------------------
> Assaf Arkin                                           www.exoffice.com
> CTO, Exoffice Technologies, Inc.                        www.exolab.org
>
> ===========================================================================
> 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