/**
  * Set the new opened Channel (from channelConnected of {@link DataNetworkHandler})
  *
  * @param channel
  * @param dataNetworkHandler
  */
 public void setOpenedDataChannel(Channel channel, DataNetworkHandler dataNetworkHandler) {
   logger.debug(
       "SetOpenedDataChannel: " + (channel != null ? channel.getRemoteAddress() : "no channel"));
   if (channel != null) {
     session.getDataConn().setDataNetworkHandler(dataNetworkHandler);
     waitForOpenedDataChannel.setChannel(channel);
     waitForOpenedDataChannel.setSuccess();
   } else {
     waitForOpenedDataChannel.cancel();
   }
 }
 /**
  * Wait that the new opened connection is ready (same method in {@link FtpDataAsyncConn} from
  * openConnection)
  *
  * @return the new opened Channel
  * @throws InterruptedException
  */
 public Channel waitForOpenedDataChannel() throws InterruptedException {
   Channel channel = null;
   if (waitForOpenedDataChannel.await(
       session.getConfiguration().TIMEOUTCON + 1000, TimeUnit.MILLISECONDS)) {
     if (waitForOpenedDataChannel.isSuccess()) {
       channel = waitForOpenedDataChannel.getChannel();
     } else {
       logger.warn("data connection is in error");
     }
   } else {
     logger.warn("Timeout occurs during data connection");
   }
   waitForOpenedDataChannel = new WaarpChannelFuture(true);
   return channel;
 }
 /**
  * Clear the FtpTransferControl (called when the data connection must be over like from clear of
  * {@link FtpDataAsyncConn}, abort from {@link ABOR} or ending control connection from {@link
  * NetworkHandler}.
  */
 public void clear() {
   // logger.debug("Clear Ftp Transfer Control");
   endDataConnection();
   finalizeExecution();
   if (closedDataChannel != null) {
     closedDataChannel.cancel();
   }
   if (endOfCommand != null) {
     endOfCommand.cancel();
   }
   if (waitForOpenedDataChannel != null) {
     waitForOpenedDataChannel.cancel();
   }
   if (executorService != null) {
     executorService.shutdownNow();
     executorService = null;
   }
 }