Exemplo n.º 1
0
 public TransferSinkThread(
     AbstractDataChannel dataChannel,
     SocketBox socketBox,
     DataSink sink,
     BasicServerControlChannel localControlChannel,
     TransferContext context)
     throws Exception {
   this.socketBox = socketBox;
   this.sink = sink;
   this.localControlChannel = localControlChannel;
   this.context = context;
   this.reader = dataChannel.getDataChannelSource(context);
   reader.setDataStream(socketBox.getSocket().getInputStream());
 }
Exemplo n.º 2
0
  protected void shutdown(Object quitToken) throws IOException {
    logger.debug("shutdown");

    reader.close();

    // garbage collect the socket
    socketBox.setSocket(null);

    // data sink is shared by all data channels,
    // so should be closed by the last one exiting
    if (quitToken != null) {
      sink.close();
    }
  }