|
58 | 58 | import java.util.Map; |
59 | 59 | import java.util.concurrent.ThreadLocalRandom; |
60 | 60 | import java.util.concurrent.atomic.AtomicLong; |
| 61 | +import java.util.logging.Logger; |
61 | 62 | import javax.annotation.Nullable; |
62 | 63 | import javax.annotation.concurrent.GuardedBy; |
63 | 64 |
|
|
67 | 68 | */ |
68 | 69 | abstract class AbstractReadContext |
69 | 70 | implements ReadContext, AbstractResultSet.Listener, SessionTransaction { |
| 71 | + private static final Logger logger = Logger.getLogger(AbstractReadContext.class.getName()); |
70 | 72 |
|
71 | 73 | abstract static class Builder<B extends Builder<?, T>, T extends AbstractReadContext> { |
72 | 74 | private SessionImpl session; |
@@ -797,7 +799,6 @@ CloseableIterator<PartialResultSet> startStream( |
797 | 799 | isRouteToLeader()); |
798 | 800 | session.markUsed(clock.instant()); |
799 | 801 | stream.setCall(call, request.getTransaction().hasBegin()); |
800 | | - call.request(prefetchChunks); |
801 | 802 | return stream; |
802 | 803 | } |
803 | 804 |
|
@@ -952,6 +953,15 @@ ResultSet readInternalWithOptions( |
952 | 953 | } else if (defaultDirectedReadOptions != null) { |
953 | 954 | builder.setDirectedReadOptions(defaultDirectedReadOptions); |
954 | 955 | } |
| 956 | + if (readOptions.hasLockHint()) { |
| 957 | + if (isReadOnly()) { |
| 958 | + logger.warning( |
| 959 | + "Lock hint is only supported for ReadWrite transactions. " |
| 960 | + + "Overriding lock hint to default unspecified."); |
| 961 | + } else { |
| 962 | + builder.setLockHint(readOptions.lockHint()); |
| 963 | + } |
| 964 | + } |
955 | 965 | final int prefetchChunks = |
956 | 966 | readOptions.hasPrefetchChunks() ? readOptions.prefetchChunks() : defaultPrefetchChunks; |
957 | 967 | ResumableStreamIterator stream = |
@@ -992,7 +1002,6 @@ CloseableIterator<PartialResultSet> startStream( |
992 | 1002 | isRouteToLeader()); |
993 | 1003 | session.markUsed(clock.instant()); |
994 | 1004 | stream.setCall(call, /* withBeginTransaction = */ builder.getTransaction().hasBegin()); |
995 | | - call.request(prefetchChunks); |
996 | 1005 | return stream; |
997 | 1006 | } |
998 | 1007 |
|
|
0 commit comments