[
https://issues.apache.org/jira/browse/TAJO-1016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135428#comment-14135428
]
ASF GitHub Bot commented on TAJO-1016:
--------------------------------------
Github user hyunsik commented on a diff in the pull request:
https://github.com/apache/tajo/pull/125#discussion_r17600629
--- Diff:
tajo-core/src/main/java/org/apache/tajo/master/cluster/WorkerConnectionInfo.java
---
@@ -0,0 +1,178 @@
+/**
+ * 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.tajo.master.cluster;
+
+import org.apache.tajo.common.ProtoObject;
+
+import static org.apache.tajo.TajoProtos.WorkerConnectionInfoProto;
+
+public class WorkerConnectionInfo implements
ProtoObject<WorkerConnectionInfoProto>, Comparable<WorkerConnectionInfo> {
+ private WorkerConnectionInfoProto.Builder builder;
+ /**
+ * unique worker id
+ */
+ private int id;
+ /**
+ * Hostname
+ */
+ private String host;
+ /**
+ * Peer rpc port
+ */
+ private int peerRpcPort;
+ /**
+ * pull server port
+ */
+ private int pullServerPort;
+ /**
+ * QueryMaster rpc port
+ */
+ private int queryMasterPort;
+ /**
+ * the port of client rpc which provides an client API
+ */
+ private int clientPort;
+ /**
+ * http info port
+ */
+ private int httpInfoPort;
+
+ public WorkerConnectionInfo() {
+ builder = WorkerConnectionInfoProto.newBuilder();
+ }
+
+ public WorkerConnectionInfo(WorkerConnectionInfoProto proto) {
+ this();
+ this.id = proto.getId();
+ this.host = proto.getHost();
+ this.peerRpcPort = proto.getPeerRpcPort();
+ this.pullServerPort = proto.getPullServerPort();
+ this.clientPort = proto.getClientPort();
+ this.httpInfoPort = proto.getHttpInfoPort();
+ this.queryMasterPort = proto.getQueryMasterPort();
+ }
+
+ public WorkerConnectionInfo(String host, int peerRpcPort, int
pullServerPort, int clientPort,
+ int queryMasterPort, int httpInfoPort) {
+ this();
+ this.host = host;
+ this.peerRpcPort = peerRpcPort;
+ this.pullServerPort = pullServerPort;
+ this.clientPort = clientPort;
+ this.queryMasterPort = queryMasterPort;
+ this.httpInfoPort = httpInfoPort;
+ this.id = hashCode();
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public int getPeerRpcPort() {
+ return peerRpcPort;
+ }
+
+ public int getPullServerPort() {
+ return pullServerPort;
+ }
+
+ public int getQueryMasterPort() {
+ return queryMasterPort;
+ }
+
+ public int getClientPort() {
+ return clientPort;
+ }
+
+ public int getHttpInfoPort() {
+ return httpInfoPort;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getHostAndPeerRpcPort() {
+ return this.getHost() + ":" + this.getPeerRpcPort();
+ }
+
+ @Override
+ public WorkerConnectionInfoProto getProto() {
+ builder.setId(id)
--- End diff --
It reuses builder. Recently, we've experienced race condition of builder
object. Is there no possibility of concurrency problem?
> Refactor worker rpc information
> -------------------------------
>
> Key: TAJO-1016
> URL: https://issues.apache.org/jira/browse/TAJO-1016
> Project: Tajo
> Issue Type: Sub-task
> Components: rpc
> Reporter: Jinho Kim
>
> Currently, tajo has many rpc port in worker. It is difficult to use. we need
> to refactor code.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)