[GitHub] [storm] Ethanlm commented on a change in pull request #3295: STORM-3660: Remove use of queues for updating credentials
Ethanlm commented on a change in pull request #3295: URL: https://github.com/apache/storm/pull/3295#discussion_r452389342 ## File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java ## @@ -124,6 +126,7 @@ protected int idToTaskBase; protected String hostname; private static final double msDurationFactor = 1.0 / TimeUnit.MILLISECONDS.toNanos(1); +private boolean needToRefreshCreds = true; Review comment: If only simple `get()` and `set()` methods are used in `AtomicBoolean`, it is basically the same as using `volatile boolean` unless methods like `compareAndSet` and `getAndSet` are required. https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/master/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java#L85-L87 (although the implementation uses `volatile int`) But anyway, using `AtomicBoolean` is easier to understand. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [storm] Ethanlm commented on a change in pull request #3295: STORM-3660: Remove use of queues for updating credentials
Ethanlm commented on a change in pull request #3295: URL: https://github.com/apache/storm/pull/3295#discussion_r452390529 ## File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java ## @@ -124,6 +126,7 @@ protected int idToTaskBase; protected String hostname; private static final double msDurationFactor = 1.0 / TimeUnit.MILLISECONDS.toNanos(1); +private AtomicBoolean needToRefreshCreds = new AtomicBoolean(true); Review comment: The initial value should be `false` to avoid unnecessary update at the beginning. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [storm] Ethanlm commented on a change in pull request #3295: STORM-3660: Remove use of queues for updating credentials
Ethanlm commented on a change in pull request #3295: URL: https://github.com/apache/storm/pull/3295#discussion_r452389342 ## File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java ## @@ -124,6 +126,7 @@ protected int idToTaskBase; protected String hostname; private static final double msDurationFactor = 1.0 / TimeUnit.MILLISECONDS.toNanos(1); +private boolean needToRefreshCreds = true; Review comment: If only simple `get()` and `set()` methods are used in `AtomicBoolean`, it is basically the same as using `volatile boolean`. https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/master/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java#L85-L87 (although the implementation uses `volatile int`) unless methods like `compareAndSet` and `getAndSet` are required. But anyway, using `AtomicBoolean` is easier to understand. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [storm] Ethanlm commented on a change in pull request #3295: STORM-3660: Remove use of queues for updating credentials
Ethanlm commented on a change in pull request #3295: URL: https://github.com/apache/storm/pull/3295#discussion_r452389342 ## File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java ## @@ -124,6 +126,7 @@ protected int idToTaskBase; protected String hostname; private static final double msDurationFactor = 1.0 / TimeUnit.MILLISECONDS.toNanos(1); +private boolean needToRefreshCreds = true; Review comment: If only simple `get()` and `set()` methods are used in `AtomicBoolean`, it is basically the same as using `violate boolean`. https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/master/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java#L85-L87 unless methods like `compareAndSet` and `getAndSet` are required. But anyway, using `AtomicBoolean` is easier to understand. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [storm] Ethanlm commented on a change in pull request #3295: STORM-3660: Remove use of queues for updating credentials
Ethanlm commented on a change in pull request #3295: URL: https://github.com/apache/storm/pull/3295#discussion_r448434269 ## File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java ## @@ -291,6 +294,22 @@ public void accept(Object event) { } } +public void setNeedToRefreshCreds() { +this.needToRefreshCreds = true; +} + +protected void updateExecCredsIfRequired() { +if (this.needToRefreshCreds) { +this.needToRefreshCreds = false; +LOG.info("The credentials are being updated {}.", executorId); Review comment: Maybe we should change it to be `DEBUG` since this is on a critical path (even though this `method` might not be called very frequently) ## File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java ## @@ -124,6 +126,7 @@ protected int idToTaskBase; protected String hostname; private static final double msDurationFactor = 1.0 / TimeUnit.MILLISECONDS.toNanos(1); +private boolean needToRefreshCreds = true; Review comment: This needs to be `volatile ` to make sure the changes from other threads can be seen immediately 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org