Hi Thai,
it's not easy to see what your problem is here, you will have to do some
more debugging. I have some pointers though...
I set service.ranking=1 because i'm running pax-web and it seems to
execute
filters in ascending ranking.
"Higher rankings will be placed first in the chain, that is, filter
chains are sorted in descending order."
from [1]
... I also set avoid404DuringStartup=true and
start level of healthcheck.core to level 3 (default is 4) because I
want
this filter to be up before my servlets and filters (default level 4).
However, I always see "INFO o.a.f.h.c.i.f.ServiceUnavailableFilter -
ServiceUnavailableFilter active (start level 4)"
the log says it started at start level 4, so somehow the configuration
you made for start level 3 did not work
1. In a dynamic env like osgi container, how can we be sure that a
request
always be processed by a filter before arriving at the servlet? Bundles
do
not always start in the same order thus a filter may be registered
after
the servlet it supposed to protect
use start levels to ensure filters are started before the servlets (I
think you are already trying to do this)
2. Even when i waited for a long period after starting my server and
healthcheck return OK for all of my checks, why does
ServiceUnavailableFilter not handle any request?
If the health check returns OK the ServiceUnavailableFilter is not meant
to kick in. Activate debug logging [2] to see if the filter is doing
anything. Also ensure you left config property 'autoDisableFilter' to
default 'false'.
-Georg
[1]
https://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#filter-service-properties
[2]
https://github.com/apache/felix/blob/fd76982e887e82159288f1d0c1908402885d8e4c/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/filter/ServiceUnavailableFilter.java#L288
https://github.com/apache/felix/blob/fd76982e887e82159288f1d0c1908402885d8e4c/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/filter/ServiceUnavailableFilter.java#L264