#7 IndexOutOfBounds Exception, when SuccessorList capacity = 0

closed
7
2008-03-04
2008-01-31
Anonymous
No

I configured in chord.properties to have 0 successors, so that no items would be replicated.
If a node joins another node I get the following exception, because in line number 147 of SuccessorList.java:
if (this.successors.size() >= this.capacity
&& nodeToAdd.nodeID.isInInterval(this.successors.get(this.successors.size() - 1).nodeID, this.localID))

Possible solution:
if (this.successors.size() >= this.capacity && this.successors.size() > 0 && nodeToAdd.nodeID.isInInterval(this.successors.get(this.successors.size() - 1).nodeID, this.localID))

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: -1, Size: 0
at java.util.LinkedList.entry(LinkedList.java:368)
at java.util.LinkedList.get(LinkedList.java:313)
at de.uniba.wiai.lspi.chord.service.impl.SuccessorList.addSuccessor(SuccessorList.java:147)
at de.uniba.wiai.lspi.chord.service.impl.References.addReference(References.java:331)
at de.uniba.wiai.lspi.chord.service.impl.ChordImpl.joinHelp(ChordImpl.java:531)
at de.uniba.wiai.lspi.chord.service.impl.ChordImpl.join(ChordImpl.java:464)
at cmgrid.instance.CacheNodeImpl.<init>(CacheNodeImpl.java:69)
at cmgrid.instance.CacheNodeImpl.main(CacheNodeImpl.java:135)

Discussion

  • Sven Kaffille

    Sven Kaffille - 2008-03-04
    • priority: 5 --> 7
    • assigned_to: nobody --> kloesing
     
  • Sven Kaffille

    Sven Kaffille - 2008-03-04

    Logged In: YES
    user_id=1435049
    Originator: NO

    You must have at least 1 successor to main a chord ring.
    So 0 is not a valid value.
    Nevertheless this should be checked some time earlier than at the time when you join the network.

    Thank you for your advice.

    sven

     
  • Sven Kaffille

    Sven Kaffille - 2008-03-04
    • status: open --> closed
     
  • Sven Kaffille

    Sven Kaffille - 2008-03-04
    • assigned_to: kloesing --> skaffille
     

Log in to post a comment.