Class RestoreFromBackupSQLExceptionHandler

java.lang.Object
net.solarnetwork.node.dao.jdbc.AbstractSQLExceptionHandler
net.solarnetwork.node.dao.jdbc.RestoreFromBackupSQLExceptionHandler
All Implemented Interfaces:
net.solarnetwork.dao.jdbc.SQLExceptionHandler

public class RestoreFromBackupSQLExceptionHandler extends AbstractSQLExceptionHandler
Recover from connection exceptions by restoring from backup.
Version:
2.1
Author:
matt
  • Constructor Details

    • RestoreFromBackupSQLExceptionHandler

      public RestoreFromBackupSQLExceptionHandler(org.osgi.framework.BundleContext bundleContext, int minimumExceptionCount)
      Constructor.
      Parameters:
      bundleContext - The active bundle context.
      minimumExceptionCount - The minimum number of exceptions to witness before attempting to restore from backup.
  • Method Details

    • handleGetConnectionException

      public void handleGetConnectionException(SQLException e)
    • handleConnectionException

      public void handleConnectionException(Connection conn, SQLException e)
    • setRestoreDelaySeconds

      public void setRestoreDelaySeconds(int restoreDelaySeconds)
      Set the number of seconds to delay the restore from backup. This is mainly to give the framework a time to boot up and provide the BackupManager service.
      Parameters:
      restoreDelaySeconds - The number of seconds to delay attempting the restore from backup.
    • setBackupResourceProviderFilter

      public void setBackupResourceProviderFilter(String backupResourceProviderFilter)
      Set a filter to pass as BackupManager.RESOURCE_PROVIDER_FILTER to limit the scope of the backup.
      Parameters:
      backupResourceProviderFilter - The filter to set.
    • setIdentityService

      public void setIdentityService(net.solarnetwork.service.OptionalService<net.solarnetwork.node.service.IdentityService> identityService)
      Set an IdentityService to know the current node identity to associate backups with.
      Parameters:
      identityService - the identity service to use
      Since:
      1.1