@@ -59,8 +59,6 @@ public class BatchClientImpl implements BatchClient {
5959 @ GuardedBy ("multiplexedSessionLock" )
6060 private final AtomicReference <SessionImpl > multiplexedSessionReference ;
6161
62- private final Clock clock ;
63-
6462 BatchClientImpl (SessionClient sessionClient , boolean isMultiplexedSessionEnabled ) {
6563 this .sessionClient = checkNotNull (sessionClient );
6664 this .isMultiplexedSessionEnabled = isMultiplexedSessionEnabled ;
@@ -76,7 +74,6 @@ public class BatchClientImpl implements BatchClient {
7674 // This also ensured that a new session is created on first request.
7775 this .expirationDate = new AtomicReference <>(Instant .MIN );
7876 this .multiplexedSessionReference = new AtomicReference <>();
79- clock = Clock .systemUTC ();
8077 }
8178
8279 @ Override
@@ -137,10 +134,10 @@ public BatchReadOnlyTransaction batchReadOnlyTransaction(BatchTransactionId batc
137134 private SessionImpl getMultiplexedSession () {
138135 this .multiplexedSessionLock .lock ();
139136 try {
140- if (this . clock .instant ().isAfter (this .expirationDate .get ())
137+ if (Clock . systemUTC () .instant ().isAfter (this .expirationDate .get ())
141138 || this .multiplexedSessionReference .get () == null ) {
142139 this .multiplexedSessionReference .set (this .sessionClient .createMultiplexedSession ());
143- this .expirationDate .set (this . clock .instant ().plus (this .sessionExpirationDuration ));
140+ this .expirationDate .set (Clock . systemUTC () .instant ().plus (this .sessionExpirationDuration ));
144141 }
145142 return this .multiplexedSessionReference .get ();
146143 } finally {
@@ -151,14 +148,12 @@ private SessionImpl getMultiplexedSession() {
151148 private static class BatchReadOnlyTransactionImpl extends MultiUseReadOnlyTransaction
152149 implements BatchReadOnlyTransaction {
153150 private final String sessionName ;
154- private final boolean isMultiplexedSession ;
155151 private final Map <SpannerRpc .Option , ?> options ;
156152
157153 BatchReadOnlyTransactionImpl (
158154 MultiUseReadOnlyTransaction .Builder builder , TimestampBound bound ) {
159155 super (builder .setTimestampBound (bound ));
160156 this .sessionName = session .getName ();
161- this .isMultiplexedSession = session .getIsMultiplexed ();
162157 this .options = session .getOptions ();
163158 initTransaction ();
164159 }
@@ -168,13 +163,11 @@ private static class BatchReadOnlyTransactionImpl extends MultiUseReadOnlyTransa
168163 super (builder .setTransactionId (batchTransactionId .getTransactionId ()));
169164 this .sessionName = session .getName ();
170165 this .options = session .getOptions ();
171- this .isMultiplexedSession = session .getIsMultiplexed ();
172166 }
173167
174168 @ Override
175169 public BatchTransactionId getBatchTransactionId () {
176- return new BatchTransactionId (
177- sessionName , getTransactionId (), getReadTimestamp (), session .getIsMultiplexed ());
170+ return new BatchTransactionId (sessionName , getTransactionId (), getReadTimestamp ());
178171 }
179172
180173 @ Override
0 commit comments