We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V 0.7
Java
构建了一个线程并发的的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 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); } } }
多线程并发下的性能如何操作
--多线程请求并发的场景下 这里锁的时间很长, 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(); } }
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Search before asking
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 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?
The text was updated successfully, but these errors were encountered: