Exemplo n.º 1
0
 @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;
   }
 }
Exemplo n.º 2
0
 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();
   }
 }
Exemplo n.º 3
0
 @Override
 public void abort(Executor executor) throws SQLException {
   conn.abort(executor);
 }
Exemplo n.º 4
0
  @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) {
    }
  }
Exemplo n.º 5
0
 @Override
 public void abort(Executor executor) throws SQLException {
   _wrapped.abort(executor);
 }