Github user lavjain commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1379#discussion_r202118803
  
    --- Diff: 
pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/UGICache.java ---
    @@ -61,48 +64,51 @@
          * create and destroy UserGroupInformation instances.
          */
         public UGICache() {
    -        this(new UGIProvider());
    +        this(new UGIProvider(), Ticker.systemTicker());
         }
     
         /**
          * Create new proxy UGI if not found in cache and increment reference 
count
          */
    -    public Entry getTimedProxyUGI(SessionId session)
    -            throws IOException {
    -
    +    public UserGroupInformation getUserGroupInformation(SessionId session) 
throws IOException {
             Integer segmentId = session.getSegmentId();
             String user = session.getUser();
             DelayQueue<Entry> delayQueue = getExpirationQueue(segmentId);
             synchronized (delayQueue) {
                 // Use the opportunity to cleanup any expired entries
    -            cleanup(segmentId);
    +            cleanup(session);
                 Entry entry = cache.get(session);
                 if (entry == null) {
                     LOG.info(session.toString() + " Creating proxy user = " + 
user);
    -                entry = new Entry(ugiProvider.createProxyUGI(user), 
session);
    +                entry = new Entry(ticker, 
ugiProvider.createProxyUGI(user));
                     delayQueue.offer(entry);
                     cache.put(session, entry);
                 }
                 entry.acquireReference();
    -            return entry;
    +            return entry.getUGI();
             }
         }
     
         /**
    -     * Decrement reference count for the given Entry.
    +     * Decrement reference count for the given session's UGI. Resets the 
time at which the UGI will
    +     * expire to 15 minutes in the future.
          *
    -     * @param timedProxyUGI the cache entry to release
    -     * @param forceClean if true, destroys the UGI for the given Entry 
(only if it is now unreferenced).
    +     * @param session                  the session for which we want to 
release the UGI.
    +     * @param cleanImmediatelyIfNoRefs if true, destroys the UGI for the 
given session (only if it is
    +     *                                 now unreferenced).
          */
    -    public void release(Entry timedProxyUGI, boolean forceClean) {
    +    public void release(SessionId session, boolean 
cleanImmediatelyIfNoRefs) {
    +
    +        Entry timedProxyUGI = cache.get(session);
    +
    +        if (timedProxyUGI == null) return;
    --- End diff --
    
    Is there a case where the above condition would hold true?


---

Reply via email to