@ Override @ SuppressWarnings ( "checkstyle:hiddenfield" ) public void resourceOffers ( final SchedulerDriver driver , final List < Protos . Offer > offers ) { final Map < String , NodeDescriptorEventImpl . Builder > nodeDescriptorEvents = new HashMap <> ( ) ; for ( final Offer offer : offers ) { if ( nodeDescriptorEvents . get ( offer . getSlaveId ( ) . getValue ( ) ) == null ) { nodeDescriptorEvents . put ( offer . getSlaveId ( ) . getValue ( ) , NodeDescriptorEventImpl . newBuilder ( ) . setIdentifier ( offer . getSlaveId ( ) . getValue ( ) ) . setHostName ( offer . getHostname ( ) ) . setPort ( this . mesosSlavePort ) . setMemorySize ( getMemory ( offer ) ) ) ; } else { final NodeDescriptorEventImpl . Builder builder = nodeDescriptorEvents . get ( offer . getSlaveId ( ) . getValue ( ) ) ; builder . setMemorySize ( builder . build ( ) . getMemorySize ( ) + getMemory ( offer ) ) ; } this . offers . put ( offer . getId ( ) . getValue ( ) , offer ) ; } for ( final NodeDescriptorEventImpl . Builder ndpBuilder : nodeDescriptorEvents . values ( ) ) { this . reefEventHandlers . onNodeDescriptor ( ndpBuilder . build ( ) ) ; } if ( outstandingRequests . size ( ) > 0 ) { doResourceRequest ( outstandingRequests . remove ( ) ) ; } }
All offers in each batch of offers will be either be launched or declined .