dan-s1 commented on code in PR #9305:
URL: https://github.com/apache/nifi/pull/9305#discussion_r1772056032


##########
nifi-nar-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java:
##########
@@ -68,35 +70,34 @@ public abstract class AbstractIcebergProcessor extends 
AbstractProcessor impleme
             .description("A FlowFile is routed to this relationship if the 
operation failed and retrying the operation will also fail, such as an invalid 
data or schema.")
             .build();
 
-    protected final AtomicReference<KerberosUser> kerberosUserReference = new 
AtomicReference<>();
+    protected static final AtomicReference<KerberosUser> kerberosUserReference 
= new AtomicReference<>();
     protected final AtomicReference<UserGroupInformation> ugiReference = new 
AtomicReference<>();
 
     @OnScheduled
     public void onScheduled(final ProcessContext context) {
         initKerberosCredentials(context);
     }
 
-    protected void initKerberosCredentials(ProcessContext context) {
+    protected synchronized void initKerberosCredentials(ProcessContext 
context) {
         final KerberosUserService kerberosUserService = 
context.getProperty(KERBEROS_USER_SERVICE).asControllerService(KerberosUserService.class);
         final IcebergCatalogService catalogService = 
context.getProperty(CATALOG).asControllerService(IcebergCatalogService.class);
 
         if (kerberosUserService != null) {
-            final KerberosUser kerberosUser = 
kerberosUserService.createKerberosUser();
-            kerberosUserReference.set(kerberosUser);
+            KerberosUser kerberosUser;
+            if (kerberosUserReference.get() == null) {
+                kerberosUser = kerberosUserService.createKerberosUser();
+            } else {
+                kerberosUser = kerberosUserReference.get();
+            }

Review Comment:
   Just call `get()` once
   ```suggestion
               KerberosUser kerberosUser = kerberosUserReference.get() ;
               if (kerberosUser == null) {
                   kerberosUser = kerberosUserService.createKerberosUser();
               } 
   ```



##########
nifi-nar-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java:
##########
@@ -115,18 +116,26 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
                 });
 
             } catch (Exception e) {
-                getLogger().error("Privileged action failed with kerberos user 
" + kerberosUser, e);
-                session.transfer(session.penalize(flowFile), REL_FAILURE);
+                if (!handleAuthErrors(e, session, context)) {
+                    getLogger().error("Privileged action failed with kerberos 
user " + kerberosUser, e);

Review Comment:
   Use interpolation and not concatenation.
   ```suggestion
                       getLogger().error("Privileged action failed with 
kerberos user {}" , kerberosUser, e);
   ```



-- 
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]

Reply via email to