1 Reply Latest reply on Feb 11, 2002 9:27 AM by Horia Muntean

    Pessimistic Locking question

    Horia Muntean Newbie

      I have a question about the pesimistic locking mechanism implemented by JBoss. Here is the situation:
      I have one CMP entity bean named Player(id, name, position, salary) witch has only local interfaces. Further, there is a controller stateless session bean named Roster witch uses the Player EB(entity bean).
      Suppose now the Roster SLSB(Stateless Session Bean) has a method that returns the player's details for a vector of players ids :
      public void getSomePlayers(Vector ids){
      ArrayList pList = new ArrayList();
      for(int i=0;i<ids.size();i++){
      String pid = (String)ids.get(i);
      try{
      LocalPlayer player = playerHome.findByPrimaryKey(pid);
      pList.add(new PlayerDetails(player.getPlayerId(),player.getName(),player.getPosition(),player.getSalary()));
      }catch(FinderException fe){}
      }
      return pList;
      }

      Now: if I call two clients with a vector of player ids in reverse order:
      client P1 P2 P3 and client P3 P2 P1 jboss hangs, and after the default transaction timeout expires, one transaction is rolled back and the other one continues.

      Is this an expected behaviour - i mean is a bean "enlisted" in a transaction totaly locked (by totaly i mean no other transaction ca access it's methods even if those methods are declared with "Notsupported" transaction attribute) until the transaction ends? or what?