Permalink
Browse files

catch potential runtime exceptions during recovery

  • Loading branch information...
Matthieu Morel
Matthieu Morel committed Aug 5, 2011
1 parent c690cb8 commit 96f9d9351c280ff3f1414016e60b4d2662152d1d
Showing with 12 additions and 3 deletions.
  1. +12 −3 s4-core/src/main/java/io/s4/processor/AbstractPE.java
@@ -544,12 +544,21 @@ private void saveState(SafeKeeperId key, byte[] serializedState) {
}
protected void recover() {
- byte[] serializedState = safeKeeper.fetchSerializedState(getSafeKeeperId());
+ byte[] serializedState = null;
+ try {
+ serializedState = safeKeeper.fetchSerializedState(getSafeKeeperId());
+ } catch (RuntimeException e) {
+ Logger.getLogger("s4-ft").error("Cannot fetch serialized stated for key [" + getSafeKeeperId().toString()+"]: "+e.getMessage(), e);
+ }
if (serializedState == null) {
return;
}
- AbstractPE peInOldState = deserializeState(serializedState);
- restoreState(peInOldState);
+ try {
+ AbstractPE peInOldState = deserializeState(serializedState);
+ restoreState(peInOldState);
+ } catch (RuntimeException e) {
+ Logger.getLogger("s4-ft").error("Cannot restore state for key [" + getSafeKeeperId().toString()+"]: "+e.getMessage(), e);
+ }
}
public SafeKeeperId getSafeKeeperId() {

0 comments on commit 96f9d93

Please sign in to comment.