diff --git a/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherState.java b/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherState.java index 77bf49695c5..504d7d0e79f 100644 --- a/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherState.java +++ b/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherState.java @@ -21,26 +21,10 @@ import com.ibm.ws.sib.msgstore.persistence.dispatcher.StateUtils.StateUpdater; final class DispatcherState { - static final StateUpdater updaterForStart = new StateUpdater() { - public DispatcherState update(DispatcherState currentState) { - return currentState.startRequested().running(true); - } - }; - static final StateUpdater updaterForStopped = new StateUpdater() { - public DispatcherState update(DispatcherState currentState) { - return currentState.running(false); - } - }; - static final StateUpdater updaterForErrorOccurred = new StateUpdater() { - public DispatcherState update(DispatcherState currentState) { - return currentState.addThreadWriteError(); - } - }; - static final StateUpdater updaterForErrorCleared = new StateUpdater() { - public DispatcherState update(DispatcherState currentState) { - return currentState.clearThreadWriteError(); - } - }; + static final StateUpdater updaterForStart = state -> state.startRequested().running(true); + static final StateUpdater updaterForStopped = state -> state.running(false); + static final StateUpdater updaterForErrorOccurred = DispatcherState::addThreadWriteError; + static final StateUpdater updaterForErrorCleared = DispatcherState::clearThreadWriteError; public static final class StopRequesterInfo extends Throwable { private static final long serialVersionUID = 1L; @@ -52,13 +36,7 @@ public StopRequesterInfo(Throwable requester) { } static StateUpdater getUpdaterForStopRequested(final Throwable requester) { - return new StateUpdater() { - @Override - public DispatcherState update(DispatcherState currentState) { - if (!currentState.isRunning) return currentState; - return currentState.stopRequested(new StopRequesterInfo(requester)); - } - }; + return state -> state.isRunning ? state.stopRequested(new StopRequesterInfo(requester)) : state; } // Flag set to indicate whether dispatcher is running.