[
https://issues.apache.org/jira/browse/STORM-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174287#comment-15174287
]
ASF GitHub Bot commented on STORM-1270:
---------------------------------------
Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/1156#discussion_r54622613
--- Diff: storm-core/src/jvm/org/apache/storm/daemon/DrpcServer.java ---
@@ -0,0 +1,383 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.storm.daemon;
+
+import com.codahale.metrics.Meter;
+import com.codahale.metrics.MetricRegistry;
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang.StringUtils;
+import org.apache.storm.Config;
+import org.apache.storm.daemon.metrics.MetricsUtils;
+import org.apache.storm.daemon.metrics.reporters.PreparableReporter;
+import org.apache.storm.generated.*;
+import org.apache.storm.logging.ThriftAccessLogger;
+import org.apache.storm.security.auth.*;
+import org.apache.storm.security.auth.authorizer.DRPCAuthorizerBase;
+import org.apache.storm.ui.FilterConfiguration;
+import org.apache.storm.ui.IConfigurator;
+import org.apache.storm.ui.UIHelpers;
+import org.apache.storm.utils.Time;
+import org.apache.storm.utils.Utils;
+import org.apache.storm.utils.VersionInfo;
+import org.apache.thrift.TException;
+import org.eclipse.jetty.server.Server;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.Servlet;
+import java.security.Principal;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+public class DrpcServer implements DistributedRPC.Iface,
DistributedRPCInvocations.Iface, AutoCloseable {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(DrpcServer.class);
+ private final Long timeoutCheckSecs = 5L;
+
+ private Map conf;
+
+ private ThriftServer handlerServer;
+ private ThriftServer invokeServer;
+ private IHttpCredentialsPlugin httpCredsHandler;
+
+ private Thread clearThread;
+
+ private IAuthorizer authorizer;
+
+ //TODO: To be removed after porting drpc.clj
+ private Servlet httpServlet;
+
+ private AtomicInteger ctr = new AtomicInteger(0);
+ private ConcurrentHashMap<String, ConcurrentLinkedQueue<DRPCRequest>>
requestQueues = new ConcurrentHashMap<String,
ConcurrentLinkedQueue<DRPCRequest>>();
+
+ private static class InternalRequest {
+ public final Semaphore sem;
+ public final int startTimeSecs;
+ public final String function;
+ public final DRPCRequest request;
+ public volatile Object result;
+
+ public InternalRequest(String function, DRPCRequest request) {
+ sem = new Semaphore(0);
+ startTimeSecs = Time.currentTimeSecs();
+ this.function = function;
+ this.request = request;
+ }
+ }
+ private ConcurrentHashMap<String, InternalRequest> outstandingRequests
= new ConcurrentHashMap<>();
+
+
+ //TODO: to be replaced by a common registry
+ private final static Meter meterHttpRequests = new
MetricRegistry().meter("drpc:num-execute-http-requests");
+ private final static Meter meterExecuteCalls = new
MetricRegistry().meter("drpc:num-execute-calls");
+ private final static Meter meterResultCalls = new
MetricRegistry().meter("drpc:num-result-calls");
+ private final static Meter meterFailRequestCalls = new
MetricRegistry().meter("drpc:num-failRequest-calls");
+ private final static Meter meterFetchRequestCalls = new
MetricRegistry().meter("drpc:num-fetchRequest-calls");
+ private final static Meter meterShutdownCalls = new
MetricRegistry().meter("drpc:num-shutdown-calls");
+
+ public DrpcServer() {
+
+ }
+
+ //TODO: to be removed
--- End diff --
Please remove this comment.
> port backtype.storm.daemon.drpc to java
> ---------------------------------------
>
> Key: STORM-1270
> URL: https://issues.apache.org/jira/browse/STORM-1270
> Project: Apache Storm
> Issue Type: New Feature
> Components: storm-core
> Reporter: Robert Joseph Evans
> Assignee: John Fang
> Labels: java-migration, jstorm-merger
>
> DRPC server with HTTP and thrift support
> https://github.com/apache/storm/blob/jstorm-import/jstorm-core/src/main/java/com/alibaba/jstorm/drpc/Drpc.java
> (But missing HTTP support)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)