@Override public void abort(Executor executor) throws SQLException { String methodCall = "abort(" + executor + ")"; long tstart = System.currentTimeMillis(); try { realConnection.abort(executor); reportAborted(System.currentTimeMillis() - tstart); } catch (SQLException s) { reportException(methodCall, s, System.currentTimeMillis() - tstart); throw s; } }
public void abortConnection() throws SQLException { Connection connection = DriverManager.getConnection("jdbc:derby://localhost/java7book"); ThreadPoolExecutor executor = new DebugExecutorService(2, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); connection.abort(executor); executor.shutdown(); try { executor.awaitTermination(5, TimeUnit.MINUTES); System.out.println(executor.getCompletedTaskCount()); } catch (InterruptedException e) { e.printStackTrace(); } }
@Override public void abort(Executor executor) throws SQLException { conn.abort(executor); }
@Test public void testUnsupportedOperations() throws Exception { Connection conn = getConnection(); try { conn.prepareCall(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setReadOnly(false); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setCatalog(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.getCatalog(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.prepareCall(null, 0, 0); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setTypeMap(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.getTypeMap(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setSavepoint(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setSavepoint(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.rollback(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.releaseSavepoint(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.prepareCall(null, 0, 0, 0); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.createClob(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.createBlob(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.createNClob(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.createSQLXML(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.createArrayOf(null, (Object[]) null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.createStruct(null, (Object[]) null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setSchema(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.getSchema(); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.abort(null); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.setNetworkTimeout(null, 0); fail(); } catch (UnsupportedOperationException ignore) { } try { conn.getNetworkTimeout(); fail(); } catch (UnsupportedOperationException ignore) { } }
@Override public void abort(Executor executor) throws SQLException { _wrapped.abort(executor); }