Source:
public void handle(String tenantId, List<T> items) throws Exception { List<R> results = null; List<T> retries = null; RetryAttemptException lastException = null; try { processor.initialise(tenantId, items); } catch (RetryAttemptException e) { retries = items; lastException = e; } long startTime = 0; if (perfLog.isLoggable(Level.FINEST)) { startTime = System.currentTimeMillis(); } if (processor.getType() == ProcessorType.ManyToMany) { try { results = processor.processManyToMany(tenantId, items); } catch (RetryAttemptException e) { retries = items; lastException = e; } } else { for (int i = 0; i < items.size(); i++) { try { if (processor.getType() == ProcessorType.OneToMany) { List<R> result = processor.processOneToMany(tenantId, items.get(i)); if (resultHandler != null && result != null && !result.isEmpty()) { if (results == null) { results = new ArrayList<R>(); } results.addAll(result); } } else { R result = processor.processOneToOne(tenantId, items.get(i)); if (resultHandler != null && result != null) { if (results == null) { results = new ArrayList<R>(); } results.add(result); } } } catch (RetryAttemptException e) { if (retryHandler != null) { if (retries == null) { retries = new ArrayList<T>(); } retries.add(items.get(i)); lastException = e; } } } } if (perfLog.isLoggable(Level.FINEST)) { perfLog.finest("Performance: invoked processor +processor.getClass().getSimpleName()+ duration=" + (System.currentTimeMillis() - startTime) + "ms"); } processor.cleanup(tenantId, items); if (results != null && !results.isEmpty()) { resultHandler.handle(tenantId, results); } if (retries != null && !retries.isEmpty()) { if (getRetryCount() > 0) { retryHandler.handle(tenantId, retries); } else { throw lastException; } } }

Target:
public void handle(String tenantId, List<T> items) throws Exception { List<R> results = null; List<T> retries = null; RetryAttemptException lastException = null; try { processor.initialise(tenantId, items); long startTime = 0; if (perfLog.isLoggable(Level.FINEST)) { startTime = System.currentTimeMillis(); } if (processor.getType() == ProcessorType.ManyToMany) { results = processor.processManyToMany(tenantId, items); } else { for (int i = 0; i < items.size(); i++) { try { if (processor.getType() == ProcessorType.OneToMany) { List<R> result = processor.processOneToMany(tenantId, items.get(i)); if (resultHandler != null && result != null && !result.isEmpty()) { if (results == null) { results = new ArrayList<R>(); } results.addAll(result); } } else { R result = processor.processOneToOne(tenantId, items.get(i)); if (resultHandler != null && result != null) { if (results == null) { results = new ArrayList<R>(); } results.add(result); } } } catch (RetryAttemptException e) { if (retryHandler != null) { if (retries == null) { retries = new ArrayList<T>(); } retries.add(items.get(i)); lastException = e; } } } } if (perfLog.isLoggable(Level.FINEST)) { perfLog.finest("Performance: invoked processor +processor.getClass().getSimpleName()+ duration=" + (System.currentTimeMillis() - startTime) + "ms"); } } catch (RetryAttemptException e) { retries = items; lastException = e; } processor.cleanup(tenantId, items); if (results != null && !results.isEmpty()) { resultHandler.handle(tenantId, results); } if (retries != null && !retries.isEmpty()) { if (getRetryCount() > 0) { retryHandler.handle(tenantId, retries); } else { throw lastException; } } }