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

Alexander Kolbasov commented on SENTRY-296:
-------------------------------------------

I looked at this implementation and I don't understand how it can work.

The usual pattern for clients is:

1) Create a new connection using SentryPolicyServiceClient.create()
2) Issue a single call (or may be a few calls)
3) Close the client.

The create() method above creates a new instance of the 
PoolClientInvocationHandler:

{code}
  public static SentryPolicyServiceClient create(Configuration conf) throws 
Exception {
    boolean haEnabled = conf.getBoolean(ClientConfig.SERVER_HA_ENABLED, false);
    boolean pooled = conf.getBoolean(ClientConfig.SENTRY_POOL_ENABLED, false);
    if (pooled) {
      return (SentryPolicyServiceClient) Proxy
          
.newProxyInstance(SentryPolicyServiceClientDefaultImpl.class.getClassLoader(),
              SentryPolicyServiceClientDefaultImpl.class.getInterfaces(),
              new PoolClientInvocationHandler(conf));  // new instance
{code}

This creates a new pool for each connection which doesn't make any sense - the 
whole purpose is to have a pool of connections shared *between* calls.
Can someone clarify how this was supposed to work?

> Sentry Service Client does not allow for connection pooling
> -----------------------------------------------------------
>
>                 Key: SENTRY-296
>                 URL: https://issues.apache.org/jira/browse/SENTRY-296
>             Project: Sentry
>          Issue Type: Bug
>    Affects Versions: 1.4.0
>            Reporter: Lenni Kuff
>            Assignee: Colin Ma
>              Labels: grant/revoke
>             Fix For: 1.6.0
>
>         Attachments: SENTRY-296.001.patch, SENTRY-296.002.patch, 
> SENTRY-296.003.patch, SENTRY-296.004.patch, SENTRY-296.005.patch, 
> SENTRY-296.006.patch, SENTRY-296.007.patch, SENTRY-296.008.patch, 
> SENTRY-296.009.patch, SENTRY-296.010.patch, SENTRY-296.011.patch, 
> SENTRY-296.012.patch
>
>
> The Sentry Service Client does not allow for connection pooling because there 
> is no way to:
> 1) Detect that a connection is broken
> 2) Re-open a broken connection
> This would allow for Sentry Service clients to implement connection pooling 
> like:
> {code}
> if (!client.isOpen()) {
>   client.reopen();
> }
> {code}
> Currently, the only way to ensure connections are not broken is to open a new 
> connection before every RPC.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to