示例#1
0
 @Override
 public void run() {
   if (!cancelled) {
     boolean fail = false;
     AsyncFuture<Long> future = null;
     try {
       if (interval < 1
           || System.currentTimeMillis() - channelHandler.getLastMessageReceivedTime()
               > interval) {
         future =
             channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();
         Long id = future.get(timeout, TimeUnit.MILLISECONDS);
         if (!cancelled && remoteConnectionID != null && !remoteConnectionID.equals(id)) {
           HostControllerLogger.DOMAIN_LOGGER.slaveHostControllerChanged(hostName);
           fail = true;
         } else {
           remoteConnectionID = id;
         }
       }
     } catch (IOException e) {
       HostControllerLogger.DOMAIN_LOGGER.debug("Caught exception sending ping request", e);
     } catch (InterruptedException e) {
       safeCancel(future);
       Thread.currentThread().interrupt();
     } catch (ExecutionException e) {
       HostControllerLogger.DOMAIN_LOGGER.debug("Caught exception sending ping request", e);
     } catch (TimeoutException e) {
       if (!cancelled) {
         fail = true;
         HostControllerLogger.DOMAIN_LOGGER.slaveHostControllerUnreachable(hostName, timeout);
       }
       safeCancel(future);
     } finally {
       if (fail) {
         Channel channel = null;
         try {
           channel = channelHandler.getChannel();
         } catch (IOException e) {
           // ignore; shouldn't happen as the channel is already established if this task is
           // running
         }
         StreamUtils.safeClose(channel);
       } else if (!cancelled && interval > 0) {
         scheduler.schedule(this, interval, TimeUnit.MILLISECONDS);
       }
     }
   }
 }
 public ModelNode get(long timeout, TimeUnit unit)
     throws InterruptedException, ExecutionException, TimeoutException {
   return delegate.get(timeout, unit);
 }
 public ModelNode get() throws InterruptedException, ExecutionException {
   return delegate.get();
 }
 public <A> void addListener(
     org.jboss.threads.AsyncFuture.Listener<? super ModelNode, A> listener, A attachment) {
   delegate.addListener(listener, attachment);
 }
 public org.jboss.threads.AsyncFuture.Status getStatus() {
   return delegate.getStatus();
 }
 public boolean isDone() {
   return delegate.isDone();
 }
 public org.jboss.threads.AsyncFuture.Status awaitUninterruptibly(long timeout, TimeUnit unit) {
   return delegate.awaitUninterruptibly(timeout, unit);
 }
 public org.jboss.threads.AsyncFuture.Status awaitUninterruptibly() {
   return delegate.awaitUninterruptibly();
 }
 public ModelNode getUninterruptibly(long timeout, TimeUnit unit)
     throws CancellationException, ExecutionException, TimeoutException {
   return delegate.getUninterruptibly(timeout, unit);
 }
 public ModelNode getUninterruptibly() throws CancellationException, ExecutionException {
   return delegate.getUninterruptibly();
 }
 public org.jboss.threads.AsyncFuture.Status await(long timeout, TimeUnit unit)
     throws InterruptedException {
   return delegate.await(timeout, unit);
 }
 public org.jboss.threads.AsyncFuture.Status await() throws InterruptedException {
   return delegate.await();
 }