tajo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoonson <...@git.apache.org>
Subject [GitHub] tajo pull request: TAJO-1670: Refactor client errors and exception...
Date Mon, 20 Jul 2015 00:31:37 GMT
Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/621#discussion_r34964536
  
    --- Diff: tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java ---
    @@ -98,33 +106,49 @@ public SessionConnection(@NotNull ServiceTracker tracker, @Nullable
String baseD
         this.manager.setRetries(properties.getInt(RpcConstants.RPC_CLIENT_RETRY_MAX, RpcConstants.DEFAULT_RPC_RETRIES));
         this.userInfo = UserRoleInfo.getCurrentUser();
     
    -    try {
    -      this.client = getTajoMasterConnection();
    -    } catch (ServiceException e) {
    -      throw new IOException(e);
    -    }
    +    this.client = getTajoMasterConnection();
       }
     
       public Map<String, String> getClientSideSessionVars() {
         return Collections.unmodifiableMap(sessionVarsCache);
       }
     
    -  public synchronized NettyClientBase getTajoMasterConnection() throws ServiceException
{
    -    if (client != null && client.isConnected()) return client;
    -    else {
    +  public synchronized NettyClientBase getTajoMasterConnection() throws SQLException {
    +
    +    if (client != null && client.isConnected()) {
    +      return client;
    +    } else {
    +
           try {
             RpcClientManager.cleanup(client);
    +
             // Client do not closed on idle state for support high available
    -        this.client = manager.newClient(getTajoMasterAddr(), TajoMasterClientProtocol.class,
false,
    -            manager.getRetries(), 0, TimeUnit.SECONDS, false);
    +        this.client = manager.newClient(
    +            getTajoMasterAddr(),
    +            TajoMasterClientProtocol.class,
    +            false,
    +            manager.getRetries(),
    +            0,
    +            TimeUnit.SECONDS,
    +            false);
             connections.incrementAndGet();
    -      } catch (Exception e) {
    -        throw new ServiceException(e);
    +
    +      } catch (Throwable t) {
    +        throw SQLExceptionUtil.makeUnableToEstablishConnection(t);
           }
    +
           return client;
         }
       }
     
    +  protected BlockingInterface getTMStub() throws SQLException {
    --- End diff --
    
    Ok. If so, please add a brief comment. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message