Defer fetching of the filter configuration until the first poll to prevent application startup from being blocked
@@ -247,8 +247,9 @@ public class MutableThreadContextMapFilter extends AbstractFilter {
}
final AuthorizationProvider authorizationProvider =
ConfigurationFactory.authorizationProvider(PropertiesUtil.getProperties());
- final ConfigResult result = getConfig(source, authorizationProvider);
Filter filter;
+ if (pollInterval <= 0) {
+ ConfigResult result = getConfig(source, authorizationProvider);
if (result.status == Status.SUCCESS) {
if (result.pairs.length > 0) {
filter = ThreadContextMapFilter.createFilter(result.pairs, "or",
@@ -262,6 +263,9 @@ public class MutableThreadContextMapFilter extends AbstractFilter {
LOGGER.warn("Unexpected response returned on initial call: {}", result.status);
filter = new NoOpFilter();
}
+ } else {
+ filter = new NoOpFilter();
+ }
if (pollInterval > 0) {
configuration.getScheduler().incrementScheduledItems();
