private void doListNetwork ( final Message < JsonObject > message ) { context . execute ( new Action < List < NetworkContext > > ( ) { @ Override public List < NetworkContext > perform ( ) { List < NetworkContext > contexts = new ArrayList <> ( ) ; for ( String name : networks ) { String scontext = data . < String , String > getMap ( String . format ( "%s.%s" , cluster , name ) ) . get ( String . format ( "%s.%s" , cluster , name ) ) ; if ( scontext != null ) { contexts . add ( Contexts . < NetworkContext > deserialize ( new JsonObject ( scontext ) ) ) ; } } return contexts ; } } , new Handler < AsyncResult < List < NetworkContext > > > ( ) { @ Override public void handle ( AsyncResult < List < NetworkContext > > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else { JsonArray contexts = new JsonArray ( ) ; for ( NetworkContext context : result . result ( ) ) { contexts . addObject ( Contexts . serialize ( context ) ) ; } message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putArray ( "result" , contexts ) ) ; } } } ) ; }
Lists the networks running in the cluster .