public CompletableFuture < byte [ ] > invoke ( PrimitiveOperation operation ) { CompletableFuture < byte [ ] > future = new CompletableFuture <> ( ) ; switch ( operation . id ( ) . type ( ) ) { case COMMAND : context . execute ( ( ) -> invokeCommand ( operation , future ) ) ; break ; case QUERY : context . execute ( ( ) -> invokeQuery ( operation , future ) ) ; break ; default : throw new IllegalArgumentException ( "Unknown operation type " + operation . id ( ) . type ( ) ) ; } return future ; }
Submits a operation to the cluster .