1 Reply Latest reply on Nov 18, 2009 10:58 AM by brian.stansberry

    obtain cluster lock

    niefeng

      Hi all,

      Could I know what will be the available option for us to ensure that no two md bean instance reside in different cluster node accessing the same shared resources?

      The current approach i have identified is using the Hibernate LockMode.UPGRADE_NOWAIT. Whenever the md bean access the shared resource, it will acquire the lock via LockMode.UPGRADE_NOWAIT.

       Thus whenever the following error happened , it signal that other md bean instance in different cluster node is accessing.
      
      org.hibernate.exception.LockAcquisitionException: could not execute query
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:87)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.loader.Loader.doList(Loader.java:2147)


      Is the above mentioned approach recommended? Or any other mechanism is better in this scenario? Thanks!

      My deploy env
      JBOSS 405
      oracle 10

      niefeng

        • 1. Re: obtain cluster lock
          brian.stansberry

          That sounds like a reasonable approach. Generally if you want to control access to something and that something provides it's own locking mechanisms, it's wise to use them. That's what you're doing here.