wuchaococo opened a new issue, #2087:
URL: https://github.com/apache/fury/issues/2087

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fury/issues) 
and found no similar issues.
   
   
   ### Version
   
   V 0.7
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   构建了一个线程并发的的fury
   ThreadSafeFury fury = 
Fury.builder().withLanguage(Language.JAVA).requireClassRegistration(false)
                                
.withJdkClassSerializableCheck(false).withRefTracking(false)
                                
.withCompatibleMode(CompatibleMode.COMPATIBLE).withAsyncCompilation(true).withRefTracking(true)
                                .buildThreadSafeFuryPool(10, 1000);
   @Override
     public <R> R execute(Function<Fury, R> action) {
       ClassLoaderFuryPooled pooledCache = null;
       Fury fury = null;
       try {
         pooledCache = furyPooledObjectFactory.getPooledCache();
         fury = **pooledCache.getFury();**
         return action.apply(fury);
       } catch (Exception e) {
         LOG.error(e.getMessage(), e);
         throw new RuntimeException(e);
       } finally {
         if (pooledCache != null) {
           pooledCache.returnFury(fury);
         }
       }
     }
   
   
   ### What did you expect to see?
   
   多线程并发下的性能如何操作
   
   ### What did you see instead?
   
   --多线程请求并发的场景下 这里锁的时间很长,
   public Fury getFury() {
       try {
         **lock.lock();**
         Fury fury = idleCacheQueue.poll();
         while (fury == null) {
           if (activeCacheNumber.get() < maxPoolSize) {
             addFury();
           } else {
             furyCondition.await();
           }
           fury = idleCacheQueue.poll();
         }
         activeCacheNumber.incrementAndGet();
         return fury;
       } catch (Exception e) {
         LOG.error(e.getMessage(), e);
         throw new RuntimeException(e);
       } finally {
         lock.unlock();
       }
     }
   
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to