@Override public void close() throws IOException { channel.close(); inputShutdown = true; outputShutdown = true; }
@Override public void close() throws IOException { reader.close(); writer.close(); if (null != channel) { channel.close(); } } }
@Override public void close() throws IOException { channel.close(); inputShutdown = true; outputShutdown = true; }
@Override public void close() throws IOException { reader.close(); writer.close(); if (null != channel) { channel.close(); } } }
@Override public void close() throws IOException { reader.close(); writer.close(); if (null != channel) { channel.close(); } } }
@Override public void close() throws IOException { if (null != chan && closed.compareAndSet(false, true)) { try { chan.close(); } catch (IOException e) { ignore(); } } }
@Override public void tearDown() throws IOException { channel.close(); try { channel.join(3000); } catch (InterruptedException e) { throw new IOException(e); } finally { if (conn !=null) conn.close(); conn = null; } }
public static final UnixSocketChannel open(UnixSocketAddress remote) throws IOException { UnixSocketChannel channel = new UnixSocketChannel(); try { channel.connect(remote); } catch (IOException e) { channel.close(); throw e; } return channel; }
public void process(SelectionKey key) { try { ByteBuffer buf = ByteBuffer.allocate(1024); int result = sessionChannel.read(buf); if (result > 0) { buf.flip(); messageReceived(new Buffer(buf.array(), buf.position(), buf.remaining())); return; } if (result == -1) { // EOF => remote closed the connection, cancel the selection key and close the channel. key.cancel(); sessionChannel.close(); } } catch (IOException e) { LOGGER.log(Level.INFO, "Could not write response to socket", e); key.cancel(); safelyClose(sessionChannel); } }
@Override protected void doStop() throws Exception { super.doStop(); try { if (channel != null) channel.close(); } catch (IOException xx) { LOG.ignore(xx); } } }
channel.close();
/** * Serve individual connection to the test harness. */ private void processConnection(UnixSocketChannel c, JenkinsController j) { try { try { try ( InputStream in = ChannelStream.in(c); OutputStream out = ChannelStream.out(c)) { Channel ch = new ChannelBuilder(j.getLogId(), executors).withMode(Mode.BINARY).build(in, out); ch.setProperty("controller", ch.export(IJenkinsController.class,j)); // wait for the connection to be shut down ch.join(); } } finally { System.out.println("done"); j.stop(); j.tearDown(); c.close(); } } catch (IOException|InterruptedException e) { e.printStackTrace(); } }