private void undeployRemovedComponents ( final NetworkContext context , final NetworkContext runningContext , final Handler < AsyncResult < Void > > doneHandler ) { // Undeploy any components that were removed from the network. final List < ComponentContext < ? > > removedComponents = new ArrayList <> ( ) ; for ( ComponentContext < ? > runningComponent : runningContext . components ( ) ) { if ( context . component ( runningComponent . name ( ) ) == null ) { removedComponents . add ( runningComponent ) ; } } if ( ! removedComponents . isEmpty ( ) ) { final CountingCompletionHandler < Void > counter = new CountingCompletionHandler < Void > ( removedComponents . size ( ) ) ; counter . setHandler ( new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { log . info ( String . format ( "%s - Removed %d components" , NetworkManager . this , removedComponents . size ( ) ) ) ; new DefaultFutureResult < Void > ( ( Void ) null ) . setHandler ( doneHandler ) ; } } } ) ; undeployComponents ( removedComponents , counter ) ; } else { new DefaultFutureResult < Void > ( ( Void ) null ) . setHandler ( doneHandler ) ; } }
Undeploys components that were removed from the network .