예제 #1
0
  /**
   * Removes the specified driver from the {@code DriverManager}'s list of registered drivers.
   *
   * <p>If a {@code null} value is specified for the driver to be removed, then no action is taken.
   *
   * <p>If a security manager exists and its {@code checkPermission} denies permission, then a
   * {@code SecurityException} will be thrown.
   *
   * <p>If the specified driver is not found in the list of registered drivers, then no action is
   * taken. If the driver was found, it will be removed from the list of registered drivers.
   *
   * <p>If a {@code DriverAction} instance was specified when the JDBC driver was registered, its
   * deregister method will be called prior to the driver being removed from the list of registered
   * drivers.
   *
   * @param driver the JDBC Driver to remove
   * @exception SQLException if a database access error occurs
   * @throws SecurityException if a security manager exists and its {@code checkPermission} method
   *     denies permission to deregister a driver.
   * @see SecurityManager#checkPermission
   */
  @CallerSensitive
  public static synchronized void deregisterDriver(Driver driver) throws SQLException {
    if (driver == null) {
      return;
    }

    SecurityManager sec = System.getSecurityManager();
    if (sec != null) {
      sec.checkPermission(DEREGISTER_DRIVER_PERMISSION);
    }

    println("DriverManager.deregisterDriver: " + driver);

    DriverInfo aDriver = new DriverInfo(driver, null);
    if (registeredDrivers.contains(aDriver)) {
      if (isDriverAllowed(driver, Reflection.getCallerClass())) {
        DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
        // If a DriverAction was specified, Call it to notify the
        // driver that it has been deregistered
        if (di.action() != null) {
          di.action().deregister();
        }
        registeredDrivers.remove(aDriver);
      } else {
        // If the caller does not have permission to load the driver then
        // throw a SecurityException.
        throw new SecurityException();
      }
    } else {
      println("    couldn't find driver to unload");
    }
  }
 @Override
 public int indexOf(final Object o, final int index) {
   return copyOnWriteArrayList.indexOf(o, index);
 }
예제 #3
0
 /**
  * Gets the position of the provided processor in the processor queue.
  *
  * @param processor The processor.
  * @return The processor's index.
  */
 public synchronized int indexOf(IAudioProcessor processor) {
   return processors.indexOf(processor);
 }
예제 #4
0
 /**
  * Adds a processor to the internal processor queue.
  *
  * @param processor The processor to add.
  * @return The index of the processor.
  */
 public synchronized int add(IAudioProcessor processor) {
   processors.add(processor);
   buildFinalProcessor();
   return processors.indexOf(processor);
 }