List of usage examples for org.springframework.session.data.gemfire.support GemFireUtils close
public static boolean close(Closeable obj)
From source file:sample.ClientConfig.java
boolean waitForCacheServerToStart(final String host, final int port, long duration) { return waitOnCondition(new Condition() { AtomicBoolean connected = new AtomicBoolean(false); public boolean evaluate() { Socket socket = null; try { // NOTE: this code is not intended to be an atomic, compound action (a // possible race condition); // opening another connection (at the expense of using system // resources) after connectivity // has already been established is not detrimental in this use case if (!connected.get()) { socket = new Socket(host, port); connected.set(true); }/*from w w w .j av a 2 s . c om*/ } catch (IOException ignore) { } finally { GemFireUtils.close(socket); } return connected.get(); } }, duration); }
From source file:docs.AbstractGemFireIntegrationTests.java
protected static boolean waitForCacheServerToStart(final String host, final int port, long duration) { return waitOnCondition(new Condition() { AtomicBoolean connected = new AtomicBoolean(false); public boolean evaluate() { Socket socket = null; try { if (!connected.get()) { socket = new Socket(host, port); connected.set(true); }/*from w w w . ja v a2 s . co m*/ } catch (IOException ignore) { } finally { GemFireUtils.close(socket); } return connected.get(); } }, duration); }
From source file:sample.client.Application.java
boolean waitForCacheServerToStart(final String host, final int port, long duration) { return waitOnCondition(new Condition() { AtomicBoolean connected = new AtomicBoolean(false); public boolean evaluate() { Socket socket = null; try { // NOTE: this code is not intended to be an atomic, compound action (a // possible race condition); // opening another connection (at the expense of using system // resources) after connectivity // has already been established is not detrimental in this use case if (!this.connected.get()) { socket = new Socket(host, port); this.connected.set(true); }/*from w ww . j a va 2 s . c o m*/ } catch (IOException ignore) { } finally { GemFireUtils.close(socket); } return this.connected.get(); } }, duration); }