[
https://issues.apache.org/jira/browse/TAJO-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519387#comment-14519387
]
ASF GitHub Bot commented on TAJO-1583:
--------------------------------------
Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/556#discussion_r29338237
--- Diff:
tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
---
@@ -64,32 +69,44 @@ public AbstractCatalogClient(TajoConf conf,
InetSocketAddress catalogServerAddr)
}
private InetSocketAddress getCatalogServerAddr() {
- if (catalogServerAddr == null) {
- return null;
+ if (!conf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) {
+ return catalogServerAddr;
} else {
+ return serviceTracker.getCatalogAddress();
+ }
+ }
- if (!conf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) {
- return catalogServerAddr;
- } else {
- return serviceTracker.getCatalogAddress();
+ public synchronized NettyClientBase getCatalogConnection() throws
ServiceException {
+ if (client == null || !client.isConnected()) {
+ try {
+ RpcClientManager.cleanup(client);
+
+ int retry = conf.getInt(RpcConstants.RPC_CLIENT_RETRY_MAX,
RpcConstants.DEFAULT_RPC_RETRIES);
+ int timeout = conf.getInt(RpcConstants.RPC_CLIENT_TIMEOUT_SECS, 0);
+ this.client = manager.newClient(getCatalogServerAddr(),
CatalogProtocol.class, false, retry, timeout,
+ TimeUnit.SECONDS, false);
+ } catch (Exception e) {
+ throw new ServiceException(e);
}
}
+ return client;
+ }
+
+ @Override
+ public void close() {
+ RpcClientManager.cleanup(client);
}
@Override
public final Boolean createTablespace(final String tablespaceName, final
String tablespaceUri) {
try {
- return new ServerCallable<Boolean>(manager, getCatalogServerAddr(),
CatalogProtocol.class, false) {
- public Boolean call(NettyClientBase client) throws
ServiceException {
- CatalogProtocolService.BlockingInterface stub = getStub(client);
+ CatalogProtocolService.BlockingInterface stub = getStub();
- CreateTablespaceRequest.Builder builder =
CreateTablespaceRequest.newBuilder();
- builder.setTablespaceName(tablespaceName);
- builder.setTablespaceUri(tablespaceUri);
- return stub.createTablespace(null, builder.build()).getValue();
- }
- }.withRetries();
- } catch (ServiceException e) {
+ CreateTablespaceRequest.Builder builder =
CreateTablespaceRequest.newBuilder();
+ builder.setTablespaceName(tablespaceName);
+ builder.setTablespaceUri(tablespaceUri);
+ return stub.createTablespace(null, builder.build()).getValue();
+ } catch (Exception e) {
--- End diff --
Exception seems too broad. How about catching ServiceException?
> Remove ServerCallable in RPC client
> -----------------------------------
>
> Key: TAJO-1583
> URL: https://issues.apache.org/jira/browse/TAJO-1583
> Project: Tajo
> Issue Type: Task
> Components: client
> Reporter: Jinho Kim
> Assignee: Jinho Kim
> Priority: Minor
> Attachments: TAJO-1583.patch
>
>
> TAJO-1563 contains retry during invocation internally.
> We should remove it for more clearly. because it invoke repeatedly without
> reference to an application error
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)