public void actionPerformed(ObjectOutputStream oos, Message msg) throws EventHandleException {
    try {
      /* get the handler of the ServerPeer */
      ServerPeer serverpeer = (ServerPeer) gui.peer();

      /* get the message body */
      SPLeaveReplacementBody body = (SPLeaveReplacementBody) msg.getBody();

      TreeNode treeNode = body.getTreeNode();
      treeNode.setContent(body.getContent());
      SPGeneralAction.saveData(body.getContent().getData());
      treeNode.setStatus(TreeNode.ACTIVE);
      treeNode.setRole(TreeNode.MASTER);
      treeNode.addCoOwnerList(body.getPhysicalSender());
      serverpeer.addListItem(treeNode);
      SPGeneralAction.updateRotateRoutingTable(serverpeer, treeNode);

      serverpeer.setActivateStablePosition(
          new ActivateStablePosition(serverpeer, treeNode, ServerPeer.TIME_TO_STABLE_POSITION));

      ((ServerGUI) gui).updatePane(treeNode);
    } catch (Exception e) {
      e.printStackTrace();
      throw new EventHandleException(
          "Replace a super peer's position failure when it leaves network", e);
    }
  }
 public boolean isConsumed(Message msg) throws EventHandleException {
   if (msg.getHead().getMsgType() == MsgType.SP_LEAVE_REPLACEMENT.getValue()) return true;
   return false;
 }