修复EntityCache
This commit is contained in:
@@ -123,7 +123,7 @@ public abstract class ClientCodec<R extends ClientRequest, P> implements Complet
|
||||
connection.preComplete(message, (R) request, exc);
|
||||
|
||||
if (exc != null) {
|
||||
if (workThread.inIO()) {
|
||||
if (workThread.inIO() && workThread.getState() == Thread.State.RUNNABLE) {
|
||||
workThread.execute(() -> {
|
||||
Traces.currTraceid(request.traceid);
|
||||
respFuture.completeExceptionally(exc);
|
||||
@@ -136,7 +136,7 @@ public abstract class ClientCodec<R extends ClientRequest, P> implements Complet
|
||||
}
|
||||
} else {
|
||||
final Object rs = request.respTransfer == null ? message : request.respTransfer.apply(message);
|
||||
if (workThread.inIO()) {
|
||||
if (workThread.inIO() && workThread.getState() == Thread.State.RUNNABLE) {
|
||||
workThread.execute(() -> {
|
||||
Traces.currTraceid(request.traceid);
|
||||
((ClientFuture) respFuture).complete(rs);
|
||||
@@ -149,7 +149,7 @@ public abstract class ClientCodec<R extends ClientRequest, P> implements Complet
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
if (workThread.inIO()) {
|
||||
if (workThread.inIO() && workThread.getState() == Thread.State.RUNNABLE) {
|
||||
workThread.execute(() -> {
|
||||
Traces.currTraceid(request.traceid);
|
||||
respFuture.completeExceptionally(t);
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class ClientConnection<R extends ClientRequest, P> implements Co
|
||||
respFuture.setTimeout(client.timeoutScheduler.schedule(respFuture, rts, TimeUnit.SECONDS));
|
||||
}
|
||||
respWaitingCounter.increment(); //放在writeChannelInWriteThread计数会延迟,导致不准确
|
||||
if (channel.inCurrWriteThread()) {
|
||||
if (true || channel.inCurrWriteThread()) { //临时屏蔽
|
||||
writeChannelInThread(request, respFuture);
|
||||
} else {
|
||||
channel.executeWrite(() -> writeChannelInThread(request, respFuture));
|
||||
|
||||
@@ -131,12 +131,7 @@ public final class EntityCache<T> {
|
||||
public void fullLoad() {
|
||||
CompletableFuture<List<T>> future = fullLoadAsync();
|
||||
if (future != null) {
|
||||
//future.join();
|
||||
try {
|
||||
future.get(1, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
future.join();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user