<BOB>The reasons for disallowing threads is that it disrupts the
container's
ability to manager the runtime environment. It can also throw off
services that are often dependent on threads such as transactions or
security.</BOB>

Yeah you are right Bob ..This was the main reason for disallowing User
threads within a bean as
it also makes it much harder for Resource and Transaction Managers to keep
track of the threads
especially when the system is supposed to be highly transactional.

<BOB>Actually, you're not supposed to use synchronization primitives to
synchronize the execution of multiple instances, as the bean may be
deployed in multiple VM's. This is not the case in the example below.
Actually, there will never even be contention for the lock below. The
same goes for statics.</BOB>

Kindly Elaborate




                    Bob Lee
                    <crazybob@CRAZYBO        To:     [EMAIL PROTECTED]
                    B.ORG>                   cc:
                    Sent by: A               Subject:     Re: synchronized
                    mailing list for
                    Enterprise
                    JavaBeans
                    development
                    <EJB-INTEREST@JAV
                    A.SUN.COM>


                    12/24/02 09:55 PM
                    Please respond to
                    Bob Lee





Actually, you're not supposed to use synchronization primitives to
synchronize the execution of multiple instances, as the bean may be
deployed in multiple VM's. This is not the case in the example below.
Actually, there will never even be contention for the lock below. The
same goes for statics.

The reasons for disallowing threads is that it disrupts the container's
ability to manager the runtime environment. It can also throw off
services that are often dependent on threads such as transactions or
security.

Thanks,
Bob

Aashish Kaushik wrote:
> Hi ,
> Yeah you are Right Pal,EJB specification disallows the use of the
> Synchronized Keyword,infact
> it also disallows creation of user defined threads within the EJB as
well.
> The main reason behind this could be that though EJB does allows
concurrent
> acess to beans(Leaving out
> Session beans) but it is the EJBObject who delegates one call at a time
to
> the Bean instance encapsulated
> so the use of Synchronize does not arise at all.
>
>
>
> Regards,
> Aashish
>
>
>
>
>                     Hans Schippers
>                     <saintman@PANDORA        To:
[EMAIL PROTECTED]
>                     .BE>                     cc:
>                     Sent by: A               Subject:     synchronized
>                     mailing list for
>                     Enterprise
>                     JavaBeans
>                     development
>                     <EJB-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     12/17/02 08:48 PM
>                     Please respond to
>                     Hans Schippers
>
>
>
>
>
> Hi,
>
> I'm using iContract (DBC tool) to instrument my Bean sources with
> preconditions and such...
>
> I've noticed however, that the instrumented code contains functions such
> as:
>
> private synchronized void
> __inv_check_at_exit__eenloketsysteem_entitybeans_AdresData(Thread
> thread, String loc)  {
>
> I recall having read somewhere that synchronized methods can't be used
> with EJB's, although I'm not entirely sure anymore...
>
> Will this lead to problems?
>
> Thanks,
>
> Hans
>
>
> --
> In a world without walls and fences, who needs windows and gates?
>
> Hans Schippers
> 1LIC INF
> UIA 2002-2003
>
>
===========================================================================
> 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