@Override public boolean isAborted() { return this.conn.isAborted(); }
private boolean isValid(Connection conn) { return conn != null && !conn.isAborted() && !conn.isClosed(); }
public Connection getConnection() { if (conn == null || conn.isAborted() || conn.isClosed()) { initConn(); } return conn; }
synchronized boolean updateAccessTime() { if (closed) { return false; } if (connection.isAborted() || connection.isClosed()) { LOG.info("Unexpected: cached Connection is aborted/closed, removed from cache"); connections.remove(userName); return false; } lastAccessTime = EnvironmentEdgeManager.currentTime(); return true; }
private void throwFailureIfDone() throws SingleIndexWriteFailureException { if (stopped.isStopped() || (env != null && (env.getConnection() == null || env.getConnection().isClosed() || env.getConnection().isAborted())) || Thread.currentThread().isInterrupted()) { throw new SingleIndexWriteFailureException( "Pool closed, not attempting to write to the index!", null); } } });
@SuppressWarnings("unchecked") @Test public void testCheckRegionServerStoppedOnException() throws Exception { StatisticsScannerCallable realCallable = mockScanner.new StatisticsScannerCallable(); doThrow(new IOException()).when(statsWriter).deleteStatsForRegion(any(Region.class), any(StatisticsCollector.class), any(ImmutableBytesPtr.class), any(List.class)); when(conn.isClosed()).thenReturn(false); when(conn.isAborted()).thenReturn(true); // Should not throw an exception realCallable.call(); verify(conn).isClosed(); verify(conn).isAborted(); } }
@Test public void testCheckRegionServerStoppedOnClose() throws Exception { when(conn.isClosed()).thenReturn(false); when(conn.isAborted()).thenReturn(true); mockScanner.close(); verify(conn).isClosed(); verify(conn).isAborted(); verify(callable, never()).call(); verify(runTracker, never()).runTask(callable); }
private boolean isConnectionClosed() { return getConnection() == null || getConnection().isClosed() || getConnection().isAborted(); }
@SuppressWarnings("unchecked") @Test public void testCheckRegionServerStoppingOnException() throws Exception { StatisticsScannerCallable realCallable = mockScanner.new StatisticsScannerCallable(); doThrow(new IOException()).when(statsWriter).deleteStatsForRegion(any(Region.class), any(StatisticsCollector.class), any(ImmutableBytesPtr.class), any(List.class)); when(conn.isClosed()).thenReturn(true); when(conn.isAborted()).thenReturn(false); // Should not throw an exception realCallable.call(); verify(conn).isClosed(); }
@Test public void testCheckRegionServerStoppingOnClose() throws Exception { when(conn.isClosed()).thenReturn(true); when(conn.isAborted()).thenReturn(false); mockScanner.close(); verify(conn).isClosed(); verify(callable, never()).call(); verify(runTracker, never()).runTask(callable); }
@Override public boolean isAborted() { return delegate.isAborted(); }
private static boolean isValid(Connection conn) { return conn != null && !conn.isAborted() && !conn.isClosed(); }
private boolean isValid(Connection conn) { return conn != null && !conn.isAborted() && !conn.isClosed(); }
private boolean isValid(Connection conn) { return conn != null && !conn.isAborted() && !conn.isClosed(); }
@Override public boolean available() { return available && !connection.isAborted() && !connection.isClosed(); }
@Override public boolean validateObject(PooledObject<Connection> p) { Connection connection = p.getObject(); if (connection != null) return ((!connection.isAborted()) && (!connection.isClosed())); return false; }
synchronized boolean updateAccessTime() { if (closed) { return false; } if (connection.isAborted() || connection.isClosed()) { LOG.info("Unexpected: cached HConnection is aborted/closed, removed from cache"); connections.remove(userName); return false; } lastAccessTime = EnvironmentEdgeManager.currentTime(); return true; }
private void throwFailureIfDone() throws SingleIndexWriteFailureException { if (stopped.isStopped() || (env != null && (env.getConnection() == null || env.getConnection().isClosed() || env.getConnection().isAborted())) || Thread.currentThread().isInterrupted()) { throw new SingleIndexWriteFailureException( "Pool closed, not attempting to write to the index!", null); } } });
private void throwFailureIfDone() throws SingleIndexWriteFailureException { if (stopped.isStopped() || (env != null && (env.getConnection() == null || env.getConnection().isClosed() || env.getConnection().isAborted())) || Thread.currentThread().isInterrupted()) { throw new SingleIndexWriteFailureException( "Pool closed, not attempting to write to the index!", null); } } });
private boolean isConnectionClosed() { return getConnection() == null || getConnection().isClosed() || getConnection().isAborted(); }