コード例 #1
0
 @Override
 public void handle(AbstractCommand command) {
   if (command instanceof ClientCommand) {
     System.out.println("Received command: " + command.toString());
     ClientCommand clientCommand = (ClientCommand) command;
     clientCommand.setServiceLocator(locator);
     clientCommand.execute();
   }
 }
コード例 #2
0
 @Override
 public Object handleAndReply(AbstractCommand command) {
   if (command instanceof CheckPartyCommand) {
     System.out.println("Received command: " + command.toString());
     CheckPartyCommand checkCommand = (CheckPartyCommand) command;
     checkCommand.setServiceLocator(locator);
     checkCommand.execute();
     return checkCommand.canJoin();
   } else if (command instanceof ProbeCommand) {
     ProbeCommand c = (ProbeCommand) command;
     c.execute();
     return c.getStatus();
   } else {
     return null;
   }
 }