private void doMultiMapRemove ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } final Object key = message . body ( ) . getValue ( "key" ) ; if ( key == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No key specified." ) ) ; return ; } final Object value = message . body ( ) . getValue ( "value" ) ; if ( value != null ) { context . execute ( new Action < Boolean > ( ) { @ Override public Boolean perform ( ) { return data . getMultiMap ( formatKey ( name ) ) . remove ( key , value ) ; } } , new Handler < AsyncResult < Boolean > > ( ) { @ Override public void handle ( AsyncResult < Boolean > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putBoolean ( "result" , result . result ( ) ) ) ; } } } ) ; } else { context . execute ( new Action < Collection < Object > > ( ) { @ Override public Collection < Object > perform ( ) { return data . getMultiMap ( formatKey ( name ) ) . remove ( key ) ; } } , new Handler < AsyncResult < Collection < Object > > > ( ) { @ Override public void handle ( AsyncResult < Collection < Object > > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putArray ( "result" , new JsonArray ( result . result ( ) . toArray ( new Object [ result . result ( ) . size ( ) ] ) ) ) ) ; } } } ) ; } }
Handles a cluster multi - map remove command .