[ 
https://issues.apache.org/jira/browse/HIVE-12556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15034755#comment-15034755
 ] 

Thejas M Nair commented on HIVE-12556:
--------------------------------------

To make it easier to create SyncDagClient, you can use the pattern followed for 
synchronized metastoreclient - 

{code:java}
/**
   * Creates a synchronized wrapper for any {@link IMetaStoreClient}.
   * This may be used by multi-threaded applications until we have
   * fixed all reentrancy bugs.
   *
   * @param client unsynchronized client
   *
   * @return synchronized client
   */
  public static IMetaStoreClient newSynchronizedClient(
      IMetaStoreClient client) {
    return (IMetaStoreClient) Proxy.newProxyInstance(
      HiveMetaStoreClient.class.getClassLoader(),
      new Class [] { IMetaStoreClient.class },
      new SynchronizedHandler(client));
  }

  private static class SynchronizedHandler implements InvocationHandler {
    private final IMetaStoreClient client;

    SynchronizedHandler(IMetaStoreClient client) {
      this.client = client;
    }

    @Override
    public synchronized Object invoke(Object proxy, Method method, Object [] 
args)
        throws Throwable {
      try {
        return method.invoke(client, args);
      } catch (InvocationTargetException e) {
        throw e.getTargetException();
      }
    }
  }
{code}

> Ctrl-C in beeline doesn't kill Tez query on HS2
> -----------------------------------------------
>
>                 Key: HIVE-12556
>                 URL: https://issues.apache.org/jira/browse/HIVE-12556
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Sergey Shelukhin
>            Assignee: Sergey Shelukhin
>         Attachments: HIVE-12556.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to