@Override
 public T get() throws InterruptedException, ExecutionException {
   try {
     return in.get(timeout, unit);
   } catch (TimeoutException e) {
     throw new ExecutionException(e.getCause());
   }
 }
예제 #2
0
 /**
  * Process the return value and reply back. When exceptions raises they will be logged and set a
  * return value accordingly.
  *
  * @param timeout
  * @param unit
  * @return VDSReturnValue
  * @throws TimeoutException
  */
 @Override
 public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException {
   try {
     status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit));
     ProceedProxyReturnValue();
   } catch (TimeoutException e) {
     httpTask.cancel(true);
     setVdsNetworkError(new VDSNetworkException(new RuntimeException(e.getCause())));
     log.error("Timeout waiting for VDSM response. " + e);
     throw e;
   } catch (Exception e) {
     log.error(e);
     setVdsRuntimeError(
         e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
   }
   return getVDSReturnValue();
 }
예제 #3
0
 private SubscriberInfo registeMessageType(FetchRequest req) {
   SubscriberInfo info = this.topicSubcriberRegistry.get(req.getTopic());
   if (info == null) {
     log.warn("query topic's[" + req.getTopic() + "] subscriberInfo is null.");
     return null;
   }
   Set<String> messageTypeList = info.getMessageTypes();
   MessageTypeCommand mtCmd =
       new MessageTypeCommand(
           this.consumerConfig.getVersion(),
           this.consumerConfig.getGroup(),
           req.getTopic(),
           OpaqueGenerator.getNextOpaque(),
           messageTypeList,
           MetaMessageSessionFactory.startTime);
   try {
     ResponseCommand response =
         this.remotingClient.invokeToGroup(
             req.getBroker().getZKString(),
             mtCmd,
             this.consumerConfig.getFetchTimeoutInMills(),
             TimeUnit.MILLISECONDS);
     if (response instanceof BooleanCommand) {
       BooleanCommand bc = (BooleanCommand) response;
       if (bc.getCode() == HttpStatus.Success) {
         return info;
       } else {
         return null;
       }
     }
   } catch (InterruptedException e) {
     log.error("registe message type interrupted," + e.getMessage(), e.getCause());
   } catch (TimeoutException e) {
     log.error("registe message type timeout," + e.getMessage(), e.getCause());
   } catch (NotifyRemotingException e) {
     log.error("registe message type failed, " + e.getMessage(), e.getCause());
   }
   return null;
 }