Class MultiPassErrorHandler

  extended by org.dbmaintain.structure.clear.impl.MultiPassErrorHandler

public class MultiPassErrorHandler
extends Object

This class is intended to permit multiple attempts (passes) to drop database objects. It helps to solve the problem whereby it is impossible to drop one database object because a dependent object exists (for example when dropping Oracle 11 reference partitioned objects it is necessary to drop all child tables first).

This class is used in a do-while loop with the method continueExecutionAfterPass() being the loop continuation condition.
 while ( multiPassErrorHandler.continueExecutionAfterPass() );
In addition whenever an exception occurs it must be recorded with the addError(RuntimeException) method.
 try {
 } catch (RuntimeException e) {

Mark Jeffrey

Constructor Summary
Method Summary
 void addError(RuntimeException exception)
          Call this method whenever there is an exception dropping a database object.
 boolean continueExecutionAfterPass()
          We stop execution if: We have no exceptions during the most recent pass.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MultiPassErrorHandler()
Method Detail


public void addError(RuntimeException exception)
Call this method whenever there is an exception dropping a database object. This method keeps track of:
  1. the first exception (so that it may be reported later).
  2. the exception count so we can determine if they are still decreasing.
If an Exception occurs during a pass then we need to do two things:

exception -


public boolean continueExecutionAfterPass()
We stop execution if: We continue execution if: We throw the first exception of the pass if:

true if we should continue execution (trying another pass), false if no exceptions occurred in the most recent pass.
RuntimeException - If we do not get a decreasing number of exceptions each pass then we throw the first exception from the most recent pass.

Copyright © 2011. All Rights Reserved.