Interface Backend.Application

Enclosing class:
Backend

public static interface Backend.Application

The build-generated wiring of an application: every bean, constructed and injected by straight-line code the build wrote, and the lifecycle calls around them.

Nothing here is looked up or reflected. The build resolves which constructor each bean gets, which bean each injection point receives and in what order they are built, and writes that down as new and setter calls; this interface is only where the server calls into it.

  • Method Summary

    Modifier and Type
    Method
    Description
    Constructs the beans and returns the routers, once the database, if any, is open.
    Every bean the build wired: name, type, scope and what it was given.
    Every route the build generated: method, path and handler.
    The scheduler running this application's @Scheduled jobs, or null.
    void
    Registers the websocket endpoints, which are beans too.
    void
    A request has been answered; beans are its @RequestScope beans, whose destroy methods run here.
    void
    A session has ended -- invalidated, expired, or the server stopped; beans are its @SessionScope beans, whose destroy methods run here.
    void
    started(Backend backend)
    The server is accepting: scheduled jobs and exporters start here.
    void
    The server has drained: the beans' destroy methods run here.
    void
    The server is about to drain: no new scheduled run starts after this.
    boolean
    Whether a generated class needs Backend.currentRequest(): a request- or session-scoped bean reached from a singleton.
  • Method Details

    • create

      HttpServer.Handler[] create(Backend.Environment environment) throws Exception
      Constructs the beans and returns the routers, once the database, if any, is open.
      Throws:
      Exception
    • registerWebSockets

      void registerWebSockets(HttpServer.WebSocketRegistry registry) throws Exception
      Registers the websocket endpoints, which are beans too.
      Throws:
      Exception
    • started

      void started(Backend backend) throws Exception
      The server is accepting: scheduled jobs and exporters start here.
      Throws:
      Exception
    • stopping

      void stopping()
      The server is about to drain: no new scheduled run starts after this.
    • stopped

      void stopped()
      The server has drained: the beans' destroy methods run here.
    • tracksCurrentRequest

      boolean tracksCurrentRequest()
      Whether a generated class needs Backend.currentRequest(): a request- or session-scoped bean reached from a singleton. False keeps the per-request thread-local write out of servers that have none.
    • requestEnded

      void requestEnded(Object[] beans)
      A request has been answered; beans are its @RequestScope beans, whose destroy methods run here.
    • sessionEnded

      void sessionEnded(Object[] beans)
      A session has ended -- invalidated, expired, or the server stopped; beans are its @SessionScope beans, whose destroy methods run here.
    • getScheduler

      Scheduler getScheduler()
      The scheduler running this application's @Scheduled jobs, or null.
    • describeBeans

      List describeBeans()
      Every bean the build wired: name, type, scope and what it was given. For the management endpoint and the development MCP server.
    • describeRoutes

      List describeRoutes()
      Every route the build generated: method, path and handler.