if (this.conn == null || this.conn.isClosed()) { reconnectToPeerCluster();
scan((RpcController)Mockito.any(), (ScanRequest)Mockito.any()); } finally { if (connection != null && !connection.isClosed()) connection.close(); zkw.close();
if (this.clusterConnection != null && !clusterConnection.isClosed()) { try { this.clusterConnection.close();
while (this.clusterConnection != null && !this.clusterConnection.isClosed()) { RegionServerStatusService.BlockingInterface rss = rssStub; try {
@VisibleForTesting BufferedMutatorImpl(ClusterConnection conn, BufferedMutatorParams params, AsyncProcess ap) { if (conn == null || conn.isClosed()) { throw new IllegalArgumentException("Connection is null or closed.");
/** * Closes the internal {@link Connection}. Does nothing if the {@link Connection} has already * been closed. * @throws IOException If there is an error closing the connection. */ @SuppressWarnings("deprecation") public synchronized void close() throws IOException { if (!getConnection().isClosed()) { getConnection().close(); } }
@SuppressWarnings("deprecation") @Test public void testClosingAlreadyClosedConnection() throws IOException { doCallRealMethod().when(mockMultiplexer).close(); // If the connection is already closed when(mockConnection.isClosed()).thenReturn(true); mockMultiplexer.close(); // We should not close it again verify(mockConnection, times(0)).close(); } }
@SuppressWarnings("deprecation") @Test public void testConnectionClosing() throws IOException { doCallRealMethod().when(mockMultiplexer).close(); // If the connection is not closed when(mockConnection.isClosed()).thenReturn(false); mockMultiplexer.close(); // We should close it verify(mockConnection).close(); }
@Override public boolean isClosed() { return wrappedConnection.isClosed(); }
@VisibleForTesting BufferedMutatorImpl(ClusterConnection conn, BufferedMutatorParams params, AsyncProcess ap) { if (conn == null || conn.isClosed()) { throw new IllegalArgumentException("Connection is null or closed.");
/** * Closes the internal {@link Connection}. Does nothing if the {@link Connection} has already * been closed. * @throws IOException If there is an error closing the connection. */ @SuppressWarnings("deprecation") public synchronized void close() throws IOException { if (!getConnection().isClosed()) { getConnection().close(); } }
/** * Closes the internal {@link Connection}. Does nothing if the {@link Connection} has already * been closed. * @throws IOException If there is an error closing the connection. */ @SuppressWarnings("deprecation") public synchronized void close() throws IOException { if (!getConnection().isClosed()) { getConnection().close(); } }
final RpcControllerFactory rpcControllerFactory, final ExecutorService pool) throws IOException { if (connection == null || connection.isClosed()) { throw new IllegalArgumentException("Connection is null or closed.");
BufferedMutatorImpl(ClusterConnection conn, RpcRetryingCallerFactory rpcCallerFactory, RpcControllerFactory rpcFactory, BufferedMutatorParams params) { if (conn == null || conn.isClosed()) { throw new IllegalArgumentException("Connection is null or closed."); } this.tableName = params.getTableName(); this.connection = conn; this.conf = connection.getConfiguration(); this.pool = params.getPool(); this.listener = params.getListener(); TableConfiguration tableConf = new TableConfiguration(conf); this.writeBufferSize = params.getWriteBufferSize() != BufferedMutatorParams.UNSET ? params.getWriteBufferSize() : tableConf.getWriteBufferSize(); this.maxKeyValueSize = params.getMaxKeyValueSize() != BufferedMutatorParams.UNSET ? params.getMaxKeyValueSize() : tableConf.getMaxKeyValueSize(); // puts need to track errors globally due to how the APIs currently work. ap = new AsyncProcess(connection, conf, pool, rpcCallerFactory, true, rpcFactory); }
scan((RpcController)Mockito.any(), (ScanRequest)Mockito.any()); } finally { if (connection != null && !connection.isClosed()) connection.close(); zkw.close();
@VisibleForTesting BufferedMutatorImpl(ClusterConnection conn, BufferedMutatorParams params, AsyncProcess ap) { if (conn == null || conn.isClosed()) { throw new IllegalArgumentException("Connection is null or closed.");
if (this.clusterConnection != null && !clusterConnection.isClosed()) { try { this.clusterConnection.close();