Example #1
0
 public void start() throws IOException {
   try {
     logger.debug("Sending proxy get");
     cmd.executeAsync(channel, this);
     logger.debug("Proxy get sent");
     cb.info(String.valueOf(cmd.getId()));
   } catch (ProtocolException e) {
     logger.warn("Error requesting file from " + channel, e);
     throw new IOException("Error requesting file from " + channel);
   }
 }
Example #2
0
 public void write(boolean last, byte[] data) throws InterruptedException {
   if (closed) {
     return;
   }
   Allocation a = buffers.request(1, this);
   boolean suspend;
   synchronized (alloc) {
     alloc.add(a);
     suspend = alloc.size() == Buffers.MAX_ENTRIES / 4;
   }
   if (suspend) {
     cmd.suspend();
   }
   buffers.queueRequest(last, ByteBuffer.wrap(data), this, this);
 }
Example #3
0
 public void releaseOne() {
   Allocation a;
   boolean resume;
   synchronized (alloc) {
     if (alloc.isEmpty()) {
       if (logger.isInfoEnabled()) {
         logger.info(cmd + " releaseOne. Spurious release.");
       }
       return;
     }
     a = alloc.remove(0);
     if (logger.isDebugEnabled()) {
       logger.debug(cmd + " releaseOne. allocsz: " + alloc.size());
     }
     resume = alloc.size() == Buffers.ENTRIES_PER_STREAM / 2;
   }
   if (resume) {
     cmd.resume();
   }
   buffers.free(a);
 }
Example #4
0
 public void abort() throws IOException {
   cmd.abort();
   close();
 }