----- Original Message -----
From: Rickard �berg <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 16, 2000 10:36 PM
Subject: Re: having a PRIVATE synchronized method in a session EJB


> I think I have identified your problem.
>
> > I believe, I do need the synchronized capability not only for private
case
> > but also for public methods in session EJB.
> > I created an "almost real life" scenario that illustrates the need for
synch
> > capability.
> > You can read the code but here summary.
> > I have a designed a class  (Complex) that was to be used by multiple
> > threads.
> > The class Complex has own variables, which are not stored in database.
> > I have two threads that theoretically could be on different machines and
> > know nothing about each other.
> > Consequently, I implemented "set"  and "print" methods with synch.
> > If I did not, I could get inconsistent results.
> >
> > Now my boss came to me and said that she wants the class to be
implemented
> > as EJB service.
>
> Here's your problem. Your boss "told you so". Yeah. Right.
> Now my boss came to me and said that she wants the class to be implemented
as EJB service.
Since I am lazy, I took easy approach and implented the service as:
ServiceClass extends OriginalClass implements SessionBean.
Now my clients can find the EJB service and call the methods of the
OriginalClass
which are synched.

It should be legal for two clients to access concurrently
ServiceClass(session bean).
Assuming that it is legal for two clients to access a single ServiceClass,
how do we enforce
the critical section within the ServiceClass.

Any ideas?

> Look, your code is not at all suited as an EJB. I would imagine that
> Complex objects could be *used* by EJB's, but it should not be an EJB by
> itself.
>
> What is the reason you want it as an EJB? What does it solve that it
> doesn't solve on its own?
>
> /Rickard
>
> --
> Rickard �berg
>
> @home: +46 13 177937
> Email: [EMAIL PROTECTED]
> http://www.dreambean.com
> Question reality
>
>
===========================================================================
> 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