mirror of https://github.com/grpc/grpc-java.git
core: Apply ManagedChannelImpl's updateBalancingState() immediately
ffcc360ba
adjusted updateBalancingState() to require being run within
the sync context. However, it still queued the work into the sync
context, which was unnecessary. This re-entering the sync context
unnecessarily delays the new state from being used.
This commit is contained in:
parent
a6a041e415
commit
ca4819ac6d
|
@ -1388,24 +1388,18 @@ final class ManagedChannelImpl extends ManagedChannel implements
|
|||
syncContext.throwIfNotInThisSynchronizationContext();
|
||||
checkNotNull(newState, "newState");
|
||||
checkNotNull(newPicker, "newPicker");
|
||||
final class UpdateBalancingState implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (LbHelperImpl.this != lbHelper || panicMode) {
|
||||
return;
|
||||
}
|
||||
updateSubchannelPicker(newPicker);
|
||||
// It's not appropriate to report SHUTDOWN state from lb.
|
||||
// Ignore the case of newState == SHUTDOWN for now.
|
||||
if (newState != SHUTDOWN) {
|
||||
channelLogger.log(
|
||||
ChannelLogLevel.INFO, "Entering {0} state with picker: {1}", newState, newPicker);
|
||||
channelStateManager.gotoState(newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncContext.execute(new UpdateBalancingState());
|
||||
if (LbHelperImpl.this != lbHelper || panicMode) {
|
||||
return;
|
||||
}
|
||||
updateSubchannelPicker(newPicker);
|
||||
// It's not appropriate to report SHUTDOWN state from lb.
|
||||
// Ignore the case of newState == SHUTDOWN for now.
|
||||
if (newState != SHUTDOWN) {
|
||||
channelLogger.log(
|
||||
ChannelLogLevel.INFO, "Entering {0} state with picker: {1}", newState, newPicker);
|
||||
channelStateManager.gotoState(newState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue