Skip to content

Commit d6b23cc

Browse files
committed
format code
1 parent d59d565 commit d6b23cc

22 files changed

+140
-114
lines changed

src/main/java/com/alipay/oceanbase/rpc/ObClusterTableBatchOps.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,12 @@ void preCheck() {
193193
ObTableOperationType lastType = operations.get(0).getOperationType();
194194
if (returnOneResult && !ObGlobal.isReturnOneResultSupport()) {
195195
throw new FeatureNotSupportedException(
196-
"returnOneResult is not supported in this Observer version [" + ObGlobal.obVsnString() +"]");
196+
"returnOneResult is not supported in this Observer version ["
197+
+ ObGlobal.obVsnString() + "]");
197198
} else if (returnOneResult
198-
&& !(this.tableBatchOps.getObTableBatchOperation().isSameType() && (lastType == ObTableOperationType.INSERT
199-
|| lastType == ObTableOperationType.PUT
200-
|| lastType == ObTableOperationType.REPLACE || lastType == ObTableOperationType.DEL))) {
199+
&& !(this.tableBatchOps.getObTableBatchOperation().isSameType() && (lastType == ObTableOperationType.INSERT
200+
|| lastType == ObTableOperationType.PUT
201+
|| lastType == ObTableOperationType.REPLACE || lastType == ObTableOperationType.DEL))) {
201202
throw new IllegalArgumentException(
202203
"returnOneResult only support multi-insert/put/replace/del");
203204
}

src/main/java/com/alipay/oceanbase/rpc/ObGlobal.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ public static boolean isLsOpSupport() {
8686
}
8787

8888
public static boolean isReturnOneResultSupport() {
89-
return OB_VERSION >= OB_VERSION_4_2_3_0 && OB_VERSION < OB_VERSION_4_3_0_0 || OB_VERSION >= OB_VERSION_4_3_4_0;
89+
return OB_VERSION >= OB_VERSION_4_2_3_0 && OB_VERSION < OB_VERSION_4_3_0_0
90+
|| OB_VERSION >= OB_VERSION_4_3_4_0;
9091
}
9192

9293
public static final long OB_VERSION_4_2_1_0 = calcVersion(4, (short) 2, (byte) 1, (byte) 0);

