From b837defb13c3e8b48775163bf1a1e144c5a231c0 Mon Sep 17 00:00:00 2001 From: SirWayne Date: Thu, 24 Mar 2016 12:12:28 +0100 Subject: [PATCH] Revert uncomment code Signed-off-by: SirWayne --- .../hawkbit/repository/RolloutScheduler.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutScheduler.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutScheduler.java index 9b45e661f..6671ad896 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutScheduler.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutScheduler.java @@ -8,6 +8,8 @@ */ package org.eclipse.hawkbit.repository; +import java.util.List; + import org.eclipse.hawkbit.security.SystemSecurityContext; import org.eclipse.hawkbit.tenancy.TenantAware; import org.slf4j.Logger; @@ -54,25 +56,25 @@ public class RolloutScheduler { */ @Scheduled(initialDelayString = RolloutProperties.Scheduler.PROP_SCHEDULER_DELAY_PLACEHOLDER, fixedDelayString = RolloutProperties.Scheduler.PROP_SCHEDULER_DELAY_PLACEHOLDER) public void rolloutScheduler() { - // logger.debug("rollout schedule checker has been triggered."); - // // run this code in system code privileged to have the necessary - // // permission to query and create entities. - // systemSecurityContext.runAsSystem(() -> { - // // workaround eclipselink that is currently not possible to - // // execute a query without multitenancy if MultiTenant - // // annotation is used. - // // https://bugs.eclipse.org/bugs/show_bug.cgi?id=355458. So - // // iterate through all tenants and execute the rollout check for - // // each tenant seperately. - // final List tenants = systemManagement.findTenants(); - // logger.info("Checking rollouts for {} tenants", tenants.size()); - // for (final String tenant : tenants) { - // tenantAware.runAsTenant(tenant, () -> { - // rolloutManagement.checkRunningRollouts(rolloutProperties.getScheduler().getFixedDelay()); - // return null; - // }); - // } - // return null; - // }); + logger.debug("rollout schedule checker has been triggered."); + // run this code in system code privileged to have the necessary + // permission to query and create entities. + systemSecurityContext.runAsSystem(() -> { + // workaround eclipselink that is currently not possible to + // execute a query without multitenancy if MultiTenant + // annotation is used. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=355458. So + // iterate through all tenants and execute the rollout check for + // each tenant seperately. + final List tenants = systemManagement.findTenants(); + logger.info("Checking rollouts for {} tenants", tenants.size()); + for (final String tenant : tenants) { + tenantAware.runAsTenant(tenant, () -> { + rolloutManagement.checkRunningRollouts(rolloutProperties.getScheduler().getFixedDelay()); + return null; + }); + } + return null; + }); } }