dengzhhu653 commented on code in PR #6269:
URL: https://github.com/apache/hive/pull/6269#discussion_r2702950263
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/AbstractRequestHandler.java:
##########
@@ -107,45 +108,49 @@ public abstract class AbstractOperationHandler<T extends
TBase, A extends Abstra
protected final String id;
private long timeout;
- private AbstractOperationHandler(String id) {
+ private AbstractRequestHandler(String id) {
this.id = id;
}
- AbstractOperationHandler(IHMSHandler handler, boolean async, T request) {
- this.id = UUID.randomUUID().toString();
+ AbstractRequestHandler(IHMSHandler handler, boolean async, T request) {
+ this.id = UUID.randomUUID() + "-" + ID_GEN.incrementAndGet();
this.handler = handler;
this.request = request;
this.async = async;
this.timeout = MetastoreConf.getBoolVar(handler.getConf(), HIVE_IN_TEST) ?
10 : 5000;
- final Timer.Context timerContext;
- if (getHandlerAlias() != null) {
- Timer timer = Metrics.getOrCreateTimer(MetricsConstants.API_PREFIX +
getHandlerAlias());
- timerContext = timer != null ? timer.time() : null;
- } else {
- timerContext = null;
- }
if (async) {
- OPID_TO_HANDLER.put(id, this);
+ ID_TO_HANDLER.put(id, this);
this.executor = Executors.newFixedThreadPool(1, r -> {
Thread thread = new Thread(r);
thread.setDaemon(true);
- thread.setName("OperationHandler[" + id + "]");
+ thread.setName("RequestHandler[" + id + "]");
return thread;
});
} else {
this.executor = MoreExecutors.newDirectExecutorService();
}
+ this.future = executeRequest();
+ }
+
+ private Future<Result> executeRequest() {
+ Timer.Context timerContext;
+ if (StringUtils.isNotEmpty(getMetricAlias())) {
+ Timer timer = Metrics.getOrCreateTimer(MetricsConstants.API_PREFIX +
getMetricAlias());
Review Comment:
it just a simple call, no reflection here
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/AbstractRequestHandler.java:
##########
@@ -107,45 +108,49 @@ public abstract class AbstractOperationHandler<T extends
TBase, A extends Abstra
protected final String id;
private long timeout;
- private AbstractOperationHandler(String id) {
+ private AbstractRequestHandler(String id) {
this.id = id;
}
- AbstractOperationHandler(IHMSHandler handler, boolean async, T request) {
- this.id = UUID.randomUUID().toString();
+ AbstractRequestHandler(IHMSHandler handler, boolean async, T request) {
+ this.id = UUID.randomUUID() + "-" + ID_GEN.incrementAndGet();
this.handler = handler;
this.request = request;
this.async = async;
this.timeout = MetastoreConf.getBoolVar(handler.getConf(), HIVE_IN_TEST) ?
10 : 5000;
- final Timer.Context timerContext;
- if (getHandlerAlias() != null) {
- Timer timer = Metrics.getOrCreateTimer(MetricsConstants.API_PREFIX +
getHandlerAlias());
- timerContext = timer != null ? timer.time() : null;
- } else {
- timerContext = null;
- }
if (async) {
- OPID_TO_HANDLER.put(id, this);
+ ID_TO_HANDLER.put(id, this);
this.executor = Executors.newFixedThreadPool(1, r -> {
Thread thread = new Thread(r);
thread.setDaemon(true);
- thread.setName("OperationHandler[" + id + "]");
+ thread.setName("RequestHandler[" + id + "]");
return thread;
});
} else {
this.executor = MoreExecutors.newDirectExecutorService();
}
+ this.future = executeRequest();
+ }
+
+ private Future<Result> executeRequest() {
+ Timer.Context timerContext;
+ if (StringUtils.isNotEmpty(getMetricAlias())) {
+ Timer timer = Metrics.getOrCreateTimer(MetricsConstants.API_PREFIX +
getMetricAlias());
Review Comment:
it's just a simple call, no reflection here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]