Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1636

java.lang.ArrayIndexOutOfBoundsException when trying to accure lock

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • 3.4
    • 3.3
    • None
    • Hide

      private Lock masterLock;
      ...

      public Node() throws Exception

      { this.channel = new JChannel(Node.class.getClassLoader().getResourceAsStream("udp.xml")); this.channel.setReceiver(this); this.channel.connect("master-cluster"); this.lockService = new LockService(this.channel); }

      ....
      private void getLock()

      { masterLock = lockService.getLock("master"); //Happens here masterLock.lock(); isMaster.set(true); LOG.info("I have become the master!"); }
      Show
      private Lock masterLock; ... public Node() throws Exception { this.channel = new JChannel(Node.class.getClassLoader().getResourceAsStream("udp.xml")); this.channel.setReceiver(this); this.channel.connect("master-cluster"); this.lockService = new LockService(this.channel); } .... private void getLock() { masterLock = lockService.getLock("master"); //Happens here masterLock.lock(); isMaster.set(true); LOG.info("I have become the master!"); }

      Getting java.lang.ArrayIndexOutOfBoundsException
      java.lang.ArrayIndexOutOfBoundsException: -4
      at org.jgroups.protocols.Locking._getLock(Locking.java:355)
      at org.jgroups.protocols.Locking.handleLockRequest(Locking.java:424)

      that happens when lock_name.hashCode() < 0

      protected Lock _getLock(String lock_name)

      { int index=lock_name != null? lock_name.hashCode() % locks.length : 0; return locks[index]; }

              rhn-engineering-bban Bela Ban
              uzbssr Tim Tim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: