rendered paste body private void filter(Cmd command) {
if (this.filterList == null) return;
// post-process the command through filters
for (IFilterContext filterContext : this.filterList) {
IFilter<ICommand> filter = null;
try {
long start = System.currentTimeMillis();
filter = filterContext.getFilter();
if (this.logger.isDebugEnabled()) {
this.logger.debug(String.format(
"[%s] Passing command with ULR '%s' to filter '%s' ...",
this.filterQueueID,
command.getLocation(),
filter.getClass().getName()
));
}
// process the command by the next filter
filter.filter(command, filterContext);
if (this.logger.isDebugEnabled()) {
this.logger.debug(String.format(
"[%s] Filtering of command with URL '%s' by filter '%s' took %d ms.",
this.filterQueueID,
command.getLocation(),
filter.getClass().getName(),
System.currentTimeMillis() - start
));
}
if (command.getResult() == ICommand.Result.Rejected) {
this.logger.info(String.format(
"[%s] Command for URL '%s' rejected by filter '%s'. Reason: %s",
this.filterQueueID,
command.getLocation(),
filter.getClass().getName(),
command.getResultText()
));
}
} catch (Throwable e) {
this.logger.error(String.format(
"[%s] Filter '%s' throwed an '%s' while processing '%s'.",
this.filterQueueID,
filter.getClass().getName(),
e.getClass().getName(),
command.getLocation()
),e);
}
}
}