private void processTask(CommandTask task) throws InterruptedException {
   assert null != task;
   System.out.println("Process " + task.getCommand().getClass().getName() + " command");
   Command command = task.getCommand();
   CommandHandler commandHandler = handlerFactory.createHandler(command);
   commandHandler.processCommand(command, task.getClientSocketProcessor());
 }
Esempio n. 2
0
 public static ChannelFuture connect(PeerAddress peerAddress, byte[] hashinfo)
     throws InterruptedException {
   if (bootstrap == null) {
     init();
   }
   bootstrap.handler(HandlerFactory.client(hashinfo));
   ChannelFuture channelFuture =
       bootstrap.connect(peerAddress.getAddress(), peerAddress.getPort()).sync();
   register(peerAddress, channelFuture.channel());
   return channelFuture;
 }
Esempio n. 3
0
  private void registerInvocationHandlers(RhnXmlRpcServer srvr) {
    if (handlers == null) {
      handlers = new HandlerFactory();
    }

    // find the configured handlers...
    Iterator i = handlers.getKeys().iterator();
    while (i.hasNext()) {
      String namespace = (String) i.next();

      if (log.isDebugEnabled()) {
        log.debug(
            "registerInvocationHandler: namespace ["
                + namespace
                + "] handler ["
                + handlers.getHandler(namespace)
                + "]");
      }
      srvr.addInvocationHandler(namespace, handlers.getHandler(namespace));
    }
  }