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); } }
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); }
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); }
public void abort() throws IOException { cmd.abort(); close(); }