Class FallbackResolverFactory
java.lang.Object
org.frontcache.resilience.fr.FallbackResolverFactory
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddestroy()static FallbackResolverThe resolver, creating it if this is the first call.static FallbackResolverinit(FcHttpClient client) Creates the resolver if needed and runs its origin warm-up once.
-
Method Details
-
getInstance
The resolver, creating it if this is the first call. This used to throwRuntimeException("FallbackResolver is not initialized.")whenever it ran beforeinit(FcHttpClient), andFrontCacheEnginecallsinitfrom a background thread after a deliberate 3-second sleep - so for the first three seconds of a node's life every caller that needed a fallback got an exception instead of one. The callers areFC_Total,FC_BypassCache, bothFC_ThroughCache_*and the include processor: that is, the code whose whole job is to absorb a failure. It therefore turned one failed fragment into a failed page, and did it precisely during a restart, when a proxy is at its least healthy. On fc-us it read as 24% ofInput-Requestfailing on a node that had been up 17 seconds. Nothing about the sleep required the throw. Creating the resolver readsfallbacks.conffrom disk and needs no server -FileBasedFallbackResolver's constructor does it. OnlyFallbackResolver.init(FcHttpClient)'s origin warm-up needs the node to be listening, which is what the sleep is for. Splitting the two means the file-based fallbacks are answerable from the first request, and the URL-sourced ones fill in when the node is up. -
init
Creates the resolver if needed and runs its origin warm-up once. The warm-up is guarded separately from creation because this is also the console's reload path (FrontCacheIOServletcalls it on everyget-fallback-configs), and re-fetching every fallback from the origin on a dashboard poll is not what that endpoint means. The flag is set in afinallyso a warm-up that throws is not retried on every subsequent poll, and cleared bydestroy(), which is what makes the servlet's destroy-then-init actually reload. -
destroy
public static void destroy()
-