File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 5858import java .util .Map ;
5959import java .util .concurrent .ThreadLocalRandom ;
6060import java .util .concurrent .atomic .AtomicLong ;
61+ import java .util .logging .Logger ;
6162import javax .annotation .Nullable ;
6263import javax .annotation .concurrent .GuardedBy ;
6364
6768 */
6869abstract class AbstractReadContext
6970 implements ReadContext , AbstractResultSet .Listener , SessionTransaction {
71+ private static final Logger logger = Logger .getLogger (AbstractReadContext .class .getName ());
7072
7173 abstract static class Builder <B extends Builder <?, T >, T extends AbstractReadContext > {
7274 private SessionImpl session ;
@@ -951,8 +953,14 @@ ResultSet readInternalWithOptions(
951953 } else if (defaultDirectedReadOptions != null ) {
952954 builder .setDirectedReadOptions (defaultDirectedReadOptions );
953955 }
954- if (readOptions .hasLockHint () && !isReadOnly ()) {
955- builder .setLockHint (readOptions .lockHint ());
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+ }
956964 }
957965 final int prefetchChunks =
958966 readOptions .hasPrefetchChunks () ? readOptions .prefetchChunks () : defaultPrefetchChunks ;
You can’t perform that action at this time.
0 commit comments