[fix](Nereids) event channel dead loop until queue is not empty (#14816)
This commit is contained in:
@ -71,10 +71,7 @@ public class EventChannel {
|
||||
public void run() {
|
||||
while (!isStop.get() || !queue.isEmpty()) {
|
||||
try {
|
||||
Event e = queue.poll();
|
||||
if (e == null) {
|
||||
continue;
|
||||
}
|
||||
Event e = queue.take();
|
||||
for (EventConsumer consumer : consumers.get(e.getClass())) {
|
||||
if (enhancers.containsKey(e.getClass())) {
|
||||
enhancers.get(e.getClass()).enhance(e);
|
||||
@ -115,14 +112,5 @@ public class EventChannel {
|
||||
*/
|
||||
public void stop() {
|
||||
isStop.set(true);
|
||||
if (thread != null) {
|
||||
try {
|
||||
thread.join();
|
||||
} catch (InterruptedException e) {
|
||||
LOG.warn("join worker failed.", e);
|
||||
} finally {
|
||||
thread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class VariableMgr {
|
||||
if (!attr.checker().equals("")) {
|
||||
Preconditions.checkArgument(obj instanceof SessionVariable);
|
||||
try {
|
||||
SessionVariable.class.getDeclaredMethod(attr.checker()).invoke(obj);
|
||||
SessionVariable.class.getDeclaredMethod(attr.checker(), String.class).invoke(obj, value);
|
||||
} catch (Exception e) {
|
||||
ErrorReport.reportDdlException(ErrorCode.ERR_INVALID_VALUE, attr.name(), value, e.getMessage());
|
||||
}
|
||||
@ -527,6 +527,7 @@ public class VariableMgr {
|
||||
|
||||
// the function name that check the VarAttr before setting it to sessionVariable
|
||||
// only support check function: 0 argument and 0 return value, if an error occurs, throw an exception.
|
||||
// the checker function should be: public void checker(String value), value is the input string.
|
||||
String checker() default "";
|
||||
|
||||
// Set to true if the variables need to be forwarded along with forward statement.
|
||||
|
||||
Reference in New Issue
Block a user