turcsanyip commented on code in PR #9944:
URL: https://github.com/apache/nifi/pull/9944#discussion_r2098439112
##########
nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java:
##########
@@ -280,6 +311,7 @@ protected Map<String, String> getConnectionProperties(final
ConfigurationContext
@Override
public SnowflakeConnectionWrapper getSnowflakeConnection() {
+ refreshAccessToken();
Review Comment:
`getSnowflakeConnection()` interface method is specific to the
`PutSnowflakeInternalStage` processor. The controller service can also be used
from the generic SQL processors (like `QueryDatabaseTableRecord`) and they
simply call `getConnection()`. For this reason, the access token must be
refreshed in that method.
##########
nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java:
##########
@@ -190,6 +204,18 @@ protected Collection<ValidationResult>
customValidate(final ValidationContext co
return Collections.emptyList();
}
+ @OnEnabled
+ public void onConfigured(final ConfigurationContext context) throws
InitializationException {
+ super.onConfigured(context);
+ accessTokenProvider =
context.getProperty(ACCESS_TOKEN_PROVIDER).asControllerService(OAuth2AccessTokenProvider.class);
+ }
Review Comment:
I suggest setting `accessTokenProvider` reference to `null` in `@OnDisabled`
method. Even though it does not cause any issues in the code logic, it is good
practice to clean up and not to hold references while the controller service is
disabled.
--
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]