Interface ClusterHandler

    • Method Detail

      • getHostId

        String getHostId()
        Returns the current host identifier
      • getLocalStorage

        <K,​V> LocalStorage<K,​V> getLocalStorage​(LocalStorageType<K,​V> type)
        Returns the local storage for the given type
      • getStartupTime

        long getStartupTime()
        Returns when the cluster was started up
      • isAlive

        boolean isAlive()
        Returns whether the cluster (or local instance) is still alive
      • isCluster

        boolean isCluster()
        Returns whether we're actually running in a cluster or as a single node installation
      • lockDatabase

        boolean lockDatabase()
        Checks that there is no other Cyclos instance using the database and afterwards, locks the database. Returns whether the database was actually locked.
      • runInitialization

        boolean runInitialization​(ApplicationInitializationListener listener)
        Attempts to execute the given ApplicationInitializationListener#onApplicationInitialization(org.cyclos.impl.ApplicationHandler). In some cases (for example, the initialization was already executed), it might do nothing, and just return false
      • runPollingTask

        boolean runPollingTask​(PollingTask task,
                               boolean awake,
                               Date nextExecution)
        Attempts to execute the given PollingTask, except if it is already running in some other cluster node (in this case, returning false). The CyclosProperties.getMaxBackgroundTasks() is respected.
        Parameters:
        task - The task to run
        awake - A flag indicating whether the given task has been manually awake (true) or is executing after a timeout (false)
        nextExecution - The date it is scheduled the next execution