Class DatabaseManager

    • Field Detail

      • UNLOCK_DATABASE

        public static final String UNLOCK_DATABASE
        SQL command to manually unlock the database
        See Also:
        Constant Field Values
    • Constructor Detail

      • DatabaseManager

        public DatabaseManager()
    • Method Detail

      • doWithCyclosInstanceLock

        public void doWithCyclosInstanceLock​(Runnable action)
        Prevents 2 Cyclos instances (even in a cluster) to execute the given action concurrently
      • initialize

        @PostConstruct
        public void initialize()
      • isDatabaseLocked

        public boolean isDatabaseLocked()
        Returns whether some Cyclos instance is currently locking this database
      • lockDatabase

        public void lockDatabase​(String hostId)
        Locks the application
      • manageDatabase

        public void manageDatabase​(javax.persistence.EntityManagerFactory emf)
                            throws SQLException
        Apply the database management checks
        Throws:
        SQLException
      • prepareDatabaseLock

        public void prepareDatabaseLock()
        Makes sure that the database lock mechanism has the required database objects
      • unlockDatabase

        public void unlockDatabase()
        Updates the database to mark it as no Cyclos instance running