File tree Expand file tree Collapse file tree 5 files changed +9
-18
lines changed
testkit-backend/src/main/java/neo4j/org/testkit/backend Expand file tree Collapse file tree 5 files changed +9
-18
lines changed Original file line number Diff line number Diff line change 30
30
public class AsyncSessionState
31
31
{
32
32
public AsyncSession session ;
33
- public int retryableState ;
34
- public String retryableErrorId ;
35
- public CompletableFuture <Void > result ;
33
+ public CompletableFuture <Void > txWorkFuture ;
36
34
37
35
public AsyncSessionState ( AsyncSession session )
38
36
{
39
37
this .session = session ;
40
- this .retryableState = 0 ;
41
- this .retryableErrorId = "" ;
42
38
}
43
39
}
Original file line number Diff line number Diff line change @@ -55,15 +55,15 @@ public CompletionStage<Optional<TestkitResponse>> processAsync( TestkitState tes
55
55
{
56
56
AsyncSessionState sessionState = testkitState .getAsyncSessionStates ().get ( data .getSessionId () );
57
57
Throwable throwable ;
58
- if ( !"" .equals ( data .errorId ) )
58
+ if ( !"" .equals ( data .getErrorId () ) )
59
59
{
60
- throwable = testkitState .getErrors ().get ( data .errorId );
60
+ throwable = testkitState .getErrors ().get ( data .getErrorId () );
61
61
}
62
62
else
63
63
{
64
64
throwable = new RuntimeException ( "Error from client in retryable tx" );
65
65
}
66
- sessionState .getResult ().completeExceptionally ( throwable );
66
+ sessionState .getTxWorkFuture ().completeExceptionally ( throwable );
67
67
return CompletableFuture .completedFuture ( Optional .empty () );
68
68
}
69
69
Original file line number Diff line number Diff line change 21
21
import lombok .Getter ;
22
22
import lombok .NoArgsConstructor ;
23
23
import lombok .Setter ;
24
- import neo4j .org .testkit .backend .AsyncSessionState ;
25
24
import neo4j .org .testkit .backend .SessionState ;
26
25
import neo4j .org .testkit .backend .TestkitState ;
27
26
import neo4j .org .testkit .backend .messages .responses .TestkitResponse ;
@@ -52,11 +51,7 @@ public TestkitResponse process( TestkitState testkitState )
52
51
@ Override
53
52
public CompletionStage <Optional <TestkitResponse >> processAsync ( TestkitState testkitState )
54
53
{
55
- AsyncSessionState sessionState = testkitState .getAsyncSessionStates ().get ( data .getSessionId () );
56
- if ( sessionState != null )
57
- {
58
- sessionState .getResult ().complete ( null );
59
- }
54
+ testkitState .getAsyncSessionStates ().get ( data .getSessionId () ).getTxWorkFuture ().complete ( null );
60
55
return CompletableFuture .completedFuture ( Optional .empty () );
61
56
}
62
57
Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ public CompletionStage<Optional<TestkitResponse>> processAsync( TestkitState tes
67
67
String txId = testkitState .newId ();
68
68
testkitState .getAsyncTransactions ().put ( txId , tx );
69
69
testkitState .getResponseWriter ().accept ( retryableTry ( txId ) );
70
- CompletableFuture <Void > tryResult = new CompletableFuture <>();
71
- sessionState .setResult ( tryResult );
72
- return tryResult ;
70
+ CompletableFuture <Void > txWorkFuture = new CompletableFuture <>();
71
+ sessionState .setTxWorkFuture ( txWorkFuture );
72
+ return txWorkFuture ;
73
73
};
74
74
75
75
return session .readTransactionAsync ( workWrapper )
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public CompletionStage<Optional<TestkitResponse>> processAsync( TestkitState tes
70
70
testkitState .getAsyncTransactions ().put ( txId , tx );
71
71
testkitState .getResponseWriter ().accept ( retryableTry ( txId ) );
72
72
CompletableFuture <Void > tryResult = new CompletableFuture <>();
73
- sessionState .setResult ( tryResult );
73
+ sessionState .setTxWorkFuture ( tryResult );
74
74
return tryResult ;
75
75
};
76
76
You can’t perform that action at this time.
0 commit comments