Class BgController

java.lang.Object
de.spiritscorp.datasync.controller.BgController

public class BgController extends Object
Central orchestration engine handling asynchronous background file synchronization routines.

The BgController manages the application's daemon lifecycle. It leverages a dedicated two-tier concurrent executor architecture to decouple continuous time-threshold monitoring from high-overhead disk I/O operations. This design prevents resource starvation and avoids system UI freezes by offloading execution workloads to isolated worker threads.

System state integration is maintained via an operating system SystemTray proxy interface, allowing the core UI application framework to seamlessly minimize into background execution lanes.

Author:
Tom Spirit
  • Method Details

    • requestApplicationShutdown

      public void requestApplicationShutdown()
      Initiates a global application termination sequence triggered from the background context.

      This method acts as the bridge for the BgView (SystemTray) to command a full system exit. It systematically deallocates and dismantles internal concurrent tracking structures using a standardized background grace period before delegating downstream lifecycle teardown protocols to the central application controller.

      See Also:
      • shutdownExecutors(long)
    • interruptBgJob

      public void interruptBgJob(long timeoutPerThreadMs)
      Interrupts the active background execution cycle and restores the primary user interface.

      This dual-purpose lifecycle hook is invoked by both the primary workspace (MainView) and the system notification shell (BgView). It enforces an immediate visibility state transition on the main window stage and guarantees a deterministic, timed collapse of all active thread pool frames.

      Parameters:
      timeoutPerThreadMs - The maximum allocation window in milliseconds granted to active worker threads to complete processing cycles before a hard interruption signal is enforced.
      See Also:
      • shutdownExecutors(long)