Search in sources :

Example 11 with RegistryStorageConflictException

use of org.bf2.srs.fleetmanager.storage.RegistryStorageConflictException in project srs-fleet-manager by bf2fc6cc711aee1a0c2a.

the class ScheduleRegistryWorker method finallyExecute.

@Override
public void finallyExecute(Task aTask, WorkerContext ctl, Optional<Exception> error) throws RegistryNotFoundException, RegistryStorageConflictException {
    ScheduleRegistryTask task = (ScheduleRegistryTask) aTask;
    // SUCCESS STATE
    Optional<RegistryData> registryOpt = storage.getRegistryById(task.getRegistryId());
    if (registryOpt.isPresent() && registryOpt.get().getRegistryDeployment() != null)
        return;
    // The only thing to handle is if we were able to schedule but storage does not work
    // In that case, the only thing to do is to just try deleting the registry.
    storage.deleteRegistry(task.getRegistryId());
}
Also used : ScheduleRegistryTask(org.bf2.srs.fleetmanager.execution.impl.tasks.ScheduleRegistryTask) RegistryData(org.bf2.srs.fleetmanager.storage.sqlPanacheImpl.model.RegistryData)

Aggregations

RegistryData (org.bf2.srs.fleetmanager.storage.sqlPanacheImpl.model.RegistryData)9 Transactional (javax.transaction.Transactional)7 RegistryDeploymentData (org.bf2.srs.fleetmanager.storage.sqlPanacheImpl.model.RegistryDeploymentData)4 ProvisionRegistryTenantTask (org.bf2.srs.fleetmanager.execution.impl.tasks.ProvisionRegistryTenantTask)3 Audited (org.bf2.srs.fleetmanager.common.operation.auditing.Audited)2 ScheduleRegistryTask (org.bf2.srs.fleetmanager.execution.impl.tasks.ScheduleRegistryTask)2 DeprovisionRegistryTask (org.bf2.srs.fleetmanager.execution.impl.tasks.deprovision.DeprovisionRegistryTask)2 StartDeprovisionRegistryTask (org.bf2.srs.fleetmanager.execution.impl.tasks.deprovision.StartDeprovisionRegistryTask)2 TenantNotFoundServiceException (org.bf2.srs.fleetmanager.spi.tenants.TenantNotFoundServiceException)2 TenantManagerConfig (org.bf2.srs.fleetmanager.spi.tenants.model.TenantManagerConfig)2 RegistryNotFoundException (org.bf2.srs.fleetmanager.storage.RegistryNotFoundException)2 RegistryStorageConflictException (org.bf2.srs.fleetmanager.storage.RegistryStorageConflictException)2 Instant (java.time.Instant)1 List (java.util.List)1 Optional (java.util.Optional)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1 Collectors.toList (java.util.stream.Collectors.toList)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Inject (javax.inject.Inject)1 PersistenceException (javax.persistence.PersistenceException)1