Skip to content

Commit

Permalink
chore: remove dead code from constructor of SessionPoolTransactionCon…
Browse files Browse the repository at this point in the history
…text.
  • Loading branch information
arpan14 committed Nov 1, 2023
1 parent 6cdef81 commit 593a10b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,18 +622,10 @@ public CursorState tryNext() {
static class SessionPoolTransactionContext implements TransactionContext {
private final SessionNotFoundHandler handler;
final TransactionContext delegate;
private final SessionImpl sessionImpl;
private final Clock clock;

SessionPoolTransactionContext(
SessionNotFoundHandler handler,
TransactionContext delegate,
SessionImpl sessionImpl,
Clock clock) {

SessionPoolTransactionContext(SessionNotFoundHandler handler, TransactionContext delegate) {
this.handler = Preconditions.checkNotNull(handler);
this.delegate = delegate;
this.sessionImpl = sessionImpl;
this.clock = clock;
}

@Override
Expand Down Expand Up @@ -831,9 +823,7 @@ public TransactionContext begin() {
}

private TransactionContext internalBegin() {
TransactionContext res =
new SessionPoolTransactionContext(
this, delegate.begin(), session.get().delegate, sessionPool.clock);
TransactionContext res = new SessionPoolTransactionContext(this, delegate.begin());
session.get().markUsed();
return res;
}
Expand Down Expand Up @@ -883,14 +873,11 @@ public TransactionContext resetForRetry() {
while (true) {
try {
if (restartedAfterSessionNotFound) {
TransactionContext res =
new SessionPoolTransactionContext(
this, delegate.begin(), session.get().delegate, sessionPool.clock);
TransactionContext res = new SessionPoolTransactionContext(this, delegate.begin());
restartedAfterSessionNotFound = false;
return res;
} else {
return new SessionPoolTransactionContext(
this, delegate.resetForRetry(), session.get().delegate, sessionPool.clock);
return new SessionPoolTransactionContext(this, delegate.resetForRetry());
}
} catch (SessionNotFoundException e) {
session = sessionPool.replaceSession(e, session);
Expand Down Expand Up @@ -2012,7 +1999,7 @@ enum Position {
private final ExecutorFactory<ScheduledExecutorService> executorFactory;

final PoolMaintainer poolMaintainer;
final Clock clock;
private final Clock clock;
/**
* initialReleasePosition determines where in the pool sessions are added when they are released
* into the pool the first time. This is always RANDOM in production, but some tests use FIRST to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ public void onFailure(Throwable t) {
public void onSuccess(TransactionContext result) {
delegateTxnFuture.set(
new SessionPool.SessionPoolTransactionContext(
SessionPoolAsyncTransactionManager.this,
result,
session.get().delegate,
pool.clock));
SessionPoolAsyncTransactionManager.this, result));
}
},
MoreExecutors.directExecutor());
Expand Down Expand Up @@ -256,10 +253,7 @@ public TransactionContextFuture resetForRetryAsync() {
MoreExecutors.directExecutor()),
input ->
new SessionPool.SessionPoolTransactionContext(
SessionPoolAsyncTransactionManager.this,
input,
session.get().delegate,
pool.clock),
SessionPoolAsyncTransactionManager.this, input),
MoreExecutors.directExecutor()));
}

Expand Down

0 comments on commit 593a10b

Please sign in to comment.