@@ -408,7 +408,7 @@ private <T> T execute(String tableName, TableExecuteCallback<T> callback) throws
408408 /**
409409 * Execute with a route strategy.
410410 */
411- private <T > T execute (String tableName , TableExecuteCallback <T > callback , ObTableConsistencyLevel currentConsistencyLevel )
411+ private <T > T execute (String tableName , TableExecuteCallback <T > callback , ObReadConsistency currentConsistencyLevel )
412412 throws Exception {
413413 if (tableName == null || tableName .isEmpty ()) {
414414 throw new IllegalArgumentException ("table name is null" );
@@ -617,7 +617,7 @@ private <T> T execute(String tableName, OperationExecuteCallback<T> callback)
617617 * Execute with a route strategy for mutation
618618 */
619619 private <T > T execute (String tableName , OperationExecuteCallback <T > callback ,
620- ObTableConsistencyLevel currentConsistencyLevel ) throws Exception {
620+ ObReadConsistency currentConsistencyLevel ) throws Exception {
621621 if (tableName == null || tableName .isEmpty ()) {
622622 throw new IllegalArgumentException ("table name is null" );
623623 }
@@ -1105,7 +1105,7 @@ public Map<String, Object> get(final String tableName, final Object[] rowKey,
11051105 throw new IllegalArgumentException ("table name is null" );
11061106 }
11071107 final long startTime = System .currentTimeMillis ();
1108- final ObTableConsistencyLevel readConsistency = tableRoute .getReadConsistency ();
1108+ final ObReadConsistency readConsistency = tableRoute .getReadConsistency ();
11091109 return execute (tableName , new TableExecuteCallback <Map <String , Object >>(rowKey ) {
11101110 @ Override
11111111 public Map <String , Object > execute (ObTableParam tableParam ) throws Exception {
@@ -1167,7 +1167,7 @@ public Long execute(ObTableParam tableParam) throws Exception {
11671167 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
11681168 return ((ObTableOperationResult ) result ).getAffectedRows ();
11691169 }
1170- }, ObTableConsistencyLevel .STRONG );
1170+ }, ObReadConsistency .STRONG );
11711171 }
11721172
11731173 /**
@@ -1206,7 +1206,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
12061206 checkResult (obTable .getIp (), obTable .getPort (), request , result );
12071207 return result ;
12081208 }
1209- }, ObTableConsistencyLevel .STRONG );
1209+ }, ObReadConsistency .STRONG );
12101210 }
12111211
12121212 /**
@@ -1247,7 +1247,7 @@ public Long execute(ObTableParam tableParam) throws Exception {
12471247 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
12481248 return ((ObTableOperationResult ) result ).getAffectedRows ();
12491249 }
1250- }, ObTableConsistencyLevel .STRONG );
1250+ }, ObReadConsistency .STRONG );
12511251 }
12521252
12531253 /**
@@ -1283,7 +1283,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
12831283 checkResult (obTable .getIp (), obTable .getPort (), request , result );
12841284 return result ;
12851285 }
1286- }, ObTableConsistencyLevel .STRONG );
1286+ }, ObReadConsistency .STRONG );
12871287 }
12881288
12891289 /**
@@ -1324,7 +1324,7 @@ public Long execute(ObTableParam tableParam) throws Exception {
13241324 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
13251325 return ((ObTableOperationResult ) result ).getAffectedRows ();
13261326 }
1327- }, ObTableConsistencyLevel .STRONG );
1327+ }, ObReadConsistency .STRONG );
13281328 }
13291329
13301330 /**
@@ -1363,7 +1363,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
13631363 checkResult (obTable .getIp (), obTable .getPort (), request , result );
13641364 return result ;
13651365 }
1366- }, ObTableConsistencyLevel .STRONG );
1366+ }, ObReadConsistency .STRONG );
13671367 }
13681368
13691369 /**
@@ -1396,7 +1396,7 @@ public Map<String, Object> get(final String tableName, final Row rowKey,
13961396 * @throws Exception exception
13971397 */
13981398 public Map <String , Object > get (final String tableName , final Row rowKey ,
1399- final String [] selectColumns , final ObTableConsistencyLevel readConsistency ) throws Exception {
1399+ final String [] selectColumns , final ObReadConsistency readConsistency ) throws Exception {
14001400 final long start = System .currentTimeMillis ();
14011401 return execute (tableName ,
14021402 new OperationExecuteCallback <Map <String , Object >>(rowKey , null ) {
@@ -1410,7 +1410,7 @@ public Map<String, Object> execute(ObTableParam tableParam) throws Exception {
14101410 ObTableOperationRequest request = ObTableOperationRequest .getInstance (
14111411 tableName , GET , rowKey .getValues (), selectColumns , null ,
14121412 obTable .getObTableOperationTimeout ());
1413- ObTableConsistencyLevel consistencyLevel = readConsistency ;
1413+ ObReadConsistency consistencyLevel = readConsistency ;
14141414 if (readConsistency == null ) { // when readConsistency is not set, use the global read consistency level
14151415 consistencyLevel = tableRoute .getReadConsistency ();
14161416 }
@@ -1465,7 +1465,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
14651465 checkResult (obTable .getIp (), obTable .getPort (), request , result );
14661466 return result ;
14671467 }
1468- }, ObTableConsistencyLevel .STRONG );
1468+ }, ObReadConsistency .STRONG );
14691469 }
14701470
14711471 /**
@@ -1506,7 +1506,7 @@ public Long execute(ObTableParam tableParam) throws Exception {
15061506 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
15071507 return ((ObTableOperationResult ) result ).getAffectedRows ();
15081508 }
1509- }, ObTableConsistencyLevel .STRONG );
1509+ }, ObReadConsistency .STRONG );
15101510 }
15111511
15121512 /**
@@ -1545,7 +1545,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
15451545 checkResult (obTable .getIp (), obTable .getPort (), request , result );
15461546 return result ;
15471547 }
1548- }, ObTableConsistencyLevel .STRONG );
1548+ }, ObReadConsistency .STRONG );
15491549 }
15501550
15511551 /**
@@ -1586,7 +1586,7 @@ public Long execute(ObTableParam tableParam) throws Exception {
15861586 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
15871587 return ((ObTableOperationResult ) result ).getAffectedRows ();
15881588 }
1589- }, ObTableConsistencyLevel .STRONG );
1589+ }, ObReadConsistency .STRONG );
15901590 }
15911591
15921592 /**
@@ -1629,7 +1629,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
16291629 checkResult (obTable .getIp (), obTable .getPort (), request , result );
16301630 return result ;
16311631 }
1632- }, ObTableConsistencyLevel .STRONG );
1632+ }, ObReadConsistency .STRONG );
16331633 }
16341634
16351635 /**
@@ -1688,7 +1688,7 @@ public Map<String, Object> execute(ObTableParam tableParam) throws Exception {
16881688 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
16891689 return ((ObTableOperationResult ) result ).getEntity ().getSimpleProperties ();
16901690 }
1691- }, ObTableConsistencyLevel .STRONG );
1691+ }, ObReadConsistency .STRONG );
16921692 }
16931693
16941694 /**
@@ -1733,7 +1733,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
17331733 checkResult (obTable .getIp (), obTable .getPort (), request , result );
17341734 return result ;
17351735 }
1736- }, ObTableConsistencyLevel .STRONG );
1736+ }, ObReadConsistency .STRONG );
17371737 }
17381738
17391739 /**
@@ -1770,7 +1770,7 @@ public Map<String, Object> execute(ObTableParam tableParam) throws Exception {
17701770 checkObTableOperationResult (obTable .getIp (), obTable .getPort (), request , result );
17711771 return ((ObTableOperationResult ) result ).getEntity ().getSimpleProperties ();
17721772 }
1773- }, ObTableConsistencyLevel .STRONG );
1773+ }, ObReadConsistency .STRONG );
17741774 }
17751775
17761776 /**
@@ -1809,7 +1809,7 @@ public ObPayload execute(ObTableParam tableParam) throws Exception {
18091809 checkResult (obTable .getIp (), obTable .getPort (), request , result );
18101810 return result ;
18111811 }
1812- }, ObTableConsistencyLevel .STRONG );
1812+ }, ObReadConsistency .STRONG );
18131813 }
18141814
18151815 /**
@@ -2149,8 +2149,8 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E
21492149 ObTableClientQueryImpl tableQuery = new ObTableClientQueryImpl (tableName ,
21502150 ((ObTableQueryRequest ) request ).getTableQuery (), this );
21512151 tableQuery .setEntityType (request .getEntityType ());
2152- if (request .getConsistencyLevel () == ObTableConsistencyLevel . EVENTUAL ) {
2153- tableQuery .setReadConsistency ("weak" );
2152+ if (request .getConsistencyLevel () == ObReadConsistency . WEAK ) {
2153+ tableQuery .setReadConsistency (ObReadConsistency . WEAK );
21542154 }
21552155 tableQuery .setHbaseOpType (request .getHbaseOpType ());
21562156 return new ObClusterTableQuery (tableQuery ).executeInternal ();
@@ -2160,8 +2160,8 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E
21602160 ObTableClientQueryImpl tableQuery = new ObTableClientQueryImpl (tableName ,
21612161 ((ObTableQueryAsyncRequest ) request ).getObTableQueryRequest ().getTableQuery (), this );
21622162 tableQuery .setEntityType (request .getEntityType ());
2163- if (request .getConsistencyLevel () == ObTableConsistencyLevel . EVENTUAL ) {
2164- tableQuery .setReadConsistency ("weak" );
2163+ if (request .getConsistencyLevel () == ObReadConsistency . WEAK ) {
2164+ tableQuery .setReadConsistency (ObReadConsistency . WEAK );
21652165 }
21662166 tableQuery .setHbaseOpType (request .getHbaseOpType ());
21672167 ObClusterTableQuery clusterTableQuery = new ObClusterTableQuery (tableQuery );
@@ -2551,7 +2551,7 @@ public void setParamURL(String paramURL) throws IllegalArgumentException {
25512551 BOOT .info (String .format ("will set database=%s" , kv [1 ]));
25522552 }
25532553 } else if (Constants .READ_CONSISTENCY .equalsIgnoreCase (kv [0 ])) {
2554- tableRoute .setReadConsistency (kv [1 ]);
2554+ tableRoute .setReadConsistency (ObReadConsistency . getByName ( kv [1 ]) );
25552555 if (BOOT .isInfoEnabled ()) {
25562556 BOOT .info (String .format ("will set %s=%s" , Constants .READ_CONSISTENCY , kv [1 ]));
25572557 }
@@ -2754,16 +2754,16 @@ public ObTableClientType getClientType(RunningMode runningMode) {
27542754 }
27552755 }
27562756
2757- public void setReadConsistency (String readConsistency ) throws IllegalArgumentException {
2757+ public void setReadConsistency (ObReadConsistency readConsistency ) throws IllegalArgumentException {
27582758 tableRoute .setReadConsistency (readConsistency );
27592759 }
27602760
27612761 public String getReadConsistency () {
27622762 return tableRoute .getReadConsistency ().name ();
27632763 }
27642764
2765- public void setRoutePolicy (String policy ) throws IllegalArgumentException {
2766- tableRoute .setRoutePolicy (ObRoutePolicy . getByName ( policy ) );
2765+ public void setRoutePolicy (ObRoutePolicy policy ) throws IllegalArgumentException {
2766+ tableRoute .setRoutePolicy (policy );
27672767 }
27682768
27692769 public ObTableServerCapacity getServerCapacity () {
0 commit comments