@Override public boolean matches(Object o) { RMAppEvent event = (RMAppEvent) o; return event.getType() == RMAppEventType.ATTEMPT_FAILED; } };
@Override public boolean matches(Object o) { RMAppEvent event = (RMAppEvent) o; return event.getType() == RMAppEventType.ATTEMPT_FAILED; } };
@Override public void handle(RMAppEvent event) { this.writeLock.lock(); try { ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { /* keep the master in sync with the state machine */ this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitonException e) { LOG.error("Can't handle this event at current state", e); /* TODO fail the application on the failed transition */ } if (oldState != getState()) { LOG.info(appID + " State change from " + oldState + " to " + getState() + " on event=" + event.getType()); } } finally { this.writeLock.unlock(); } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitionException e) { LOG.error("App: " + appID + " can't handle this event at current state", e); onInvalidStateTransition(event.getType(), oldState); (event.getType() != RMAppEventType.RECOVER))) { LOG.info(String.format(STATE_CHANGE_MESSAGE, appID, oldState, getState(), event.getType())); } else if ((oldState != getState()) && LOG.isDebugEnabled()) { LOG.debug(String.format(STATE_CHANGE_MESSAGE, appID, oldState, getState(), event.getType()));
@Override public void handle(RMAppEvent event) { this.writeLock.lock(); try { ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { /* keep the master in sync with the state machine */ this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitonException e) { LOG.error("Can't handle this event at current state", e); /* TODO fail the application on the failed transition */ } if (oldState != getState()) { LOG.info(appID + " State change from " + oldState + " to " + getState()); } } finally { this.writeLock.unlock(); } }
@Override public void handle(RMAppEvent event) { //RMApp rmApp = this.rmContext.getRMApps().get(appID); setAppEventType(event.getType()); System.out.println("in handle routine " + getAppEventType().toString()); } }
@Override public void handle(RMAppEvent event) { //RMApp rmApp = this.rmContext.getRMApps().get(appID); setAppEventType(event.getType()); System.out.println("in handle routine " + getAppEventType().toString()); } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
switch (event.getType()) { case APP_REJECTED: case ATTEMPT_FINISHED:
switch (event.getType()) { case APP_REJECTED: case ATTEMPT_FINISHED:
switch (event.getType()) { case APP_REJECTED: case ATTEMPT_FINISHED:
Event evt = eventQueue.take(); if (evt instanceof RMAppEvent) { Assert.assertEquals(((RMAppEvent)evt).getType(), RMAppEventType.START); } else { fail("RMAppEvent.START was expected!!");
@Override public void handle(RMAppEvent event) { assertEquals(application.getApplicationId(), event.getApplicationId()); if (event instanceof RMAppFailedAttemptEvent) { transferStateFromPreviousAttempt = ((RMAppFailedAttemptEvent) event) .getTransferStateFromPreviousAttempt(); } try { application.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + application.getApplicationId(), t); } } }
@Override public void handle(RMAppEvent event) { assertEquals(application.getApplicationId(), event.getApplicationId()); if (event instanceof RMAppFailedAttemptEvent) { transferStateFromPreviousAttempt = ((RMAppFailedAttemptEvent) event) .getTransferStateFromPreviousAttempt(); } try { application.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + application.getApplicationId(), t); } } }
Event evt = eventQueue.take(); if (evt instanceof RMAppEvent) { Assert.assertEquals(((RMAppEvent)evt).getType(), RMAppEventType.START); } else { fail("RMAppEvent.START was expected!!");
Event event = recordedEvents.get(0); RMAppEvent rmAppEvent = (RMAppEvent) event; assertEquals(RMAppEventType.APP_REJECTED, rmAppEvent.getType()); assertTrue("Diagnostic message does not match: " + rmAppEvent.getDiagnosticMsg(),