Search in sources :

Example 1 with RescindResourceOfferMessage

use of mesos.internal.Messages.RescindResourceOfferMessage in project jesos by groupon.

the class LocalSchedulerMessageProcessor method frameworkRescindOffer.

@Subscribe
public void frameworkRescindOffer(final RescindResourceOfferMessageEnvelope envelope) {
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");
    final UPID sender = envelope.getSender();
    if (!driverIsConnected(sender)) {
        return;
    }
    final RescindResourceOfferMessage rescindResourceOfferMessage = envelope.getMessage();
    context.removeAllOffers(rescindResourceOfferMessage.getOfferId());
    eventBus.post(new SchedulerCallback() {

        @Override
        public Runnable getCallback(final Scheduler scheduler, final SchedulerDriver schedulerDriver) {
            return new Runnable() {

                @Override
                public void run() {
                    scheduler.offerRescinded(schedulerDriver, rescindResourceOfferMessage.getOfferId());
                }
            };
        }
    });
}
Also used : UPID(com.groupon.mesos.util.UPID) Scheduler(org.apache.mesos.Scheduler) RescindResourceOfferMessage(mesos.internal.Messages.RescindResourceOfferMessage) SchedulerDriver(org.apache.mesos.SchedulerDriver) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)1 UPID (com.groupon.mesos.util.UPID)1 RescindResourceOfferMessage (mesos.internal.Messages.RescindResourceOfferMessage)1 Scheduler (org.apache.mesos.Scheduler)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1