public IOException unwrapRemoteIOException() { final Exception cause = unwrapRemoteException(); if (cause instanceof IOException) { return (IOException)cause; } return new IOException(cause); }
/** * This is a version of unwrapRemoteIOException that can do DoNotRetryIOE. * We need to throw DNRIOE to clients if a failed Procedure else they will * keep trying. The default proc.getException().unwrapRemoteException * doesn't have access to DNRIOE from the procedure2 module. */ public static IOException unwrapRemoteIOException(Procedure proc) { Exception e = proc.getException().unwrapRemoteException(); // Do not retry ProcedureExceptions! return (e instanceof ProcedureException)? new DoNotRetryIOException(e): proc.getException().unwrapRemoteIOException(); } }
boolean tableDeleted; if (proc.hasException()) { Exception procEx = proc.getException().unwrapRemoteException(); if (iProcTable.getTableOperationType() == TableOperationType.CREATE) {
public IOException unwrapRemoteIOException() { final Exception cause = unwrapRemoteException(); if (cause instanceof IOException) { return (IOException)cause; } return new IOException(cause); }
public IOException unwrapRemoteIOException() { final Exception cause = unwrapRemoteException(); if (cause instanceof IOException) { return (IOException)cause; } return new IOException(cause); }
protected void countDown(final Procedure proc) { if (proc.hasException()) { exception = proc.getException().unwrapRemoteException(); } latch.countDown(); }
public static byte[] waitForProcedureToComplete(ProcedureExecutor<MasterProcedureEnv> procExec, final long procId) throws IOException { while (!procExec.isFinished(procId) && procExec.isRunning()) { // TODO: add a config to make it tunable // Dev Consideration: are we waiting forever, or we can set up some timeout value? Threads.sleepWithoutInterrupt(250); } ProcedureInfo result = procExec.getResult(procId); if (result != null) { if (result.isFailed()) { // If the procedure fails, we should always have an exception captured. Throw it. throw RemoteProcedureException.fromProto( result.getForeignExceptionMessage()).unwrapRemoteException(); } return result.getResult(); } else { if (procExec.isRunning()) { throw new IOException("Procedure " + procId + "not found"); } else { throw new IOException("The Master is Aborting"); } } }
@Override public void completionCleanup(Procedure proc) { if (proc instanceof TableProcedureInterface) { TableProcedureInterface iProcTable = (TableProcedureInterface)proc; boolean tableDeleted; if (proc.hasException()) { IOException procEx = proc.getException().unwrapRemoteException(); if (iProcTable.getTableOperationType() == TableOperationType.CREATE) { // create failed because the table already exist tableDeleted = !(procEx instanceof TableExistsException); } else { // the operation failed because the table does not exist tableDeleted = (procEx instanceof TableNotFoundException); } } else { // the table was deleted tableDeleted = (iProcTable.getTableOperationType() == TableOperationType.DELETE); } if (tableDeleted) { markTableAsDeleted(iProcTable.getTableName()); return; } } else { // No cleanup for ServerProcedureInterface types, yet. return; } }