Actually, the most elegant solution is to simply use Java 
synchronization to process requests in a serial manner if
do not care about clients clicking links in the browser
multiple times.

This would just mean using the "synchronized" keyword in the
business delegate instance methods that invoke operations on
the stateful session bean instance. That way, even if mutiple
threads access/invoke calls on the business delegate, they 
will wait for a monitor entry and never invoke one operation
on the SFSB instance when another operation on the very same
instance is being executed.

For example:

public class MyBusinessDelegate {
  private MyStatefulSess sfsb = null;

  public MyBusinessDelegate {}// look up and create instance
                               // of SFSB here

  public synchronized void invokeSomeOperation() {
    sfsb.someOperation();
  }

  public synchronized void invokeAnotherOperation() {
    sfsb.anotherOperation();
  }
}

And the above class would be used by clients to communicate
with the SFSB instance. That way, you do not care if your
clients are Swing/Web based (both are multi-threaded).

The only thing you need to ensure is that the above class
is the only 'funnel' to your stateful EJB. That is, other
developers in your team do not inadvertently circumvent your
business delegate and create their own access path to your
EJBs.

-krish
Borland

________________________________

        From: Mirchandani, Vishal
[mailto:[EMAIL PROTECTED] 
        Sent: Thursday, August 12, 2004 4:04 PM
        To: [EMAIL PROTECTED]
        Subject: Re: second thread call to stateful session bean
        
        
        Hey Ashwini,
        In case you are not able to trade up the server operation, you
can handle the same at the client browser itself or at the event
Handler, in case
        you have one.
         
        Method 1:
        In your browser, have a transparent div. When the button is
clicked, activate the div(visibility:visible) with maximum zIndex. This
way the page gets locked . Or
        also you can have a message on the div saying: "Please wait".
        When you receive the response, hide the div again.
         
        Method 2:
        Also it can be done in your architecture layout. Say for
instance the web page(e.g. jsp) submits the request to a servelet which
in turn calls the other classes
        or the EJB. In this servelet you set a flag for processing and
in case the flag is true. Ignore all user intercepts. After processing,
set the flag to true and the servlet
        will start taking responses.
         
        Method 3:
        Try and handle the exception in the bean itself and kill the
transaction. But this is not an efficient method as the server should
never get a call in case a request is being 
        processed. So 1 and 2 should work out for you. 
         

        Warm Regards, 
        Vishal Mirchandani 
        
------------------------------------------------------------------------
------------------------------------ 
        "I'm having amnesia and deja-vu at the same time... I think I
have forgotten this before..." 

                -----Original Message-----
                From: Kalra, Ashwani
[mailto:[EMAIL PROTECTED]
                Sent: Thursday, August 12, 2004 7:16 PM
                To: [EMAIL PROTECTED]
                Subject: second thread call to stateful session bean
                
                
                hi,
                I have web page in which use clicks of one hyperlink ,
this operation is time consuming so user clicks immediately on some
other link and I get the above exception on Oracal9i AS 9.03.  All the
requests goes through the stateful session bean. How to handle it
gracefully.
                 

                Thanks & Regds
                 Ashwani

                Ext: 1582

                
                 

                 
                
                Our name has changed. Please update your address book to
the following format: "[EMAIL PROTECTED]".
                
                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.
                
                        
        
========================================================================
=== 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". 

                
        ____________________________________________

        Confidential: This electronic message and all contents contain
information from Syntel, Inc. which may be privileged, confidential or
otherwise protected from disclosure. The information is intended to be
for the addressee only. If you are not the addressee, any disclosure,
copy, distribution or use of the contents of this message is prohibited.
If you have received this electronic message in error, please notify the
sender immediately and destroy the original message and all copies.

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