Tecnic of synchronization for Servers RMI

Paulo Melo <[email protected]> Sun, 13 Aug 2006 12:15:53 -0300
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Hello Guys! I'm with problem os synchronization in my Facade(service RMI). My Facade are like Session Facade(EJB) and they publish the remote method's. The problem is that if I synchronize the method, he lock my others object's. My architecture is:

GUI --> Delegate --------------RMI--------------- Facade --> Bussines -->DAO.

So, when i call the folowing method, for example:

public synchronized int gravar(UGTO ug) throws RemoteException {
        int iRetorno = 0;
        SessionPool.getInstancia().createSession(Thread.currentThread().getId());

        try{
            iRetorno = getUGBusiness().gravar(ug);

            SessionPool.getInstancia().finalizaSecao(Thread.currentThread().getId(), Session.Finalizar.SUCESSO);
        } catch(WorkflowException e){
            SessionPool.getInstancia().finalizaSecao(Thread.currentThread().getId(), Session.Finalizar.FALHA);
            throw e;
        } finally {
            SessionPool.getInstancia().removeSession(Thread.currentThread().getId());
        }

        return iRetorno;
    }

I lock all synchronized method's and lose performance )-: ...  So the question is: Exist some technique or pattern that solve this?

Thankx!!

Obs.: Sorry for my english.

A Paz!!
Paulo Henrique


---------------------------------
 Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html