adoroszlai commented on code in PR #5791:
URL: https://github.com/apache/ozone/pull/5791#discussion_r1475533377
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -2480,26 +2488,45 @@ public void setTimes(OzoneObj obj, String keyName, long
mtime, long atime)
ozoneManagerClient.setTimes(builder.build(), mtime, atime);
}
+ private ExecutorService createThreadPoolExecutor(
+ int corePoolSize, int maximumPoolSize, String threadNameFormat) {
+ return new ThreadPoolExecutor(corePoolSize, maximumPoolSize,
+ 60, TimeUnit.SECONDS, new SynchronousQueue<>(),
+ new ThreadFactoryBuilder()
+ .setNameFormat(threadNameFormat)
+ .build(),
+ new ThreadPoolExecutor.CallerRunsPolicy());
+ }
+
public ExecutorService getECReconstructExecutor() {
- // local ref to a volatile to ensure access
- // to a completed initialized object
- ExecutorService executor = ecReconstructExecutor;
- if (executor == null) {
+ ExecutorService localRef = ecReconstructExecutor;
+ if (localRef == null) {
synchronized (this) {
- executor = ecReconstructExecutor;
- if (executor == null) {
- ecReconstructExecutor = new ThreadPoolExecutor(
- EC_RECONSTRUCT_STRIPE_READ_POOL_MIN_SIZE,
+ localRef = ecReconstructExecutor;
+ if (localRef == null) {
+ localRef =
createThreadPoolExecutor(EC_RECONSTRUCT_STRIPE_READ_POOL_MIN_SIZE,
clientConfig.getEcReconstructStripeReadPoolLimit(),
- 60, TimeUnit.SECONDS, new SynchronousQueue<>(),
- new ThreadFactoryBuilder()
- .setNameFormat("ec-reconstruct-reader-TID-%d")
- .build(),
- new ThreadPoolExecutor.CallerRunsPolicy());
- executor = ecReconstructExecutor;
+ "ec-reconstruct-reader-TID-%d");
+ ecReconstructExecutor = localRef;
+ }
+ }
+ }
+ return localRef;
+ }
+
+ public ExecutorService getECWriteThreadPool() {
+ ExecutorService localRef = ecWriteExecutor;
+ if (localRef == null) {
+ synchronized (this) {
+ localRef = ecWriteExecutor;
+ if (localRef == null) {
+ localRef = createThreadPoolExecutor(EC_WRITE_POOL_MIN_SIZE,
+ clientConfig.getEcClientWritePoolLimit(),
Review Comment:
I was thinking it's the client's decision to start few or many parallel
writes. With the new config, the responsibility is still at the client-side,
but now it needs to be configured explicitly.
I don't know if the config helps in practice or not.
--
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]