void addStatusIfCountNotOverLimit(Status s) { ++statusCount; if (statusCount < STATUS_COUNT_LIMIT) { addStatus(s); } if (statusCount == STATUS_COUNT_LIMIT) { addStatus(s); addStatus(new InfoStatus("Will supress future messages regarding " + getDescription(), this)); } }
void attemptRecovery() { try { close(); } catch (IOException e) { } addStatusIfCountNotOverLimit(new InfoStatus( "Attempting to recover from IO failure on " + getDescription(), this)); // subsequent writes must always be in append mode try { os = openNewOutputStream(); presumedClean = true; } catch (IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open " + getDescription(), this, e)); } }
@Override public void write(int b) { if (isPresumedInError()) { if (!recoveryCoordinator.isTooSoon()) { attemptRecovery(); } return; // return regardless of the success of the recovery attempt } try { os.write(b); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } }
@Override public void flush() { if (os != null) { try { os.flush(); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } } }
void postIOFailure(IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("IO failure while writing to " + getDescription(), this, e)); presumedClean = false; if (recoveryCoordinator == null) { recoveryCoordinator = new RecoveryCoordinator(); } }
public void postIOFailure(IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("IO failure while writing to " + getDescription(), this, e)); presumedClean = false; if (recoveryCoordinator == null) { recoveryCoordinator = new RecoveryCoordinator(); } }
@Override public void flush() { if (os != null) { try { os.flush(); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } } }
public void write(byte b[], int off, int len) { if (isPresumedInError()) { if (!recoveryCoordinator.isTooSoon()) { attemptRecovery(); } return; // return regardless of the success of the recovery attempt } try { os.write(b, off, len); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } }
void attemptRecovery() { try { close(); } catch (IOException e) { } addStatusIfCountNotOverLimit(new InfoStatus("Attempting to recover from IO failure on " + getDescription(), this)); // subsequent writes must always be in append mode try { os = openNewOutputStream(); presumedClean = true; } catch (IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open " + getDescription(), this, e)); } }
private void postSuccessfulWrite() { if (recoveryCoordinator != null) { recoveryCoordinator = null; statusCount = 0; addStatus(new InfoStatus("Recovered from IO failure on " + getDescription(), this)); } }
public void postIOFailure(IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("IO failure while writing to " + getDescription(), this, e)); presumedClean = false; if (recoveryCoordinator == null) { recoveryCoordinator = new RecoveryCoordinator(); } }
@Override public void flush() { if (os != null) { try { os.flush(); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } } }
public void write(byte b[], int off, int len) { if (isPresumedInError()) { if (!recoveryCoordinator.isTooSoon()) { attemptRecovery(); } return; // return regardless of the success of the recovery attempt } try { os.write(b, off, len); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } }
void attemptRecovery() { try { close(); } catch (IOException e) { } addStatusIfCountNotOverLimit(new InfoStatus("Attempting to recover from IO failure on " + getDescription(), this)); // subsequent writes must always be in append mode try { os = openNewOutputStream(); presumedClean = true; } catch (IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open " + getDescription(), this, e)); } }
void addStatusIfCountNotOverLimit(Status s) { ++statusCount; if (statusCount < STATUS_COUNT_LIMIT) { addStatus(s); } if (statusCount == STATUS_COUNT_LIMIT) { addStatus(s); addStatus(new InfoStatus("Will supress future messages regarding " + getDescription(), this)); } }
public void postIOFailure(IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("IO failure while writing to " + getDescription(), this, e)); presumedClean = false; if (recoveryCoordinator == null) { recoveryCoordinator = new RecoveryCoordinator(); } }
@Override public void flush() { if (os != null) { try { os.flush(); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } } }
public void write(byte b[], int off, int len) { if (isPresumedInError()) { if (!recoveryCoordinator.isTooSoon()) { attemptRecovery(); } return; // return regardless of the success of the recovery attempt } try { os.write(b, off, len); postSuccessfulWrite(); } catch (IOException e) { postIOFailure(e); } }
void attemptRecovery() { try { close(); } catch (IOException e) { } addStatusIfCountNotOverLimit(new InfoStatus("Attempting to recover from IO failure on " + getDescription(), this)); // subsequent writes must always be in append mode try { os = openNewOutputStream(); presumedClean = true; } catch (IOException e) { addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open " + getDescription(), this, e)); } }
void addStatusIfCountNotOverLimit(Status s) { ++statusCount; if (statusCount < STATUS_COUNT_LIMIT) { addStatus(s); } if (statusCount == STATUS_COUNT_LIMIT) { addStatus(s); addStatus(new InfoStatus("Will supress future messages regarding " + getDescription(), this)); } }