That's true, but it doesn't appear the comment is trying to lay out all possible scenarios. Instead, it is attempting to explain the rationale for offerManager.banOffer(offerId) a few lines later.
On Mon, Oct 2, 2017 at 4:30 PM, Mohit Jaggi <[email protected]> wrote: > Folks, > In the code below, isn't there a 3rd case where the offer was "used" and > hence not found for canceling? > > Mohit. > > public void handleRescind(OfferID offerId) { > log.info("Offer rescinded: {}", offerId.getValue()); > > // For rescinds, we want to ensure they are processed quickly before we > attempt to use an > // invalid offer. There are a few scenarios we want to be aware of: > // 1. We receive an offer, add it to OfferManager, and then get a > rescind. In this scenario, > // we can just remove the offer from the offers list. > // 2. We receive an offer, but before we add it to the OfferManager list > we get a rescind. > // In this scenario, we want to ensure that we do not use it/accept it > when the executor > // finally processes the offer. We will temporarily ban it and add a > command for the > // executor to unban it so future offers can be processed normally. > boolean offerCancelled = offerManager.cancelOffer(offerId); > >
