private void stablize() {
        try {
            // If successor is not alive anymore, replace it by one in the successor list
            if (!getSuccessor().isActive()) {
                if (replaceDeadSuccessor()) {
                    updateSuccessorList(getSuccessor().getSuccessorList());
                } else {
                    // Change state to dead now
                    setIsActive(false);
                }
            }

            /*
             *  Core pseudo code of this part:
             *
             *  v := succ.pred
             *  if (v != nil and v in (n,succ]) then
             *      set succ := v
             *  send a notify(n) to succ
             */
            // Successor is alive, get its predecessor
            IChordNode v = getSuccessor().getPredecessor();
            // Check validity of successor's predecessor
            if (v != null && v.isActive()) {
                // Check if v's id is between node's id and successor's id,
                // if yes, we need to change successor and notify it
                IKey vId = v.getId();
                if (vId.isBetween(getId(), getSuccessor().getId())) {
                    setSuccessor(v);
                    getSuccessor().notify(this);
                    updateSuccessorList(getSuccessor().getSuccessorList());

                    // print debug info
                    printInfo();
                }
            }
        } catch (RemoteException ex) {
            // Could not connect to successor, do the replacement
            if (replaceDeadSuccessor()) {
                try {
                    updateSuccessorList(getSuccessor().getSuccessorList());
                } catch (RemoteException ex1) {
                    Logger.getLogger(ChordNodeImpl.class.getName()).log(Level.SEVERE, null, ex1);
                }
            } else {
                // Change state to dead now
                setIsActive(false);
            }
        }
    }