private static String invokedProcedureString( RoutingProcedureResponse response ) { Statement statement = response.procedure(); return statement.text() + " " + statement.parameters(); } }
@Override public StatementResult run(Statement statement) { HashMap<String, Object> serializableMap = new HashMap<>(statement.parameters().asMap()); Iterator<Map<String, Object>> iterator = client.submit(statement.text(), serializableMap).iterator(); return new GremlinServerStatementResult(serverInfo, statement, iterator, converter); }
private static CompletionStage<InternalStatementResultCursor> runStatement( Connection connection, Statement statement, ExplicitTransaction tx, boolean waitForRunResponse ) { String query = statement.text(); Map<String,Value> params = statement.parameters().asMap( ofValue() ); CompletableFuture<Void> runCompletedFuture = new CompletableFuture<>(); RunResponseHandler runHandler = new RunResponseHandler( runCompletedFuture, METADATA_EXTRACTOR ); PullAllResponseHandler pullAllHandler = newPullAllHandler( statement, runHandler, connection, tx ); connection.writeAndFlush( new RunMessage( query, params ), runHandler, PullAllMessage.PULL_ALL, pullAllHandler ); if ( waitForRunResponse ) { // wait for response of RUN before proceeding return runCompletedFuture.thenApply( ignore -> new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } else { return completedFuture( new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } }
private static CompletionStage<InternalStatementResultCursor> runStatement( Connection connection, Statement statement, BookmarksHolder bookmarksHolder, ExplicitTransaction tx, TransactionConfig config, boolean waitForRunResponse ) { String query = statement.text(); Map<String,Value> params = statement.parameters().asMap( ofValue() ); CompletableFuture<Void> runCompletedFuture = new CompletableFuture<>(); Message runMessage = new RunWithMetadataMessage( query, params, bookmarksHolder.getBookmarks(), config ); RunResponseHandler runHandler = new RunResponseHandler( runCompletedFuture, METADATA_EXTRACTOR ); PullAllResponseHandler pullAllHandler = newPullAllHandler( statement, runHandler, connection, bookmarksHolder, tx ); connection.writeAndFlush( runMessage, runHandler, PULL_ALL, pullAllHandler ); if ( waitForRunResponse ) { // wait for response of RUN before proceeding return runCompletedFuture.thenApply( ignore -> new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } else { return completedFuture( new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } }