Class FallbackResolverFactory

java.lang.Object
org.frontcache.resilience.fr.FallbackResolverFactory

public class FallbackResolverFactory extends Object
  • Method Details

    • getInstance

      public static FallbackResolver getInstance()
      The resolver, creating it if this is the first call. This used to throw RuntimeException("FallbackResolver is not initialized.") whenever it ran before init(FcHttpClient), and FrontCacheEngine calls init from 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 are FC_Total, FC_BypassCache, both FC_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% of Input-Request failing on a node that had been up 17 seconds. Nothing about the sleep required the throw. Creating the resolver reads fallbacks.conf from disk and needs no server - FileBasedFallbackResolver's constructor does it. Only FallbackResolver.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

      public static FallbackResolver init(FcHttpClient client)
      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 (FrontCacheIOServlet calls it on every get-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 a finally so a warm-up that throws is not retried on every subsequent poll, and cleared by destroy(), which is what makes the servlet's destroy-then-init actually reload.
    • destroy

      public static void destroy()