Re: AW: Synchronizing ejb method
Thomas Marsh <[email protected]> Fri, 19 May 2006 06:44:04 -0400
| Newsgroups | gmane.comp.java.sun.ejb.general,gmane.spam.detected |
|---|---|
| Organization | http://www.nitesco.com |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Please don't use HTML Mail. Automatic digest processor wrote: | There are 4 messages totalling 1625 lines in this issue. | | Topics of the day: | | 1. AW: Synchronizing ejb method (4) | | =========================================================================== | 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". | | | ---------------------------------------------------------------------- | | Date: Thu, 18 May 2006 21:24:42 -0500 | From: Tareq Ayub <[email protected]> | Subject: Re: AW: Synchronizing ejb method | | --Apple-Mail-14-47074737 | Content-Transfer-Encoding: quoted-printable | Content-Type: text/plain; | charset=ISO-8859-1; | delsp=yes; | format=flowed | | Refer to the EJB spec. The container will not allow multiple threads =20 | to use the same instance of an SLSB. =46rom the spec - "The container =20= | | must ensure that only one thread can be executing an instance at any =20 | time". Given that, why would you want to synchronize on an EJB method =20= | | anyways ? Also, SLSB have no state (no instance variables). The same =20= | | principle applies to SFSB in addition to the fact an instance is tied =20= | | to a single client. | | Tareq | | On May 15, 2006, at 2:40 AM, Andreas Berg wrote: | | |>You shouldn't. The only reason to synchronize a stateless session =20 |>bean is if your bean is not stateless. Then ask yourself why you =20 |>chose a stateless bean for some stateful purpose. |> |>If you really want to synchronize your SLSB you need to think about =20= | | |>the runtime environment. If all the instances of the SLSB run in a =20 |>single JVM, you can use the standard Java synchronization features =20 |>inside the bean to synchronize. But this doesn't work with a =20 |>clustered environment. AFAIK there is no standard approach to solve =20= | | |>this. |> |>Kind regards, |> |>Andreas. |> |> |>Andreas Berg |>Zelfi AG |>Hechtsheimer Stra=DFe 33 |>55131 Mainz |>Telefon: 06131-9064850 |>Telefax: 06131-9064853 |>[email protected] |>http://www.zelfi.com/ |> |> |>Von: A mailing list for Enterprise JavaBeans development =20 |>[mailto:[email protected]] Im Auftrag von Kalra, Ashwani |>Gesendet: Montag, 15. Mai 2006 06:42 |>An: [email protected] |>Betreff: Synchronizing ejb method |> |>Hi, |>The client of my ejb can be an jsp or standalone java class. How =20 |>can I synchronize access to the SLSB ejb method? I am using ejb2.0 =20 |>version |> |> |>__________________ |>Regards |>Ashwani Kalra |> |> |>This message contains information that may be privileged or =20 |>confidential and is the property of the Capgemini Group. It is =20 |>intended only for the person to whom it is addressed. If you are =20 |>not the intended recipient, you are not authorized to read, print, =20 |>retain, copy, disseminate, distribute, or use this message or any =20 |>part thereof. If you receive this message in error, please notify =20 |>the sender immediately and delete all copies of this message. |> |>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | |>=3D=3D=3D=3D=3D To unsubscribe, send email to [email protected] = | | and =20 | |>include in the body of the message "signoff EJB-INTEREST". For =20 |>general help, send email to [email protected] and include in =20 |>the body of the message "help". |> |>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | |>=3D=3D=3D=3D=3D To unsubscribe, send email to [email protected] = | | and =20 | |>include in the body of the message "signoff EJB-INTEREST". For =20 |>general help, send email to [email protected] and include in =20 |>the body of the message "help". |> | | | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | | | --Apple-Mail-14-47074737 | Content-Transfer-Encoding: quoted-printable | Content-Type: text/html; | charset=ISO-8859-1 | | <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = | -khtml-line-break: after-white-space; ">Refer to the EJB spec. The = | container will not allow multiple threads to use the same instance of an = | SLSB. =46rom the spec - "<FONT class=3D"Apple-style-span" face=3D"Verdana"= | size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: = | 13px;">The container must ensure that only one thread can be executing = | an instance at any time". Given that, why would you want to synchronize = | on an EJB method anyways ? Also, SLSB have no state (no instance = | variables).=A0 The same principle applies to SFSB in addition to the = | fact an instance is tied to a single client.</SPAN></FONT><DIV><BR = | class=3D"khtml-block-placeholder"></DIV><DIV><FONT = | class=3D"Apple-style-span" face=3D"Verdana" size=3D"3"><SPAN = | class=3D"Apple-style-span" style=3D"font-size: = | 13px;"></SPAN></FONT>Tareq<DIV><FONT class=3D"Apple-style-span" = | face=3D"Verdana" size=3D"3"><SPAN class=3D"Apple-style-span" = | style=3D"font-size: 13px;"><BR></SPAN></FONT><DIV><DIV>On May 15, 2006, = | at 2:40 AM, Andreas Berg wrote:</DIV><BR = | class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"> <DIV = | dir=3D"ltr" align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"><SPAN class=3D"265003407-15052006">You shouldn't.=A0The only = | reason=A0to synchronize a stateless session bean is if your bean is not = | stateless. Then ask yourself why you chose a stateless bean for some = | stateful purpose.</SPAN></FONT></DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006"></SPAN></FONT>=A0</DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006">If you really want to synchronize your SLSB = | you need to think about the runtime environment. If all the instances of = | the SLSB run in a single JVM, you can use the standard Java = | synchronization features inside the bean to synchronize. But this = | doesn't work with a clustered environment. AFAIK there is no standard = | approach to solve this.</SPAN></FONT></DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006"></SPAN></FONT>=A0</DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006">Kind regards,</SPAN></FONT></DIV> <DIV = | dir=3D"ltr" align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"><SPAN class=3D"265003407-15052006"></SPAN></FONT>=A0</DIV> = | <DIV dir=3D"ltr" align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"><SPAN class=3D"265003407-15052006">Andreas.</SPAN></FONT></DIV>= | <DIV>=A0</DIV> <DIV align=3D"left"><FONT face=3D"Arial" color=3D"#000000"= | size=3D"2"></FONT>=A0</DIV> <DIV align=3D"left"><FONT face=3D"Arial" = | color=3D"#808000" size=3D"1">Andreas Berg<BR>Zelfi AG<BR>Hechtsheimer = | Stra=DFe 33<BR>55131 Mainz<BR>Telefon: = | 06131-9064850<BR>Telefax:=A006131-9064853</FONT></DIV> <DIV = | align=3D"left"><FONT face=3D"Arial" color=3D"#808000" size=3D"1"><A = | href=3D"mailto:[email protected]">[email protected]</A></FONT></= | DIV> <DIV align=3D"left"><FONT face=3D"Arial" color=3D"#808000" = | size=3D"1"><A = | href=3D"http://www.zelfi.com/">http://www.zelfi.com/</A></FONT></DIV> = | <DIV>=A0</DIV><BR> <DIV class=3D"OutlookMessageHeader" lang=3D"de" = | dir=3D"ltr" align=3D"left"> <HR tabindex=3D"-1"> <FONT face=3D"Tahoma" = | size=3D"2"><B>Von:</B> A mailing list for Enterprise JavaBeans = | development [<A = | href=3D"mailto:[email protected]">mailto:[email protected]= | </A>] <B>Im Auftrag von </B>Kalra, Ashwani<BR><B>Gesendet:</B> Montag, = | 15. Mai 2006 06:42<BR><B>An:</B> <A = | href=3D"mailto:[email protected]">[email protected]</A><BR= | |><B>Betreff:</B> Synchronizing ejb method<BR></FONT><BR></DIV> = | | <DIV></DIV> <DIV><SPAN class=3D"087493904-15052006"><FONT face=3D"Arial" = | size=3D"2">Hi,</FONT></SPAN></DIV> <DIV><SPAN = | class=3D"087493904-15052006"><FONT face=3D"Arial" size=3D"2">The client = | of my ejb can be an jsp or standalone java class.=A0 How can I = | synchronize access to the SLSB ejb method? I am using ejb2.0 = | version</FONT></SPAN></DIV> <DIV><SPAN class=3D"087493904-15052006"><FONT = | face=3D"Arial" size=3D"2"></FONT></SPAN>=A0</DIV> <DIV>=A0</DIV><P><SPAN = | lang=3D"en-us"><FONT face=3D"Arial" = | size=3D"2">__________________</FONT></SPAN> <BR><SPAN lang=3D"en-us"><FONT= | face=3D"Tahoma" size=3D"2">Regards</FONT></SPAN> <BR><SPAN = | lang=3D"en-us"><B><FONT face=3D"Tahoma" size=3D"2">Ashwani = | Kalra</FONT></B></SPAN> <BR></P> <DIV>=A0</DIV> <TABLE> <TBODY><TR><TD = | bgcolor=3D"#ffffff"><FONT color=3D"#000000">This message contains = | information that may be privileged or confidential and is the = | property of the Capgemini Group. It is intended only for the = | person to whom it is addressed. If you are not the intended = | recipient, you are not authorized to read, print, retain, copy, = | disseminate, distribute, or use this message or any part thereof. = | If you receive this message in error, please notify the sender = | immediately and delete all copies of this = | message.<BR><BR></FONT></TD></TR></TBODY></TABLE>=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D To unsubscribe, send = | email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "signoff EJB-INTEREST". For general = | help, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "help". <DIV><BR = | class=3D"khtml-block-placeholder"></DIV> = | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | To unsubscribe, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "signoff EJB-INTEREST". For general = | help, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "help". <DIV><BR = | class=3D"khtml-block-placeholder"></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV= | |></BODY></HTML>= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | <p> | | --Apple-Mail-14-47074737-- | | ------------------------------ | | Date: Fri, 19 May 2006 09:45:47 +0530 | From: "Kalra, Ashwani" <[email protected]> | Subject: Re: AW: Synchronizing ejb method | | This is a multi-part message in MIME format. | | ------_=_NextPart_001_01C67AFA.C8E29114 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: quoted-printable | | | No its not correct=2E=20 | Section 7=2E5=2E8 , Ejb 2=2E1 | =20 | "Clients are not allowed to make concurrent calls to a stateful session= | object=2E If a client-invoked business | | method is in progress on an instance when another client-invoked call, from= | the same or different client, | | arrives at the same instance of a stateful session bean class, the= | container may throw the | | java=2Ermi=2ERemoteException to the second client[7] if the client is a= | remote client, or the | | javax=2Eejb=2EEJBException if the client is a local client=2E This= | restriction does not apply to a stateless | | session bean because the container routes each request to a different= | instance of the session bean | | class=2E" | | I think there is no standard approach as Andreas said=2E My problem is that= | there is some batch process running and there is jsp page that can access= | the same method of ejb which I wanted to avoid=2E I think I can use= | statefull session bean so that at least second client gets the exception= | =2E | | =20 | | Thanks | | Ashwani | | =20 | | =20 | | | ________________________________ | | From: A mailing list for Enterprise JavaBeans development= | [mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM] On Behalf Of Tareq Ayub | Sent: Friday, May 19, 2006 7:55 AM | To: EJB-INTEREST@JAVA=2ESUN=2ECOM | Subject: Re: AW: Synchronizing ejb method | | | Refer to the EJB spec=2E The container will not allow multiple threads to= | use the same instance of an SLSB=2E From the spec - "The container must= | ensure that only one thread can be executing an instance at any time"=2E= | Given that, why would you want to synchronize on an EJB method anyways ?= | Also, SLSB have no state (no instance variables)=2E The same principle= | applies to SFSB in addition to the fact an instance is tied to a single= | client=2E=20 | | Tareq=20 | | | On May 15, 2006, at 2:40 AM, Andreas Berg wrote: | | | You shouldn't=2E The only reason to synchronize a stateless session bean= | is if your bean is not stateless=2E Then ask yourself why you chose a= | stateless bean for some stateful purpose=2E | =20 | If you really want to synchronize your SLSB you need to think about the= | runtime environment=2E If all the instances of the SLSB run in a single= | JVM, you can use the standard Java synchronization features inside the= | bean to synchronize=2E But this doesn't work with a clustered environment= | =2E AFAIK there is no standard approach to solve this=2E | =20 | Kind regards, | =20 | Andreas=2E | =20 | =20 | Andreas Berg | Zelfi AG | Hechtsheimer Stra=DFe 33 | 55131 Mainz | Telefon: 06131-9064850 | Telefax: 06131-9064853 | andreas=2Eberg@zelfi=2Ecom | http://www=2Ezelfi=2Ecom/ | =20 | | ________________________________ | | Von: A mailing list for Enterprise JavaBeans development= | [mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM] Im Auftrag von Kalra, Ashwani | Gesendet: Montag, 15=2E Mai 2006 06:42 | An: EJB-INTEREST@JAVA=2ESUN=2ECOM | Betreff: Synchronizing ejb method | =09 | =09 | Hi, | The client of my ejb can be an jsp or standalone java class=2E How can I= | synchronize access to the SLSB ejb method? I am using ejb2=2E0 version | =20 | =20 | | __________________=20 | Regards=20 | Ashwani Kalra=20 | =09 | | =20 | This message contains information that may be privileged or confidential= | and is the property of the Capgemini Group=2E It is intended only for the= | person to whom it is addressed=2E If you are not the intended recipient,= | you are not authorized to read, print, retain, copy, disseminate,= | distribute, or use this message or any part thereof=2E If you receive this= | message in error, please notify the sender immediately and delete all= | copies of this message=2E | | =09 | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in= | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email to listserv@java=2Esun=2Ecom and include in the body of the message= | "help"=2E=20 | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in= | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email to listserv@java=2Esun=2Ecom and include in the body of the message= | "help"=2E=20 | | | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in the= | body of the message "signoff EJB-INTEREST"=2E For general help, send email= | to listserv@java=2Esun=2Ecom and include in the body of the message "help"= | =2E=20 | | | | This message contains information that may be privileged or confidential= | and is the property of the Capgemini Group=2E It is intended only for the= | person to whom it is addressed=2E If you are not the intended recipient, = | you are not authorized to read, print, retain, copy, disseminate, = | distribute, or use this message or any part thereof=2E If you receive this= | message in error, please notify the sender immediately and delete all = | copies of this message=2E | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | | | ------_=_NextPart_001_01C67AFA.C8E29114 | Content-Type: text/html; | charset="iso-8859-1" | Content-Transfer-Encoding: quoted-printable | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4=2E0 Transitional//EN"> | <HTML><HEAD> | <META http-equiv=3DContent-Type content=3D"text/html; charset= | =3Diso-8859-1"> | <META content=3D"MSHTML 6=2E00=2E2900=2E2873" name=3DGENERATOR></HEAD> | <BODY=20 | style=3D"WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break:= | after-white-space"> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT face= | =3DArial=20 | color=3D#0000ff size=3D2>No its not correct=2E </FONT></SPAN></DIV> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT face= | =3DArial=20 | color=3D#0000ff size=3D2>Section 7=2E5=2E8 , Ejb 2=2E1</FONT></SPAN></DIV> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT face= | =3DArial=20 | color=3D#0000ff size=3D2></FONT></SPAN> </DIV> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT size= | =3D2><SPAN=20 | class=3D734250804-19052006>"</SPAN>Clients are not allowed to make= | concurrent=20 | calls to a <STRONG>stateful session object</STRONG>=2E If a client-invoked= | =20 | business</FONT></DIV> | <DIV dir=3Dltr align=3Dleft> | <P align=3Dleft><FONT size=3D2>method is in progress on an instance when= | another=20 | client-invoked call, from the same or different client,</FONT></P> | <P align=3Dleft><FONT size=3D2>arrives at the same instance of a stateful= | session=20 | bean class, the container may throw the</FONT></P><FONT face=3DCourier size= | =3D2> | <P align=3Dleft>java=2Ermi=2ERemoteException </FONT><FONT face=3D"Times New= | Roman"=20 | size=3D2>to the second client</FONT><FONT face=3D"Times New Roman" size= | =3D1>[7]=20 | </FONT><FONT face=3D"Times New Roman" size=3D2>if the client is a remote= | client, or=20 | the</P></FONT><FONT face=3DCourier size=3D2> | <P align=3Dleft>javax=2Eejb=2EEJBException </FONT><FONT size=3D2>if the= | client is a=20 | local client=2E This restriction does not apply to a stateless</FONT></P> | <P align=3Dleft><FONT size=3D2>session bean because the container routes= | each=20 | request to a different instance of the session bean</FONT></P> | <P align=3Dleft><FONT size=3D2>class=2E<SPAN=20 | class=3D734250804-19052006>"</SPAN></FONT></P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT size=3D2><FONT face= | =3DArial=20 | color=3D#0000ff>I think there is no standard approach as Andreas said=2E My= | problem=20 | is that there is some batch process running and there is jsp page that can= | =20 | access the same method of ejb which I wanted to avoid</FONT>=2E <FONT face= | =3DArial=20 | color=3D#0000ff>I think I can use statefull session bean so that at least= | second=20 | client gets the exception=2E</FONT></FONT></SPAN></P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT face=3DArial color= | =3D#0000ff=20 | size=3D2></FONT></SPAN> </P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT face=3DArial color= | =3D#0000ff=20 | size=3D2>Thanks</FONT></SPAN></P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT face=3DArial color= | =3D#0000ff=20 | size=3D2>Ashwani</FONT></SPAN></P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT face=3DArial color= | =3D#0000ff=20 | size=3D2></FONT></SPAN> </P> | <P align=3Dleft><FONT size=3D2><SPAN=20 | class=3D734250804-19052006></SPAN></FONT> </P></SPAN></DIV><BR> | <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> | <HR tabIndex=3D-1> | <FONT face=3DTahoma size=3D2><B>From:</B> A mailing list for Enterprise= | JavaBeans=20 | development [mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM] <B>On Behalf Of= | </B>Tareq=20 | Ayub<BR><B>Sent:</B> Friday, May 19, 2006 7:55 AM<BR><B>To:</B>=20 | EJB-INTEREST@JAVA=2ESUN=2ECOM<BR><B>Subject:</B> Re: AW: Synchronizing ejb= | =20 | method<BR></FONT><BR></DIV> | <DIV></DIV>Refer to the EJB spec=2E The container will not allow multiple= | threads=20 | to use the same instance of an SLSB=2E From the spec - "<FONT=20 | class=3DApple-style-span face=3DVerdana size=3D3><SPAN class= | =3DApple-style-span=20 | style=3D"FONT-SIZE: 13px">The container must ensure that only one thread= | can be=20 | executing an instance at any time"=2E Given that, why would you want to=20 | synchronize on an EJB method anyways ? Also, SLSB have no state (no= | instance=20 | variables)=2E The same principle applies to SFSB in addition to the= | fact an=20 | instance is tied to a single client=2E</SPAN></FONT> | <DIV><BR class=3Dkhtml-block-placeholder></DIV> | <DIV><FONT class=3DApple-style-span face=3DVerdana size=3D3><SPAN=20 | class=3DApple-style-span style=3D"FONT-SIZE: 13px"></SPAN></FONT>Tareq | <DIV><FONT class=3DApple-style-span face=3DVerdana size=3D3><SPAN=20 | class=3DApple-style-span style=3D"FONT-SIZE: 13px"><BR></SPAN></FONT> | <DIV> | <DIV>On May 15, 2006, at 2:40 AM, Andreas Berg wrote:</DIV><BR=20 | class=3DApple-interchange-newline> | <BLOCKQUOTE type=3D"cite"> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>You shouldn't=2E The only reason to= | =20 | synchronize a stateless session bean is if your bean is not stateless=2E= | Then=20 | ask yourself why you chose a stateless bean for some stateful=20 | purpose=2E</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>If you really want to synchronize your SLSB= | you need=20 | to think about the runtime environment=2E If all the instances of the= | SLSB run=20 | in a single JVM, you can use the standard Java synchronization features= | inside=20 | the bean to synchronize=2E But this doesn't work with a clustered= | environment=2E=20 | AFAIK there is no standard approach to solve this=2E</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>Kind regards,</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>Andreas=2E</SPAN></FONT></DIV> | <DIV> </DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#000000 size= | =3D2></FONT> </DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#808000 size=3D1>Andreas= | Berg<BR>Zelfi=20 | AG<BR>Hechtsheimer Stra=DFe 33<BR>55131 Mainz<BR>Telefon:=20 | 06131-9064850<BR>Telefax: 06131-9064853</FONT></DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#808000 size=3D1><A=20 | href=3D"mailto:andreas=2Eberg@zelfi=2Ecom">andreas=2Eberg@zelfi= | =2Ecom</A></FONT></DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#808000 size=3D1><A=20 | href=3D"http://www=2Ezelfi=2Ecom/">http://www=2Ezelfi= | =2Ecom/</A></FONT></DIV> | <DIV> </DIV><BR> | <DIV class=3DOutlookMessageHeader lang=3Dde dir=3Dltr align=3Dleft> | <HR tabIndex=3D-1> | <FONT face=3DTahoma size=3D2><B>Von:</B> A mailing list for Enterprise= | JavaBeans=20 | development [<A=20 | href=3D"mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM">mailto:EJB-INTEREST@JAVA= | =2ESUN=2ECOM</A>]=20 | <B>Im Auftrag von </B>Kalra, Ashwani<BR><B>Gesendet:</B> Montag, 15=2E= | Mai 2006=20 | 06:42<BR><B>An:</B> <A=20 | href=3D"mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM">EJB-INTEREST@JAVA=2ESUN= | =2ECOM</A><BR><B>Betreff:</B>=20 | Synchronizing ejb method<BR></FONT><BR></DIV> | <DIV></DIV> | <DIV><SPAN class=3D087493904-15052006><FONT face=3DArial=20 | size=3D2>Hi,</FONT></SPAN></DIV> | <DIV><SPAN class=3D087493904-15052006><FONT face=3DArial size=3D2>The= | client of my=20 | ejb can be an jsp or standalone java class=2E How can I synchronize= | access=20 | to the SLSB ejb method? I am using ejb2=2E0 version</FONT></SPAN></DIV> | <DIV><SPAN class=3D087493904-15052006><FONT face=3DArial=20 | size=3D2></FONT></SPAN> </DIV> | <DIV> </DIV> | <P><SPAN lang=3Den-us><FONT face=3DArial size= | =3D2>__________________</FONT></SPAN>=20 | <BR><SPAN lang=3Den-us><FONT face=3DTahoma size=3D2>Regards</FONT></SPAN>= | <BR><SPAN=20 | lang=3Den-us><B><FONT face=3DTahoma size=3D2>Ashwani= | Kalra</FONT></B></SPAN>=20 | <BR></P> | <DIV> </DIV> | <TABLE> | <TBODY> | <TR> | <TD bgColor=3D#ffffff><FONT color=3D#000000>This message contains=20 | information that may be privileged or confidential and is the= | property=20 | of the Capgemini Group=2E It is intended only for the person to= | whom it is=20 | addressed=2E If you are not the intended recipient, you are not= | authorized=20 | to read, print, retain, copy, disseminate, distribute, or use this= | =20 | message or any part thereof=2E If you receive this message in= | error,=20 | please notify the sender immediately and delete all copies of this= | =20 | message=2E<BR><BR></FONT></TD></TR></TBODY></TABLE>=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | To unsubscribe, send email to <A=20 | href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun=2Ecom</A>= | and include in=20 | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email=20 | to <A href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun= | =2Ecom</A> and=20 | include in the body of the message "help"=2E=20 | <DIV><BR=20 | class=3Dkhtml-block-placeholder></DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | To unsubscribe, send email to <A=20 | href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun=2Ecom</A>= | and include in=20 | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email=20 | to <A href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun= | =2Ecom</A> and=20 | include in the body of the message "help"=2E=20 | <DIV><BR=20 | class=3Dkhtml-block-placeholder></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV>= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =20 | To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in the= | body of=20 | the message "signoff EJB-INTEREST"=2E For general help, send email to=20 | listserv@java=2Esun=2Ecom and include in the body of the message "help"=2E= | =20 | <P></P></BODY></HTML> | | <table><tr><td bgcolor=3D#ffffff><font color=3D#000000>This message= | contains information that may be privileged or confidential and is the= | property of the Capgemini Group=2E It is intended only for the person to= | whom it is addressed=2E If you are not the intended recipient, you are= | not authorized to read, print, retain, copy, disseminate, distribute, or= | use this message or any part thereof=2E If you receive this message in= | error, please notify the sender immediately and delete all copies of this= | message=2E<br> | <br> | </font></td></tr></table> | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | <p> | ------_=_NextPart_001_01C67AFA.C8E29114-- | | ------------------------------ | | Date: Fri, 19 May 2006 07:33:14 +0200 | From: Johan Eltes <[email protected]> | Subject: Re: AW: Synchronizing ejb method | | --Apple-Mail-1-58386373 | Content-Transfer-Encoding: quoted-printable | Content-Type: text/plain; | charset=ISO-8859-1; | delsp=yes; | format=flowed | | I don't think the batch and the clients will get th same session id. =20 | That's the whole idea of stateful session beans - that each client =20 | gets its own instance and that the instance has affinity for requests =20= | | from its owning "user" during the lifetime of the users session. I =20 | would recommend application-controlled database state management for =20 | locking out one type of client from the other (with stateless session =20= | | bean). | | /Johan | | 19 maj 2006 kl. 06.15 skrev Kalra, Ashwani: | | |>No its not correct. |>Section 7.5.8 , Ejb 2.1 |> |>"Clients are not allowed to make concurrent calls to a stateful =20 |>session object. If a client-invoked business |>method is in progress on an instance when another client-invoked =20 |>call, from the same or different client, |> |>arrives at the same instance of a stateful session bean class, the =20 |>container may throw the |> |>java.rmi.RemoteException to the second client[7] if the client is a =20= | | |>remote client, or the |> |>javax.ejb.EJBException if the client is a local client. This =20 |>restriction does not apply to a stateless |> |>session bean because the container routes each request to a =20 |>different instance of the session bean |> |>class." |> |>I think there is no standard approach as Andreas said. My problem =20 |>is that there is some batch process running and there is jsp page =20 |>that can access the same method of ejb which I wanted to avoid. I =20 |>think I can use statefull session bean so that at least second =20 |>client gets the exception. |> |> |>Thanks |> |>Ashwani |> |> |> |> |>From: A mailing list for Enterprise JavaBeans development =20 |>[mailto:[email protected]] On Behalf Of Tareq Ayub |>Sent: Friday, May 19, 2006 7:55 AM |>To: [email protected] |>Subject: Re: AW: Synchronizing ejb method |> |>Refer to the EJB spec. The container will not allow multiple =20 |>threads to use the same instance of an SLSB. =46rom the spec - "The =20= | | |>container must ensure that only one thread can be executing an =20 |>instance at any time". Given that, why would you want to =20 |>synchronize on an EJB method anyways ? Also, SLSB have no state (no =20= | | |>instance variables). The same principle applies to SFSB in =20 |>addition to the fact an instance is tied to a single client. |> |>Tareq |> |>On May 15, 2006, at 2:40 AM, Andreas Berg wrote: |> |> |>>You shouldn't. The only reason to synchronize a stateless session =20 |>>bean is if your bean is not stateless. Then ask yourself why you =20 |>>chose a stateless bean for some stateful purpose. |>> |>>If you really want to synchronize your SLSB you need to think =20 |>>about the runtime environment. If all the instances of the SLSB =20 |>>run in a single JVM, you can use the standard Java synchronization =20= | | |>>features inside the bean to synchronize. But this doesn't work =20 |>>with a clustered environment. AFAIK there is no standard approach =20 |>>to solve this. |>> |>>Kind regards, |>> |>>Andreas. |>> |>> |>>Andreas Berg |>>Zelfi AG |>>Hechtsheimer Stra=DFe 33 |>>55131 Mainz |>>Telefon: 06131-9064850 |>>Telefax: 06131-9064853 |>>[email protected] |>>http://www.zelfi.com/ |>> |>> |>>Von: A mailing list for Enterprise JavaBeans development =20 |>>[mailto:[email protected]] Im Auftrag von Kalra, Ashwani |>>Gesendet: Montag, 15. Mai 2006 06:42 |>>An: [email protected] |>>Betreff: Synchronizing ejb method |>> |>>Hi, |>>The client of my ejb can be an jsp or standalone java class. How =20 |>>can I synchronize access to the SLSB ejb method? I am using ejb2.0 =20= | | |>>version |>> |>> |>>__________________ |>>Regards |>>Ashwani Kalra |>> |>> |>>This message contains information that may be privileged or =20 |>>confidential and is the property of the Capgemini Group. It is =20 |>>intended only for the person to whom it is addressed. If you are =20 |>>not the intended recipient, you are not authorized to read, print, =20= | | |>>retain, copy, disseminate, distribute, or use this message or any =20 |>>part thereof. If you receive this message in error, please notify =20 |>>the sender immediately and delete all copies of this message. |>> |>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | |>>=3D=3D=3D=3D=3D=3D To unsubscribe, send email to = | | [email protected] and =20 | |>>include in the body of the message "signoff EJB-INTEREST". For =20 |>>general help, send email to [email protected] and include in =20 |>>the body of the message "help". |>> |>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | |>>=3D=3D=3D=3D=3D=3D To unsubscribe, send email to = | | [email protected] and =20 | |>>include in the body of the message "signoff EJB-INTEREST". For =20 |>>general help, send email to [email protected] and include in =20 |>>the body of the message "help". |>> |> |>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | |>=3D=3D=3D=3D=3D To unsubscribe, send email to [email protected] = | | and =20 | |>include in the body of the message "signoff EJB-INTEREST". For =20 |>general help, send email to [email protected] and include in =20 |>the body of the message "help". |> |>This message contains information that may be privileged or =20 |>confidential and is the property of the Capgemini Group. It is =20 |>intended only for the person to whom it is addressed. If you are =20 |>not the intended recipient, you are not authorized to read, print, =20 |>retain, copy, disseminate, distribute, or use this message or any =20 |>part thereof. If you receive this message in error, please notify =20 |>the sender immediately and delete all copies of this message. |> |>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | |>=3D=3D=3D=3D=3D To unsubscribe, send email to [email protected] = | | and =20 | |>include in the body of the message "signoff EJB-INTEREST". For =20 |>general help, send email to [email protected] and include in =20 |>the body of the message "help". |> | | | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | | | --Apple-Mail-1-58386373 | Content-Transfer-Encoding: quoted-printable | Content-Type: text/html; | charset=ISO-8859-1 | | <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = | -khtml-line-break: after-white-space; ">I don't think the batch and the = | clients will get th same session id. That's the whole idea of stateful = | session beans - that each client gets its own instance and that the = | instance has affinity for requests from its owning "user" during the = | lifetime of the users session. I would recommend application-controlled = | database state management for locking out one type of client from the = | other (with stateless session bean).<DIV><BR = | class=3D"khtml-block-placeholder"></DIV><DIV>/Johan</DIV><DIV><BR><DIV><DI= | V>19 maj 2006 kl. 06.15 skrev Kalra, Ashwani:</DIV><BR = | class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"> <DIV = | dir=3D"ltr" align=3D"left"><SPAN class=3D"734250804-19052006"><FONT = | face=3D"Arial" color=3D"#0000ff" size=3D"2">No its not correct. = | </FONT></SPAN></DIV> <DIV dir=3D"ltr" align=3D"left"><SPAN = | class=3D"734250804-19052006"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2">Section 7.5.8 , Ejb 2.1</FONT></SPAN></DIV> <DIV dir=3D"ltr" = | align=3D"left"><SPAN class=3D"734250804-19052006"><FONT face=3D"Arial" = | color=3D"#0000ff" size=3D"2"></FONT></SPAN>=A0</DIV> <DIV dir=3D"ltr" = | align=3D"left"><SPAN class=3D"734250804-19052006"><FONT size=3D"2"><SPAN = | class=3D"734250804-19052006">"</SPAN>Clients are not allowed to make = | concurrent calls to a <STRONG>stateful session object</STRONG>. If a = | client-invoked business</FONT></SPAN></DIV> <DIV dir=3D"ltr" = | align=3D"left"><P align=3D"left"><FONT size=3D"2">method is in progress = | on an instance when another client-invoked call, from the same or = | different client,</FONT></P><P align=3D"left"><FONT size=3D"2">arrives = | at the same instance of a stateful session bean class, the container may = | throw the</FONT></P><FONT face=3D"Courier" size=3D"2"> </FONT><P = | align=3D"left"><FONT face=3D"Courier" size=3D"2">java.rmi.RemoteException = | </FONT><FONT face=3D"Times New Roman" size=3D"2">to the second = | client</FONT><FONT face=3D"Times New Roman" size=3D"1">[7] </FONT><FONT = | face=3D"Times New Roman" size=3D"2">if the client is a remote client, or = | the</FONT></P><FONT face=3D"Times New Roman" size=3D"2"></FONT><FONT = | face=3D"Courier" size=3D"2"> </FONT><P align=3D"left"><FONT = | face=3D"Courier" size=3D"2">javax.ejb.EJBException </FONT><FONT = | size=3D"2">if the client is a local client. This restriction does not = | apply to a stateless</FONT></P><P align=3D"left"><FONT size=3D"2">session = | bean because the container routes each request to a different instance = | of the session bean</FONT></P><P align=3D"left"><FONT = | size=3D"2">class.<SPAN class=3D"734250804-19052006">"</SPAN></FONT></P><P = | align=3D"left"><SPAN class=3D"734250804-19052006"><FONT size=3D"2"><FONT = | face=3D"Arial" color=3D"#0000ff">I think there is no standard approach = | as Andreas said. My problem is that there is some batch process running = | and there is jsp page that can access the same method of ejb which I = | wanted to avoid</FONT>. <FONT face=3D"Arial" color=3D"#0000ff">I think I = | can use statefull session bean so that at least second client gets the = | exception.</FONT></FONT></SPAN></P><DIV><SPAN = | class=3D"734250804-19052006"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"></FONT></SPAN>=A0<BR class=3D"khtml-block-placeholder"></DIV><P= | align=3D"left"><SPAN class=3D"734250804-19052006"><FONT face=3D"Arial" = | color=3D"#0000ff" size=3D"2">Thanks</FONT></SPAN></P><P = | align=3D"left"><SPAN class=3D"734250804-19052006"><FONT face=3D"Arial" = | color=3D"#0000ff" size=3D"2">Ashwani</FONT></SPAN></P><DIV><SPAN = | class=3D"734250804-19052006"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"></FONT></SPAN>=A0<BR = | class=3D"khtml-block-placeholder"></DIV><DIV><FONT size=3D"2"><SPAN = | class=3D"734250804-19052006"></SPAN></FONT>=A0<BR = | class=3D"khtml-block-placeholder"></DIV></DIV><BR> <DIV = | class=3D"OutlookMessageHeader" lang=3D"en-us" dir=3D"ltr" align=3D"left"> = | <HR tabindex=3D"-1"> <FONT face=3D"Tahoma" size=3D"2"><B>From:</B> A = | mailing list for Enterprise JavaBeans development [<A = | href=3D"mailto:[email protected]">mailto:[email protected]= | </A>] <B>On Behalf Of </B>Tareq Ayub<BR><B>Sent:</B> Friday, May 19, = | 2006 7:55 AM<BR><B>To:</B> <A = | href=3D"mailto:[email protected]">[email protected]</A><BR= | |><B>Subject:</B> Re: AW: Synchronizing ejb method<BR></FONT><BR></DIV> = | | <DIV></DIV>Refer to the EJB spec. The container will not allow multiple = | threads to use the same instance of an SLSB. =46rom the spec - "<FONT = | class=3D"Apple-style-span" face=3D"Verdana" size=3D"3"><SPAN = | class=3D"Apple-style-span" style=3D"FONT-SIZE: 13px">The container must = | ensure that only one thread can be executing an instance at any time". = | Given that, why would you want to synchronize on an EJB method anyways ? = | Also, SLSB have no state (no instance variables).=A0 The same principle = | applies to SFSB in addition to the fact an instance is tied to a single = | client.</SPAN></FONT> <DIV><BR class=3D"khtml-block-placeholder"></DIV> = | <DIV><FONT class=3D"Apple-style-span" face=3D"Verdana" size=3D"3"><SPAN = | class=3D"Apple-style-span" style=3D"FONT-SIZE: 13px"></SPAN></FONT>Tareq = | <DIV><FONT class=3D"Apple-style-span" face=3D"Verdana" size=3D"3"><SPAN = | class=3D"Apple-style-span" style=3D"FONT-SIZE: 13px"><BR></SPAN></FONT> = | <DIV> <DIV>On May 15, 2006, at 2:40 AM, Andreas Berg wrote:</DIV><BR = | class=3D"Apple-interchange-newline"> <BLOCKQUOTE type=3D"cite"> <DIV = | dir=3D"ltr" align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"><SPAN class=3D"265003407-15052006">You shouldn't.=A0The only = | reason=A0to synchronize a stateless session bean is if your bean is = | not stateless. Then ask yourself why you chose a stateless bean for = | some stateful purpose.</SPAN></FONT></DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006"></SPAN></FONT>=A0</DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006">If you really want to synchronize your SLSB = | you need to think about the runtime environment. If all the instances = | of the SLSB run in a single JVM, you can use the standard Java = | synchronization features inside the bean to synchronize. But this = | doesn't work with a clustered environment. AFAIK there is no standard = | approach to solve this.</SPAN></FONT></DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006"></SPAN></FONT>=A0</DIV> <DIV dir=3D"ltr" = | align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" size=3D"2"><SPAN = | class=3D"265003407-15052006">Kind regards,</SPAN></FONT></DIV> <DIV = | dir=3D"ltr" align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"><SPAN class=3D"265003407-15052006"></SPAN></FONT>=A0</DIV> = | <DIV dir=3D"ltr" align=3D"left"><FONT face=3D"Arial" color=3D"#0000ff" = | size=3D"2"><SPAN class=3D"265003407-15052006">Andreas.</SPAN></FONT></DIV>= | <DIV>=A0</DIV> <DIV align=3D"left"><FONT face=3D"Arial" = | color=3D"#000000" size=3D"2"></FONT>=A0</DIV> <DIV align=3D"left"><FONT = | face=3D"Arial" color=3D"#808000" size=3D"1">Andreas Berg<BR>Zelfi = | AG<BR>Hechtsheimer Stra=DFe 33<BR>55131 Mainz<BR>Telefon: = | 06131-9064850<BR>Telefax:=A006131-9064853</FONT></DIV> <DIV = | align=3D"left"><FONT face=3D"Arial" color=3D"#808000" size=3D"1"><A = | href=3D"mailto:[email protected]">[email protected]</A></FONT></= | DIV> <DIV align=3D"left"><FONT face=3D"Arial" color=3D"#808000" = | size=3D"1"><A = | href=3D"http://www.zelfi.com/">http://www.zelfi.com/</A></FONT></DIV> = | <DIV>=A0</DIV><BR> <DIV class=3D"OutlookMessageHeader" lang=3D"de" = | dir=3D"ltr" align=3D"left"> <HR tabindex=3D"-1"> <FONT face=3D"Tahoma" = | size=3D"2"><B>Von:</B> A mailing list for Enterprise JavaBeans = | development [<A = | href=3D"mailto:[email protected]">mailto:[email protected]= | </A>] <B>Im Auftrag von </B>Kalra, Ashwani<BR><B>Gesendet:</B> Montag, = | 15. Mai 2006 06:42<BR><B>An:</B> <A = | href=3D"mailto:[email protected]">[email protected]</A><BR= | |><B>Betreff:</B> Synchronizing ejb method<BR></FONT><BR></DIV> = | | <DIV></DIV> <DIV><SPAN class=3D"087493904-15052006"><FONT face=3D"Arial" = | size=3D"2">Hi,</FONT></SPAN></DIV> <DIV><SPAN = | class=3D"087493904-15052006"><FONT face=3D"Arial" size=3D"2">The client = | of my ejb can be an jsp or standalone java class.=A0 How can I = | synchronize access to the SLSB ejb method? I am using ejb2.0 = | version</FONT></SPAN></DIV> <DIV><SPAN class=3D"087493904-15052006"><FONT= | face=3D"Arial" size=3D"2"></FONT></SPAN>=A0</DIV> <DIV>=A0</DIV><P><SPAN= | lang=3D"en-us"><FONT face=3D"Arial" = | size=3D"2">__________________</FONT></SPAN> <BR><SPAN = | lang=3D"en-us"><FONT face=3D"Tahoma" size=3D"2">Regards</FONT></SPAN> = | <BR><SPAN lang=3D"en-us"><B><FONT face=3D"Tahoma" size=3D"2">Ashwani = | Kalra</FONT></B></SPAN> <BR></P> <DIV>=A0</DIV> <TABLE> = | <TBODY><TR><TD bgcolor=3D"#ffffff"><FONT color=3D"#000000">This message = | contains information that may be privileged or confidential and = | is the property of the Capgemini Group. It is intended only for = | the person to whom it is addressed. If you are not the intended = | recipient, you are not authorized to read, print, retain, copy, = | disseminate, distribute, or use this message or any part = | thereof. If you receive this message in error, please notify the = | sender immediately and delete all copies of this = | message.<BR><BR></FONT></TD></TR></TBODY></TABLE>=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D To unsubscribe, send = | email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "signoff EJB-INTEREST". For general = | help, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "help". <DIV><BR = | class=3D"khtml-block-placeholder"></DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D To unsubscribe, send email to = | <A href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "signoff EJB-INTEREST". For general = | help, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "help". <DIV><BR = | class=3D"khtml-block-placeholder"></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV= | |>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | To unsubscribe, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "signoff EJB-INTEREST". For general = | help, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "help". <DIV><BR = | class=3D"khtml-block-placeholder"></DIV> <TABLE><TBODY><TR><TD = | bgcolor=3D"#ffffff"><FONT color=3D"#000000">This message contains = | information that may be privileged or confidential and is the property = | of the Capgemini Group. It is intended only for the person to whom it is = | addressed. If you are not the intended recipient, you are not = | authorized to read, print, retain, copy, disseminate, distribute, or = | use this message or any part thereof. If you receive this message in = | error, please notify the sender immediately and delete all copies of = | this message.<BR> <BR> </FONT></TD></TR></TBODY></TABLE> = | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | To unsubscribe, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "signoff EJB-INTEREST". For general = | help, send email to <A = | href=3D"mailto:[email protected]">[email protected]</A> and = | include in the body of the message "help". <DIV><BR = | class=3D"khtml-block-placeholder"></DIV></BLOCKQUOTE></DIV><BR></DIV></BOD= | Y></HTML>= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | <p> | | --Apple-Mail-1-58386373-- | | ------------------------------ | | Date: Fri, 19 May 2006 11:06:48 +0530 | From: "Kalra, Ashwani" <[email protected]> | Subject: Re: AW: Synchronizing ejb method | | This is a multi-part message in MIME format. | | ------_=_NextPart_001_01C67B06.1D60A744 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: quoted-printable | | | You are right John, It just got out of my mind that batch process is not a= | web client=2E | =20 | Thanks | Ashwani | | ________________________________ | | From: Johan Eltes [mailto:johan=2Eeltes@callista=2Ese]=20 | Sent: Friday, May 19, 2006 11:03 AM | To: Kalra, Ashwani | Cc: EJB-INTEREST@JAVA=2ESUN=2ECOM | Subject: Re: AW: Synchronizing ejb method | | | I don't think the batch and the clients will get th same session id=2E= | That's the whole idea of stateful session beans - that each client gets= | its own instance and that the instance has affinity for requests from its= | owning "user" during the lifetime of the users session=2E I would= | recommend application-controlled database state management for locking out= | one type of client from the other (with stateless session bean)=2E=20 | | /Johan | | 19 maj 2006 kl=2E 06=2E15 skrev Kalra, Ashwani: | | | No its not correct=2E=20 | Section 7=2E5=2E8 , Ejb 2=2E1 | =20 | "Clients are not allowed to make concurrent calls to a stateful session= | object=2E If a client-invoked business | | method is in progress on an instance when another client-invoked call,= | from the same or different client, | | arrives at the same instance of a stateful session bean class, the= | container may throw the | | java=2Ermi=2ERemoteException to the second client[7] if the client is a= | remote client, or the | | javax=2Eejb=2EEJBException if the client is a local client=2E This= | restriction does not apply to a stateless | | session bean because the container routes each request to a different= | instance of the session bean | | class=2E" | | I think there is no standard approach as Andreas said=2E My problem is= | that there is some batch process running and there is jsp page that can= | access the same method of ejb which I wanted to avoid=2E I think I can use= | statefull session bean so that at least second client gets the exception= | =2E | | =09 | =20 | | Thanks | | Ashwani | | =09 | =20 | =09 | =20 | | ________________________________ | | From: A mailing list for Enterprise JavaBeans development= | [mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM] On Behalf Of Tareq Ayub | Sent: Friday, May 19, 2006 7:55 AM | To: EJB-INTEREST@JAVA=2ESUN=2ECOM | Subject: Re: AW: Synchronizing ejb method | =09 | =09 | Refer to the EJB spec=2E The container will not allow multiple threads to= | use the same instance of an SLSB=2E From the spec - "The container must= | ensure that only one thread can be executing an instance at any time"=2E= | Given that, why would you want to synchronize on an EJB method anyways ?= | Also, SLSB have no state (no instance variables)=2E The same principle= | applies to SFSB in addition to the fact an instance is tied to a single= | client=2E=20 | | Tareq=20 | =09 | =09 | On May 15, 2006, at 2:40 AM, Andreas Berg wrote: | | | You shouldn't=2E The only reason to synchronize a stateless session bean= | is if your bean is not stateless=2E Then ask yourself why you chose a= | stateless bean for some stateful purpose=2E | =20 | If you really want to synchronize your SLSB you need to think about the= | runtime environment=2E If all the instances of the SLSB run in a single= | JVM, you can use the standard Java synchronization features inside the= | bean to synchronize=2E But this doesn't work with a clustered environment= | =2E AFAIK there is no standard approach to solve this=2E | =20 | Kind regards, | =20 | Andreas=2E | =20 | =20 | Andreas Berg | Zelfi AG | Hechtsheimer Stra=DFe 33 | 55131 Mainz | Telefon: 06131-9064850 | Telefax: 06131-9064853 | andreas=2Eberg@zelfi=2Ecom | http://www=2Ezelfi=2Ecom/ | =20 | | ________________________________ | | Von: A mailing list for Enterprise JavaBeans development= | [mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM] Im Auftrag von Kalra, Ashwani | Gesendet: Montag, 15=2E Mai 2006 06:42 | An: EJB-INTEREST@JAVA=2ESUN=2ECOM | Betreff: Synchronizing ejb method | =09 | =09 | Hi, | The client of my ejb can be an jsp or standalone java class=2E How can I= | synchronize access to the SLSB ejb method? I am using ejb2=2E0 version | =20 | =20 | | __________________=20 | Regards=20 | Ashwani Kalra=20 | =09 | | =20 | This message contains information that may be privileged or confidential= | and is the property of the Capgemini Group=2E It is intended only for the= | person to whom it is addressed=2E If you are not the intended recipient,= | you are not authorized to read, print, retain, copy, disseminate,= | distribute, or use this message or any part thereof=2E If you receive this= | message in error, please notify the sender immediately and delete all= | copies of this message=2E | | =09 | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in= | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email to listserv@java=2Esun=2Ecom and include in the body of the message= | "help"=2E=20 | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in= | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email to listserv@java=2Esun=2Ecom and include in the body of the message= | "help"=2E=20 | | | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in= | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email to listserv@java=2Esun=2Ecom and include in the body of the message= | "help"=2E=20 | | This message contains information that may be privileged or confidential= | and is the property of the Capgemini Group=2E It is intended only for the= | person to whom it is addressed=2E If you are not the intended recipient,= | you are not authorized to read, print, retain, copy, disseminate,= | distribute, or use this message or any part thereof=2E If you receive this= | message in error, please notify the sender immediately and delete all= | copies of this message=2E | | =09 | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D To unsubscribe, send email to listserv@java=2Esun=2Ecom and include in= | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email to listserv@java=2Esun=2Ecom and include in the body of the message= | "help"=2E=20 | | | | | | This message contains information that may be privileged or confidential= | and is the property of the Capgemini Group=2E It is intended only for the= | person to whom it is addressed=2E If you are not the intended recipient, = | you are not authorized to read, print, retain, copy, disseminate, = | distribute, or use this message or any part thereof=2E If you receive this= | message in error, please notify the sender immediately and delete all = | copies of this message=2E | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | | | ------_=_NextPart_001_01C67B06.1D60A744 | Content-Type: text/html; | charset="iso-8859-1" | Content-Transfer-Encoding: quoted-printable | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4=2E0 Transitional//EN"> | <HTML><HEAD> | <META http-equiv=3DContent-Type content=3D"text/html; charset= | =3Diso-8859-1"> | <META content=3D"MSHTML 6=2E00=2E2900=2E2873" name=3DGENERATOR></HEAD> | <BODY=20 | style=3D"WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break:= | after-white-space"> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D970323505-19052006>You are right John, It just got out of my mind= | that=20 | batch process is not a web client=2E</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D970323505-19052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D970323505-19052006>Thanks</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D970323505-19052006></SPAN></FONT><FONT face=3DArial color=3D#0000ff= | =20 | size=3D2><SPAN class=3D970323505-19052006>Ashwani</SPAN></FONT></DIV><BR> | <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> | <HR tabIndex=3D-1> | <FONT face=3DTahoma size=3D2><B>From:</B> Johan Eltes=20 | [mailto:johan=2Eeltes@callista=2Ese] <BR><B>Sent:</B> Friday, May 19, 2006= | 11:03=20 | AM<BR><B>To:</B> Kalra, Ashwani<BR><B>Cc:</B>=20 | EJB-INTEREST@JAVA=2ESUN=2ECOM<BR><B>Subject:</B> Re: AW: Synchronizing ejb= | =20 | method<BR></FONT><BR></DIV> | <DIV></DIV>I don't think the batch and the clients will get th same session= | id=2E=20 | That's the whole idea of stateful session beans - that each client gets its= | own=20 | instance and that the instance has affinity for requests from its owning= | "user"=20 | during the lifetime of the users session=2E I would recommend=20 | application-controlled database state management for locking out one type= | of=20 | client from the other (with stateless session bean)=2E | <DIV><BR class=3Dkhtml-block-placeholder></DIV> | <DIV>/Johan</DIV> | <DIV><BR> | <DIV> | <DIV>19 maj 2006 kl=2E 06=2E15 skrev Kalra, Ashwani:</DIV><BR=20 | class=3DApple-interchange-newline> | <BLOCKQUOTE type=3D"cite"> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT face= | =3DArial=20 | color=3D#0000ff size=3D2>No its not correct=2E </FONT></SPAN></DIV> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT face= | =3DArial=20 | color=3D#0000ff size=3D2>Section 7=2E5=2E8 , Ejb 2= | =2E1</FONT></SPAN></DIV> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT face= | =3DArial=20 | color=3D#0000ff size=3D2></FONT></SPAN> </DIV> | <DIV dir=3Dltr align=3Dleft><SPAN class=3D734250804-19052006><FONT size= | =3D2><SPAN=20 | class=3D734250804-19052006>"</SPAN>Clients are not allowed to make= | concurrent=20 | calls to a <STRONG>stateful session object</STRONG>=2E If a= | client-invoked=20 | business</FONT></SPAN></DIV> | <DIV dir=3Dltr align=3Dleft> | <P align=3Dleft><FONT size=3D2>method is in progress on an instance when= | another=20 | client-invoked call, from the same or different client,</FONT></P> | <P align=3Dleft><FONT size=3D2>arrives at the same instance of a stateful= | session=20 | bean class, the container may throw the</FONT></P><FONT face=3DCourier=20 | size=3D2></FONT> | <P align=3Dleft><FONT face=3DCourier size=3D2>java=2Ermi= | =2ERemoteException </FONT><FONT=20 | face=3D"Times New Roman" size=3D2>to the second client</FONT><FONT=20 | face=3D"Times New Roman" size=3D1>[7] </FONT><FONT face=3D"Times New= | Roman"=20 | size=3D2>if the client is a remote client, or the</FONT></P><FONT=20 | face=3D"Times New Roman" size=3D2></FONT><FONT face=3DCourier size= | =3D2></FONT> | <P align=3Dleft><FONT face=3DCourier size=3D2>javax=2Eejb=2EEJBException= | </FONT><FONT=20 | size=3D2>if the client is a local client=2E This restriction does not= | apply to a=20 | stateless</FONT></P> | <P align=3Dleft><FONT size=3D2>session bean because the container routes= | each=20 | request to a different instance of the session bean</FONT></P> | <P align=3Dleft><FONT size=3D2>class=2E<SPAN=20 | class=3D734250804-19052006>"</SPAN></FONT></P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT size=3D2><FONT= | face=3DArial=20 | color=3D#0000ff>I think there is no standard approach as Andreas said=2E= | My=20 | problem is that there is some batch process running and there is jsp page= | that=20 | can access the same method of ejb which I wanted to avoid</FONT>=2E <FONT= | =20 | face=3DArial color=3D#0000ff>I think I can use statefull session bean so= | that at=20 | least second client gets the exception=2E</FONT></FONT></SPAN></P> | <DIV><SPAN class=3D734250804-19052006><FONT face=3DArial color=3D#0000ff= | =20 | size=3D2></FONT></SPAN><BR class=3Dkhtml-block-placeholder> </DIV> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT face=3DArial color= | =3D#0000ff=20 | size=3D2>Thanks</FONT></SPAN></P> | <P align=3Dleft><SPAN class=3D734250804-19052006><FONT face=3DArial color= | =3D#0000ff=20 | size=3D2>Ashwani</FONT></SPAN></P> | <DIV><SPAN class=3D734250804-19052006><FONT face=3DArial color=3D#0000ff= | =20 | size=3D2></FONT></SPAN><BR class=3Dkhtml-block-placeholder> </DIV> | <DIV><FONT size=3D2><SPAN class=3D734250804-19052006></SPAN></FONT><BR=20 | class=3Dkhtml-block-placeholder> </DIV></DIV><BR> | <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> | <HR tabIndex=3D-1> | <FONT face=3DTahoma size=3D2><B>From:</B> A mailing list for Enterprise= | JavaBeans=20 | development [<A=20 | href=3D"mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM">mailto:EJB-INTEREST@JAVA= | =2ESUN=2ECOM</A>]=20 | <B>On Behalf Of </B>Tareq Ayub<BR><B>Sent:</B> Friday, May 19, 2006 7:55= | =20 | AM<BR><B>To:</B> <A=20 | href=3D"mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM">EJB-INTEREST@JAVA=2ESUN= | =2ECOM</A><BR><B>Subject:</B>=20 | Re: AW: Synchronizing ejb method<BR></FONT><BR></DIV> | <DIV></DIV>Refer to the EJB spec=2E The container will not allow multiple= | =20 | threads to use the same instance of an SLSB=2E From the spec - "<FONT=20 | class=3DApple-style-span face=3DVerdana size=3D3><SPAN class= | =3DApple-style-span=20 | style=3D"FONT-SIZE: 13px">The container must ensure that only one thread= | can be=20 | executing an instance at any time"=2E Given that, why would you want to=20 | synchronize on an EJB method anyways ? Also, SLSB have no state (no= | instance=20 | variables)=2E The same principle applies to SFSB in addition to the= | fact=20 | an instance is tied to a single client=2E</SPAN></FONT>=20 | <DIV><BR class=3Dkhtml-block-placeholder></DIV> | <DIV><FONT class=3DApple-style-span face=3DVerdana size=3D3><SPAN=20 | class=3DApple-style-span style=3D"FONT-SIZE: 13px"></SPAN></FONT>Tareq=20 | <DIV><FONT class=3DApple-style-span face=3DVerdana size=3D3><SPAN=20 | class=3DApple-style-span style=3D"FONT-SIZE: 13px"><BR></SPAN></FONT> | <DIV> | <DIV>On May 15, 2006, at 2:40 AM, Andreas Berg wrote:</DIV><BR=20 | class=3DApple-interchange-newline> | <BLOCKQUOTE type=3D"cite"> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>You shouldn't=2E The only= | reason to=20 | synchronize a stateless session bean is if your bean is not stateless= | =2E Then=20 | ask yourself why you chose a stateless bean for some stateful=20 | purpose=2E</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>If you really want to synchronize your SLSB= | you=20 | need to think about the runtime environment=2E If all the instances of= | the=20 | SLSB run in a single JVM, you can use the standard Java synchronization= | =20 | features inside the bean to synchronize=2E But this doesn't work with a= | =20 | clustered environment=2E AFAIK there is no standard approach to solve=20 | this=2E</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>Kind regards,</SPAN></FONT></DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006></SPAN></FONT> </DIV> | <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size= | =3D2><SPAN=20 | class=3D265003407-15052006>Andreas=2E</SPAN></FONT></DIV> | <DIV> </DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#000000 size= | =3D2></FONT> </DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#808000 size=3D1>Andreas= | Berg<BR>Zelfi=20 | AG<BR>Hechtsheimer Stra=DFe 33<BR>55131 Mainz<BR>Telefon:=20 | 06131-9064850<BR>Telefax: 06131-9064853</FONT></DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#808000 size=3D1><A=20 | href=3D"mailto:andreas=2Eberg@zelfi=2Ecom">andreas=2Eberg@zelfi= | =2Ecom</A></FONT></DIV> | <DIV align=3Dleft><FONT face=3DArial color=3D#808000 size=3D1><A=20 | href=3D"http://www=2Ezelfi=2Ecom/">http://www=2Ezelfi= | =2Ecom/</A></FONT></DIV> | <DIV> </DIV><BR> | <DIV class=3DOutlookMessageHeader lang=3Dde dir=3Dltr align=3Dleft> | <HR tabIndex=3D-1> | <FONT face=3DTahoma size=3D2><B>Von:</B> A mailing list for Enterprise= | JavaBeans=20 | development [<A=20 | href=3D"mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM">mailto:EJB-INTEREST@JAVA= | =2ESUN=2ECOM</A>]=20 | <B>Im Auftrag von </B>Kalra, Ashwani<BR><B>Gesendet:</B> Montag, 15=2E= | Mai=20 | 2006 06:42<BR><B>An:</B> <A=20 | href=3D"mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM">EJB-INTEREST@JAVA=2ESUN= | =2ECOM</A><BR><B>Betreff:</B>=20 | Synchronizing ejb method<BR></FONT><BR></DIV> | <DIV></DIV> | <DIV><SPAN class=3D087493904-15052006><FONT face=3DArial=20 | size=3D2>Hi,</FONT></SPAN></DIV> | <DIV><SPAN class=3D087493904-15052006><FONT face=3DArial size=3D2>The= | client of my=20 | ejb can be an jsp or standalone java class=2E How can I= | synchronize=20 | access to the SLSB ejb method? I am using ejb2=2E0= | version</FONT></SPAN></DIV> | <DIV><SPAN class=3D087493904-15052006><FONT face=3DArial=20 | size=3D2></FONT></SPAN> </DIV> | <DIV> </DIV> | <P><SPAN lang=3Den-us><FONT face=3DArial size= | =3D2>__________________</FONT></SPAN>=20 | <BR><SPAN lang=3Den-us><FONT face=3DTahoma size= | =3D2>Regards</FONT></SPAN>=20 | <BR><SPAN lang=3Den-us><B><FONT face=3DTahoma size=3D2>Ashwani=20 | Kalra</FONT></B></SPAN> <BR></P> | <DIV> </DIV> | <TABLE> | <TBODY> | <TR> | <TD bgColor=3D#ffffff><FONT color=3D#000000>This message contains=20 | information that may be privileged or confidential and is the= | property=20 | of the Capgemini Group=2E It is intended only for the person to= | whom it=20 | is addressed=2E If you are not the intended recipient, you are= | not=20 | authorized to read, print, retain, copy, disseminate, distribute,= | or=20 | use this message or any part thereof=2E If you receive this= | message in=20 | error, please notify the sender immediately and delete all copies= | of=20 | this=20 | message=2E<BR><BR></FONT></TD></TR></TBODY></TABLE>=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | To unsubscribe, send email to <A=20 | href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun=2Ecom</A>= | and include in=20 | the body of the message "signoff EJB-INTEREST"=2E For general help,= | send email=20 | to <A href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun= | =2Ecom</A> and=20 | include in the body of the message "help"=2E=20 | <DIV><BR=20 | class=3Dkhtml-block-placeholder></DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | To unsubscribe, send email to <A=20 | href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun=2Ecom</A>= | and include in=20 | the body of the message "signoff EJB-INTEREST"=2E For general help,= | send email=20 | to <A href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun= | =2Ecom</A> and=20 | include in the body of the message "help"=2E=20 | <DIV><BR=20 | class=3Dkhtml-block-placeholder></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV>= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =20 | To unsubscribe, send email to <A=20 | href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun=2Ecom</A>= | and include in=20 | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email=20 | to <A href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun= | =2Ecom</A> and=20 | include in the body of the message "help"=2E=20 | <DIV><BR class=3Dkhtml-block-placeholder></DIV> | <TABLE> | <TBODY> | <TR> | <TD bgColor=3D#ffffff><FONT color=3D#000000>This message contains=20 | information that may be privileged or confidential and is the= | property=20 | of the Capgemini Group=2E It is intended only for the person to= | whom it is=20 | addressed=2E If you are not the intended recipient, you are not= | authorized=20 | to read, print, retain, copy, disseminate, distribute, or use this= | =20 | message or any part thereof=2E If you receive this message in= | error,=20 | please notify the sender immediately and delete all copies of this= | =20 | message=2E<BR><BR></FONT></TD></TR></TBODY></TABLE>=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 | To unsubscribe, send email to <A=20 | href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun=2Ecom</A>= | and include in=20 | the body of the message "signoff EJB-INTEREST"=2E For general help, send= | email=20 | to <A href=3D"mailto:listserv@java=2Esun=2Ecom">listserv@java=2Esun= | =2Ecom</A> and=20 | include in the body of the message "help"=2E=20 | <DIV><BR=20 | class= | =3Dkhtml-block-placeholder></DIV></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML= | | | <table><tr><td bgcolor=3D#ffffff><font color=3D#000000>This message= | contains information that may be privileged or confidential and is the= | property of the Capgemini Group=2E It is intended only for the person to= | whom it is addressed=2E If you are not the intended recipient, you are= | not authorized to read, print, retain, copy, disseminate, distribute, or= | use this message or any part thereof=2E If you receive this message in= | error, please notify the sender immediately and delete all copies of this= | message=2E<br> | <br> | </font></td></tr></table> | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | 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". | <p> | ------_=_NextPart_001_01C67B06.1D60A744-- | | ------------------------------ | | End of EJB-INTEREST Digest - 15 May 2006 to 18 May 2006 (#2006-29) | ****************************************************************** | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEbaFzlUv1VPJ8EM4RAqlkAJ0cw/lYO7gB+9ZeHHWSGuBVaNnuEACeLn46 AvhNj096O1TANZ1wVxiWdH8= =fWy8 -----END PGP SIGNATURE----- =========================================================================== 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".