This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-access.git


The following commit(s) were added to refs/heads/main by this push:
     new d0b4423  moves thread local access outside of loop (#61)
d0b4423 is described below

commit d0b4423087faf78dd0e96e3042bbc12fa87d6f42
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Thu Feb 15 11:06:14 2024 -0500

    moves thread local access outside of loop (#61)
    
    A thread local was being accessed multiple times in a loop.  The result
    should be the same each time, so the access was moved out of the loop to
    avoid any cost related to accessing a thread local.
---
 src/main/java/org/apache/accumulo/access/AccessEvaluatorImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/accumulo/access/AccessEvaluatorImpl.java 
b/src/main/java/org/apache/accumulo/access/AccessEvaluatorImpl.java
index 66adb96..a73f627 100644
--- a/src/main/java/org/apache/accumulo/access/AccessEvaluatorImpl.java
+++ b/src/main/java/org/apache/accumulo/access/AccessEvaluatorImpl.java
@@ -196,9 +196,9 @@ final class AccessEvaluatorImpl implements AccessEvaluator {
 
   boolean evaluate(byte[] accessExpression) throws 
IllegalAccessExpressionException {
     var bytesWrapper = lookupWrappers.get();
+    var tokenizer = tokenizers.get();
 
     for (var auths : authorizedPredicates) {
-      var tokenizer = tokenizers.get();
       tokenizer.reset(accessExpression);
       Predicate<Tokenizer.AuthorizationToken> atp = authToken -> {
         bytesWrapper.set(authToken.data, authToken.start, authToken.len);

Reply via email to