public static void close(Closeable... closeables) { if(closeables != null) { for(Closeable closeable : closeables) Util.close(closeable); } }
protected void closeClientSocket() { synchronized(mutex) { Util.close(client_sock); client_sock=null; } }
/** Used only for testing ! */ public synchronized void clearConnections() { for(Connection conn: conns.values()) Util.close(conn); conns.clear(); }
void stop() { if(disp != null) disp.stop(); Util.close(channel); }
public void stop() { if(disp != null) { disp.stop(); disp=null; } Util.close(channel); }
public void stop() { Util.close(sock); sock=null; receiver=null; super.stop(); }
public void getState(OutputStream output) throws Exception { DataOutputStream out=new DataOutputStream(new BufferedOutputStream(output, 1000)); try { synchronized(nodes) { Util.objectToStream(nodes, out); } } finally { Util.close(out); } }
@Override public void stop() { super.stop(); if(running.compareAndSet(true, false)) Util.close(selector,conn); // closing the selector also stops the acceptor thread }
public void stop() { if(disp != null) { disp.stop(); disp=null; } Util.close(channel); }
@Override public void stop() { if(running.compareAndSet(true, false)) { Util.close(conn); super.stop(); } }
void stop() { if(disp != null) disp.stop(); Util.close(channel); }
@ManagedOperation public void stop() throws IOException { Util.close(srv_sock); thread=null; if(thread_pool instanceof ExecutorService) ((ExecutorService)thread_pool).shutdown(); }
private void loadProperties(File file) { FileInputStream fis = null; try { fis = new FileInputStream(file); properties.load(fis); } catch (IOException e) { log.error(Util.getMessage("AnErrorOccurredWhileLoadingPropertiesFrom") + file, e); } finally { Util.close(fis); } }
@GuardedBy("this") public void replaceConnection(Address address, Connection conn) { Connection previous=conns.put(address, conn); Util.close(previous); // closes previous connection (if present) notifyConnectionEstablished(conn); }
@GuardedBy("this") public void replaceConnection(Address address, Connection conn) { Connection previous=conns.put(address, conn); Util.close(previous); // closes previous connection (if present) notifyConnectionEstablished(conn); }
protected Tuple<InputStream,Object> createStreamToProvider(final Address provider, final StateHeader hdr) { Util.close(input_stream); input_stream=new BlockingInputStream(buffer_size); return new Tuple<InputStream,Object>(input_stream, null); }