|
@@ -162,10 +162,6 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
EnumSet.of(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED),
|
|
|
RMStateStoreEventType.STORE_RESERVATION,
|
|
|
new StoreReservationAllocationTransition())
|
|
|
- .addTransition(RMStateStoreState.ACTIVE,
|
|
|
- EnumSet.of(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED),
|
|
|
- RMStateStoreEventType.UPDATE_RESERVATION,
|
|
|
- new UpdateReservationAllocationTransition())
|
|
|
.addTransition(RMStateStoreState.ACTIVE,
|
|
|
EnumSet.of(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED),
|
|
|
RMStateStoreEventType.REMOVE_RESERVATION,
|
|
@@ -187,7 +183,6 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
RMStateStoreEventType.UPDATE_DELEGATION_TOKEN,
|
|
|
RMStateStoreEventType.UPDATE_AMRM_TOKEN,
|
|
|
RMStateStoreEventType.STORE_RESERVATION,
|
|
|
- RMStateStoreEventType.UPDATE_RESERVATION,
|
|
|
RMStateStoreEventType.REMOVE_RESERVATION));
|
|
|
|
|
|
private final StateMachine<RMStateStoreState,
|
|
@@ -524,35 +519,6 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static class UpdateReservationAllocationTransition implements
|
|
|
- MultipleArcTransition<RMStateStore, RMStateStoreEvent,
|
|
|
- RMStateStoreState> {
|
|
|
- @Override
|
|
|
- public RMStateStoreState transition(RMStateStore store,
|
|
|
- RMStateStoreEvent event) {
|
|
|
- if (!(event instanceof RMStateStoreStoreReservationEvent)) {
|
|
|
- // should never happen
|
|
|
- LOG.error("Illegal event type: " + event.getClass());
|
|
|
- return RMStateStoreState.ACTIVE;
|
|
|
- }
|
|
|
- boolean isFenced = false;
|
|
|
- RMStateStoreStoreReservationEvent reservationEvent =
|
|
|
- (RMStateStoreStoreReservationEvent) event;
|
|
|
- try {
|
|
|
- LOG.info("Updating reservation allocation." + reservationEvent
|
|
|
- .getReservationIdName());
|
|
|
- store.updateReservationState(
|
|
|
- reservationEvent.getReservationAllocation(),
|
|
|
- reservationEvent.getPlanName(),
|
|
|
- reservationEvent.getReservationIdName());
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.error("Error while updating reservation allocation.", e);
|
|
|
- isFenced = store.notifyStoreOperationFailedInternal(e);
|
|
|
- }
|
|
|
- return finalState(isFenced);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private static class RemoveReservationAllocationTransition implements
|
|
|
MultipleArcTransition<RMStateStore, RMStateStoreEvent,
|
|
|
RMStateStoreState> {
|
|
@@ -939,14 +905,6 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
planName, reservationIdName));
|
|
|
}
|
|
|
|
|
|
- public void updateReservation(
|
|
|
- ReservationAllocationStateProto reservationAllocation,
|
|
|
- String planName, String reservationIdName) {
|
|
|
- handleStoreEvent(new RMStateStoreStoreReservationEvent(
|
|
|
- reservationAllocation, RMStateStoreEventType.UPDATE_RESERVATION,
|
|
|
- planName, reservationIdName));
|
|
|
- }
|
|
|
-
|
|
|
public void removeReservation(String planName, String reservationIdName) {
|
|
|
handleStoreEvent(new RMStateStoreStoreReservationEvent(
|
|
|
null, RMStateStoreEventType.REMOVE_RESERVATION,
|
|
@@ -970,15 +928,6 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
protected abstract void removeReservationState(String planName,
|
|
|
String reservationIdName) throws Exception;
|
|
|
|
|
|
- /**
|
|
|
- * Blocking API
|
|
|
- * Derived classes must implement this method to update the state of
|
|
|
- * a reservation allocation.
|
|
|
- */
|
|
|
- protected abstract void updateReservationState(
|
|
|
- ReservationAllocationStateProto reservationAllocation, String planName,
|
|
|
- String reservationIdName) throws Exception;
|
|
|
-
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to remove the state of
|