boolean (T t) { // in case of exception do not mark the element as processed, we couldn't recover otherwise synchronized (processed) { if (processed.contains(t)) { return true; } } boolean result = myDelegate.process(t); synchronized (processed) { processed.add(t); } return result; }