Skip to content

Delete Session.reset #1149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions driver/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@
<method>java.lang.Iterable values()</method>
</difference>

<difference>
<className>org/neo4j/driver/Session</className>
<differenceType>7002</differenceType>
<method>void reset()</method>
</difference>

</differences>
17 changes: 0 additions & 17 deletions driver/src/main/java/org/neo4j/driver/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,6 @@ public interface Session extends Resource, QueryRunner
*/
Bookmark lastBookmark();

/**
* Reset the current session. This sends an immediate RESET signal to the server which both interrupts
* any query that is currently executing and ignores any subsequently queued queries. Following
* the reset, the current transaction will have been rolled back and any outstanding failures will
* have been acknowledged.
*
* @deprecated This method should not be used and violates the expected usage pattern of {@link Session} objects.
* They are expected to be not thread-safe and should not be shared between thread. However this method is only
* useful when {@link Session} object is passed to another monitoring thread that calls it when appropriate.
* It is not useful when {@link Session} is used in a single thread because in this case {@link #close()}
* can be used. Since version 3.1, Neo4j database allows users to specify maximum transaction execution time and
* contains procedures to list and terminate running queries. These functions should be used instead of calling
* this method.
*/
@Deprecated
void reset();

/**
* Signal that you are done using this session. In the default driver usage, closing and accessing sessions is
* very low cost.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ public Bookmark lastBookmark()
return session.lastBookmark();
}

@Override
@SuppressWarnings( "deprecation" )
public void reset()
{
Futures.blockingGet( session.resetAsync(), () -> terminateConnectionOnThreadInterrupt( "Thread interrupted while resetting the session" ) );
}

private <T> T transaction( AccessMode mode, TransactionWork<T> work, TransactionConfig config )
{
// use different code path compared to async so that work is executed in the caller thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,6 @@ public CompletionStage<UnmanagedTransaction> beginTransactionAsync( AccessMode m
return newTransactionStage;
}

public CompletionStage<Void> resetAsync()
{
return existingTransactionOrNull()
.thenAccept( tx ->
{
if ( tx != null )
{
tx.markTerminated( null );
}
} )
.thenCompose( ignore -> connectionStage )
.thenCompose( connection ->
{
if ( connection != null )
{
// there exists an active connection, send a RESET message over it
return connection.reset();
}
return completedWithNull();
} );
}

public RetryLogic retryLogic()
{
return retryLogic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,6 @@ public Bookmark lastBookmark()
return session.lastBookmark();
}

public Publisher<Void> reset()
{
return createEmptyPublisher( session::resetAsync );
}

@Override
public <T> Publisher<T> close()
{
Expand Down
Loading