src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
817817
// if the cause is that ODP partition meta have expired, try to fetch new one
818818
if (ex instanceof ObTablePartitionChangeException
819819
&& ((ObTablePartitionChangeException) ex).getErrorCode() == OB_ERR_KV_ROUTE_ENTRY_EXPIRE.errorCode) {
820+
System.out.println("odp partition changed.");
820821
needRenew = true;
821822
} else {
822823
throw ex;

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableConnection.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,19 @@
3838

3939
public class ObTableConnection {
4040

41-
private static final Logger LOGGER = TableClientLoggerFactory
42-
.getLogger(ObTableConnection.class);
41+
private static final Logger LOGGER = TableClientLoggerFactory
42+
.getLogger(ObTableConnection.class);
4343
private ObBytesString credential;
44-
private long tenantId = 1; //默认值切勿不要随意改动
44+
private long tenantId = 1; //默认值切勿不要随意改动
4545
private Connection connection;
4646
private final ObTable obTable;
47-
private long uniqueId; // as trace0 in rpc header
48-
private AtomicLong sequence; // as trace1 in rpc header
49-
private AtomicBoolean isReConnecting = new AtomicBoolean(false); // indicate is re-connecting or not
50-
private AtomicBoolean isExpired = new AtomicBoolean(false);
47+
private long uniqueId; // as trace0 in rpc header
48+
private AtomicLong sequence; // as trace1 in rpc header
49+
private AtomicBoolean isReConnecting = new AtomicBoolean(false); // indicate is re-connecting or not
50+
private AtomicBoolean isExpired = new AtomicBoolean(false);
5151
private LocalDateTime lastConnectionTime;
5252
private boolean loginWithConfigs = false;
53+
5354
public static long ipToLong(String strIp) {
5455
String[] ip = strIp.split("\\.");
5556
return (Long.parseLong(ip[0]) << 24) + (Long.parseLong(ip[1]) << 16)
@@ -69,10 +70,10 @@ public void setExpired(boolean expired) {
6970
isExpired.set(expired);
7071
}
7172

72-
7373
public void enableLoginWithConfigs() {
7474
loginWithConfigs = true;
7575
}
76+
7677
/*
7778
* Ob table connection.
7879
*/

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
141141
}
142142
if (resultCode.getRcode() != 0) {
143143
String errMessage = TraceUtil.formatTraceMessage(conn, request,
144-
"routed to the wrong server: " + response.getMessage());
144+
"routed to the wrong server: " + response.getMessage());
145145
logger.warn(errMessage);
146146
if (needFetchAll(resultCode.getRcode(), resultCode.getPcode())) {
147147
throw new ObTableNeedFetchAllException(errMessage);
148148
} else if (needFetchPartial(resultCode.getRcode())) {
149149
throw new ObTableRoutingWrongException(errMessage);
150150
} else {
151-
ExceptionUtil.throwObTableException(conn.getObTable().getIp(), conn.getObTable()
152-
.getPort(), response.getHeader().getTraceId1(), response.getHeader()
153-
.getTraceId0(), resultCode.getRcode(), resultCode.getErrMsg());
151+
ExceptionUtil.throwObTableException(conn.getObTable().getIp(), conn
152+
.getObTable().getPort(), response.getHeader().getTraceId1(), response
153+
.getHeader().getTraceId0(), resultCode.getRcode(), resultCode.getErrMsg());
154154
}
155155
}
156156

@@ -186,7 +186,6 @@ protected InvokeFuture createInvokeFuture(Connection conn, RemotingCommand reque
186186
InvokeCallback invokeCallback) {
187187
return new ObClientFuture(request.getId());
188188
}
189-
190189

191190
// schema changed
192191
private boolean needFetchAll(int errorCode, int pcode) {

src/main/java/com/alipay/oceanbase/rpc/mutation/BatchOperation.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@ public BatchOperation setReturnOneResult(boolean returnOneResult) {
160160
public BatchOperationResult execute() throws Exception {
161161
if (returnOneResult && !ObGlobal.isReturnOneResultSupport()) {
162162
throw new FeatureNotSupportedException(
163-
"returnOneResult is not supported in this Observer version [" + ObGlobal.obVsnString() +"]");
163+
"returnOneResult is not supported in this Observer version ["
164+
+ ObGlobal.obVsnString() + "]");
164165
} else if (returnOneResult
165-
&& !(isSameType && (lastType == ObTableOperationType.INSERT
166-
|| lastType == ObTableOperationType.PUT
167-
|| lastType == ObTableOperationType.REPLACE || lastType == ObTableOperationType.DEL))) {
166+
&& !(isSameType && (lastType == ObTableOperationType.INSERT
167+
|| lastType == ObTableOperationType.PUT
168+
|| lastType == ObTableOperationType.REPLACE || lastType == ObTableOperationType.DEL))) {
168169
throw new IllegalArgumentException(
169170
"returnOneResult only support multi-insert/put/replace/del");
170171
}

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ protected ObPayload commonExecute(ObTableClient client, Logger logger,
163163
e.getMessage(), tryTimes);
164164
if (e instanceof ObTablePartitionChangeException
165165
&& ((ObTablePartitionChangeException) e).getErrorCode() == ResultCodes.OB_ERR_KV_ROUTE_ENTRY_EXPIRE.errorCode) {
166+
System.out.println("odp partition changed.");
166167
odpNeedRenew = true;
167168
} else {
168169
throw e;

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/login/ObTableLoginRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public long getTtlUs() {
373373
public void setTtlUs(long ttlUs) {
374374
this.ttlUs = ttlUs;
375375
}
376-
376+
377377
public String getConfigsStr() {
378378
return configsStr;
379379
}

src/main/java/com/alipay/oceanbase/rpc/table/AbstractObTable.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public abstract class AbstractObTable extends AbstractTable {
4141

4242
protected int nettyBlockingWaitInterval = NETTY_BLOCKING_WAIT_INTERVAL.getDefaultInt();
4343

44-
protected long maxConnExpiredTime = MAX_CONN_EXPIRED_TIME.getDefaultLong();
44+
protected long maxConnExpiredTime = MAX_CONN_EXPIRED_TIME.getDefaultLong();
4545

4646
/*
4747
* Get ob table connect try times.
@@ -165,5 +165,7 @@ public int getNettyBlockingWaitInterval() {
165165
/*
166166
* Get connection max expired time
167167
*/
168-
public long getConnMaxExpiredTime() { return maxConnExpiredTime; }
168+
public long getConnMaxExpiredTime() {
169+
return maxConnExpiredTime;
170+
}
169171
}

src/main/java/com/alipay/oceanbase/rpc/table/AbstractObTableClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public abstract class AbstractObTableClient extends AbstractTable {
9797
.getDefaultInt();
9898
protected long slowQueryMonitorThreshold = SLOW_QUERY_MONITOR_THRESHOLD
9999
.getDefaultLong();
100-
protected Long maxConnExpiredTime = MAX_CONN_EXPIRED_TIME.getDefaultLong();
100+
protected Long maxConnExpiredTime = MAX_CONN_EXPIRED_TIME
101+
.getDefaultLong();
101102

102103
@Deprecated
103104
/*

0 commit comments

Comments
 (0)