List of usage examples for org.apache.commons.lang BooleanUtils isTrue
public static boolean isTrue(Boolean bool)
Checks if a Boolean
value is true
, handling null
by returning false
.
BooleanUtils.isTrue(Boolean.TRUE) = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null) = false
From source file:easycare.web.password.ChangePasswordController.java
protected ModelAndView changePassword(HttpServletRequest request, HttpSession session, ChangePasswordForm changePasswordForm, BindingResult result, String view) { User user = this.sessionSecurityService.getCurrentUser(); boolean validPassword = true; if (!result.hasErrors()) { // Check Password history if (userService.hasUsedPassword(user, changePasswordForm.getPassword())) { result.rejectValue("password", "password.change.history.error"); validPassword = false;/* w ww .j a v a 2s .c o m*/ userPasswordService.fireChangePasswordFailAlreadyUsedEvent(changePasswordForm.getUsername()); } } if (result.hasErrors() || !validPassword) { // If password is in error, add the message code to be displayed ModelAndView mav = new ModelAndView(view); mav.addObject("changePasswordBean", changePasswordForm); if (!validPassword) { result.reject("password.change.fail"); } else { userPasswordService.fireChangePasswordFailValidationEvent(changePasswordForm.getUsername(), result); } return mav; } // Update password token if (!updatePasswordToken(session)) { return new ModelAndView(INVALID_TOKEN_VIEW); } // Update user password user = userService.changePassword(user, changePasswordForm.getPassword()); userPasswordService.fireChangePasswordSuccessfulEvent(changePasswordForm.getUsername()); if (BooleanUtils.isTrue((Boolean) session.getAttribute(LOGOUT_AFTER_PASSWORD_CHANGE_KEY))) { return forceRelogin(request, user); } // Redirect to License Agreement page if needed if (!user.isLicenseAgreementAccepted()) { return new ModelAndView(new RedirectView("/licenseAgreement", true)); } // Refresh User authorities sessionSecurityService.refreshUserContext(request, user, null); // Redirect to Home page return new ModelAndView(new RedirectView("/", true)); }
From source file:jp.primecloud.auto.process.lb.ComponentLoadBalancerProcess.java
public void configure(Long loadBalancerNo) { LoadBalancer loadBalancer = loadBalancerDao.read(loadBalancerNo); if (log.isInfoEnabled()) { log.info(/*from w w w.j av a2s . co m*/ MessageUtils.getMessage("IPROCESS-200205", loadBalancerNo, loadBalancer.getLoadBalancerName())); } ComponentLoadBalancer componentLoadBalancer = componentLoadBalancerDao.read(loadBalancerNo); // ??????????? List<Long> instanceNos = getInstanceNos(loadBalancerNo); try { // ??????? if (BooleanUtils.isNotTrue(loadBalancer.getEnabled())) { List<ZabbixInstance> zabbixInstances = zabbixInstanceDao.readInInstanceNos(instanceNos); for (ZabbixInstance zabbixInstance : zabbixInstances) { zabbixHostProcess.stopTemplate(zabbixInstance.getInstanceNo(), componentLoadBalancer.getComponentNo()); } } // ? puppetLoadBalancerProcess.configure(loadBalancerNo, componentLoadBalancer.getComponentNo(), instanceNos); // ?????? if (BooleanUtils.isTrue(loadBalancer.getEnabled())) { List<ZabbixInstance> zabbixInstances = zabbixInstanceDao.readInInstanceNos(instanceNos); for (ZabbixInstance zabbixInstance : zabbixInstances) { zabbixHostProcess.startTemplate(zabbixInstance.getInstanceNo(), componentLoadBalancer.getComponentNo()); } } } catch (RuntimeException e) { loadBalancer = loadBalancerDao.read(loadBalancerNo); // ? List<LoadBalancerListener> listeners = loadBalancerListenerDao.readByLoadBalancerNo(loadBalancerNo); for (LoadBalancerListener listener : listeners) { LoadBalancerListenerStatus status; if (BooleanUtils.isTrue(loadBalancer.getEnabled()) && BooleanUtils.isTrue(listener.getEnabled())) { status = LoadBalancerListenerStatus.WARNING; } else { status = LoadBalancerListenerStatus.STOPPED; } if (status != LoadBalancerListenerStatus.fromStatus(listener.getStatus()) || BooleanUtils.isTrue(listener.getConfigure())) { listener.setStatus(status.toString()); listener.setConfigure(false); loadBalancerListenerDao.update(listener); } } // ?? List<LoadBalancerInstance> lbInstances = loadBalancerInstanceDao.readByLoadBalancerNo(loadBalancerNo); List<Long> targetInstanceNos = new ArrayList<Long>(); for (LoadBalancerInstance lbInstance : lbInstances) { targetInstanceNos.add(lbInstance.getInstanceNo()); } List<Instance> targetInstances = instanceDao.readInInstanceNos(targetInstanceNos); Map<Long, Instance> targetInstanceMap = new HashMap<Long, Instance>(); for (Instance targetInstance : targetInstances) { targetInstanceMap.put(targetInstance.getInstanceNo(), targetInstance); } for (LoadBalancerInstance lbInstance : lbInstances) { LoadBalancerInstanceStatus status; Instance targetInstance = targetInstanceMap.get(lbInstance.getInstanceNo()); if (BooleanUtils.isTrue(loadBalancer.getEnabled()) && BooleanUtils.isTrue(lbInstance.getEnabled()) && BooleanUtils.isTrue(targetInstance.getEnabled())) { status = LoadBalancerInstanceStatus.WARNING; } else { status = LoadBalancerInstanceStatus.STOPPED; } if (status != LoadBalancerInstanceStatus.fromStatus(lbInstance.getStatus())) { lbInstance.setStatus(status.toString()); loadBalancerInstanceDao.update(lbInstance); } } throw e; } // ? List<LoadBalancerListener> listeners = loadBalancerListenerDao.readByLoadBalancerNo(loadBalancerNo); for (LoadBalancerListener listener : listeners) { LoadBalancerListenerStatus status; if (BooleanUtils.isTrue(loadBalancer.getEnabled()) && BooleanUtils.isTrue(listener.getEnabled())) { status = LoadBalancerListenerStatus.RUNNING; } else { status = LoadBalancerListenerStatus.STOPPED; } if (status != LoadBalancerListenerStatus.fromStatus(listener.getStatus()) || BooleanUtils.isTrue(listener.getConfigure())) { listener.setStatus(status.toString()); listener.setConfigure(false); loadBalancerListenerDao.update(listener); } } // ?? List<LoadBalancerInstance> lbInstances = loadBalancerInstanceDao.readByLoadBalancerNo(loadBalancerNo); List<Long> targetInstanceNos = new ArrayList<Long>(); for (LoadBalancerInstance lbInstance : lbInstances) { targetInstanceNos.add(lbInstance.getInstanceNo()); } List<Instance> targetInstances = instanceDao.readInInstanceNos(targetInstanceNos); Map<Long, Instance> targetInstanceMap = new HashMap<Long, Instance>(); for (Instance targetInstance : targetInstances) { targetInstanceMap.put(targetInstance.getInstanceNo(), targetInstance); } for (LoadBalancerInstance lbInstance : lbInstances) { LoadBalancerInstanceStatus status; Instance targetInstance = targetInstanceMap.get(lbInstance.getInstanceNo()); if (BooleanUtils.isTrue(loadBalancer.getEnabled()) && BooleanUtils.isTrue(lbInstance.getEnabled()) && BooleanUtils.isTrue(targetInstance.getEnabled())) { status = LoadBalancerInstanceStatus.RUNNING; } else { status = LoadBalancerInstanceStatus.STOPPED; } if (status != LoadBalancerInstanceStatus.fromStatus(lbInstance.getStatus())) { lbInstance.setStatus(status.toString()); loadBalancerInstanceDao.update(lbInstance); } } if (log.isInfoEnabled()) { log.info( MessageUtils.getMessage("IPROCESS-200206", loadBalancerNo, loadBalancer.getLoadBalancerName())); } }
From source file:jp.primecloud.auto.service.impl.ProcessServiceImpl.java
/** * {@inheritDoc}/* ww w .j a v a2 s .c o m*/ */ @Override public void stopInstances(Long farmNo, List<Long> instanceNos) { // ?? List<Instance> instances = instanceDao.readInInstanceNos(instanceNos); for (Instance instance : instances) { if (BooleanUtils.isTrue(instance.getEnabled())) { instance.setEnabled(false); instanceDao.update(instance); } } // ??????? List<ComponentInstance> componentInstances = componentInstanceDao.readInInstanceNos(instanceNos); for (ComponentInstance componentInstance : componentInstances) { if (BooleanUtils.isTrue(componentInstance.getEnabled()) || BooleanUtils.isNotTrue(componentInstance.getConfigure())) { componentInstance.setEnabled(false); componentInstance.setConfigure(true); componentInstanceDao.update(componentInstance); } } // ???? scheduleFarm(farmNo); }
From source file:net.shopxx.entity.Shipping.java
@Transient public boolean getIsDelivery() { return CollectionUtils.exists(getShippingItems(), new Predicate() { @Override/*ww w . j a va 2 s. com*/ public boolean evaluate(Object object) { ShippingItem shippingItem = (ShippingItem) object; return shippingItem != null && BooleanUtils.isTrue(shippingItem.getIsDelivery()); } }); }
From source file:jp.primecloud.auto.process.DnsProcess.java
public void stopDns(Platform platform, Long instanceNo) { Instance instance = instanceDao.read(instanceNo); // TODO CLOUD BRANCHING if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo);//from ww w.j a v a 2 s . c om } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo); } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo); } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo); } else if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatformType())) { PlatformAws platformAws = platformAwsDao.read(platform.getPlatformNo()); if (platform.getInternal()) { // ??? if (BooleanUtils.isTrue(platformAws.getEuca())) { // Eucalyptus?? log.debug("DnsProcess:stopDnsNormalEuca[internal=true, vpc=euca]"); stopDnsNormal(instanceNo); } else { if (BooleanUtils.isTrue(platformAws.getVpc())) { // VPC???? log.debug("DnsProcess:stopDnsVpc[internal=true, vpc=true]"); stopDnsNormal(instanceNo); } else { // VPC???? log.debug("DnsProcess:stopDnsNormalEc2[internal=true, vpc=false]"); stopDnsNormalEc2(instanceNo); } } } else { // ??? // Windows???VPN??? Image image = imageDao.read(instance.getImageNo()); if (StringUtils.startsWithIgnoreCase(image.getOs(), PCCConstant.OS_NAME_WIN)) { log.debug("DnsProcess:stopDnsNormalEc2[internal=false, os=windows]"); stopDnsNormalEc2(instanceNo); } else { // VPN???? log.debug("DnsProcess:stopDnsVpn[internal=false, os=linux]VPC+VPN"); stopDnsNormal(instanceNo); } } } // processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, null, instance, "DnsUnregist", new Object[] { instance.getFqdn(), instance.getPublicIp() }); }
From source file:com.evolveum.midpoint.wf.impl.processors.primary.policy.ApprovalSchemaBuilder.java
private boolean isAddOnFragment(ApprovalCompositionStrategyType cs) { return cs != null && (!cs.getMergeIntoOrder().isEmpty() || BooleanUtils.isTrue(cs.isMergeIntoAll())); }
From source file:com.hortonworks.streamline.streams.service.TopologyTestRunResource.java
@GET @Path("/topologies/{topologyId}/testhistories/{historyId}") @Timed/*from w w w .j a va 2 s. c o m*/ public Response getHistoryOfTestRunTopology(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @QueryParam("simplify") Boolean simplify) throws Exception { TopologyTestRunHistory history = catalogService.getTopologyTestRunHistory(historyId); if (history == null) { throw EntityNotFoundException.byId(String.valueOf(historyId)); } if (!history.getTopologyId().equals(topologyId)) { throw BadRequestException .message("Test history " + historyId + " is not belong to topology " + topologyId); } if (BooleanUtils.isTrue(simplify)) { return WSUtils.respondEntity(new SimplifiedTopologyTestRunHistory(history), OK); } else { return WSUtils.respondEntity(history, OK); } }
From source file:com.haulmont.cuba.gui.backgroundwork.BackgroundWorkProgressWindow.java
@Override public void init(Map<String, Object> params) { @SuppressWarnings("unchecked") BackgroundTask<T, V> task = (BackgroundTask<T, V>) params.get("task"); String title = (String) params.get("title"); if (title != null) { setCaption(title);//from ww w. j av a 2s. com } String message = (String) params.get("message"); if (message != null) { text.setValue(message); } Boolean cancelAllowedNullable = (Boolean) params.get("cancelAllowed"); cancelAllowed = BooleanUtils.isTrue(cancelAllowedNullable); Boolean percentProgressNullable = (Boolean) params.get("percentProgress"); this.percentProgress = BooleanUtils.isTrue(percentProgressNullable); cancelButton.setVisible(cancelAllowed); getDialogOptions().setCloseable(cancelAllowed); @SuppressWarnings("unchecked") final T total = (T) params.get("total"); this.totalProgress = total; showProgress(0); BackgroundTask<T, V> wrapperTask = new LocalizedTaskWrapper<>(task, this); wrapperTask.addProgressListener(new BackgroundTask.ProgressListenerAdapter<T, V>() { @Override public void onProgress(List<T> changes) { if (!changes.isEmpty()) { Number lastProcessedValue = changes.get(changes.size() - 1); showProgress(lastProcessedValue); } } }); taskHandler = backgroundWorker.handle(wrapperTask); taskHandler.execute(); }
From source file:jp.primecloud.auto.tool.management.service.UserService.java
public static void showUserPlatform() { try {//from www . ja v a 2 s. c om String userSql = "SELECT * FROM USER"; List<User> users = SQLMain.selectExecuteWithResult(userSql, User.class); StringBuilder titles = new StringBuilder(); titles.append(StringUtils.rightPad("Username", padSize, " ")); titles.append(StringUtils.rightPad("Status", padSize, " ")); titles.append(StringUtils.rightPad("Platform", padSize, " ")); System.out.println(titles.toString()); String disablecode = Config.getProperty("DISABLE_CODE"); Map<Long, Platform> platformMap = new LinkedHashMap<Long, Platform>(); String platformSql = "SELECT * FROM PLATFORM"; List<Platform> platforms = SQLMain.selectExecuteWithResult(platformSql, Platform.class); for (Platform platform : platforms) { platformMap.put(platform.getPlatformNo(), platform); } Map<Long, List<AwsCertificate>> awsCertificateMap = new LinkedHashMap<Long, List<AwsCertificate>>(); String awsAql = "SELECT * FROM AWS_CERTIFICATE"; List<AwsCertificate> tmpAwsCertificates = SQLMain.selectExecuteWithResult(awsAql, AwsCertificate.class); for (AwsCertificate awsCertificate : tmpAwsCertificates) { List<AwsCertificate> list = awsCertificateMap.get(awsCertificate.getUserNo()); if (list == null) { list = new ArrayList<AwsCertificate>(); } list.add(awsCertificate); awsCertificateMap.put(awsCertificate.getUserNo(), list); } Map<Long, List<VmwareKeyPair>> vmwareKeyPairMap = new LinkedHashMap<Long, List<VmwareKeyPair>>(); String vmwareSql = "SELECT * FROM VMWARE_KEY_PAIR"; List<VmwareKeyPair> tmpVmwareKeyPairs = SQLMain.selectExecuteWithResult(vmwareSql, VmwareKeyPair.class); for (VmwareKeyPair vmwareKeyPair : tmpVmwareKeyPairs) { List<VmwareKeyPair> list = vmwareKeyPairMap.get(vmwareKeyPair.getUserNo()); if (list == null) { list = new ArrayList<VmwareKeyPair>(); } list.add(vmwareKeyPair); vmwareKeyPairMap.put(vmwareKeyPair.getUserNo(), list); } Map<Long, List<NiftyCertificate>> niftyCertificateMap = new LinkedHashMap<Long, List<NiftyCertificate>>(); String niftySql = "SELECT * FROM NIFTY_CERTIFICATE"; List<NiftyCertificate> tmpNiftyCertificates = SQLMain.selectExecuteWithResult(niftySql, NiftyCertificate.class); for (NiftyCertificate niftyCertificate : tmpNiftyCertificates) { List<NiftyCertificate> list = niftyCertificateMap.get(niftyCertificate.getUserNo()); if (list == null) { list = new ArrayList<NiftyCertificate>(); } list.add(niftyCertificate); niftyCertificateMap.put(niftyCertificate.getUserNo(), list); } Map<Long, List<CloudstackCertificate>> cloudstackCertificateMap = new LinkedHashMap<Long, List<CloudstackCertificate>>(); String csSql = "SELECT * FROM CLOUDSTACK_CERTIFICATE"; List<CloudstackCertificate> tmpCloudstackCertificates = SQLMain.selectExecuteWithResult(csSql, CloudstackCertificate.class); for (CloudstackCertificate cloudstackCertificate : tmpCloudstackCertificates) { List<CloudstackCertificate> list = cloudstackCertificateMap.get(cloudstackCertificate.getAccount()); if (list == null) { list = new ArrayList<CloudstackCertificate>(); } list.add(cloudstackCertificate); cloudstackCertificateMap.put(cloudstackCertificate.getAccount(), list); } Map<Long, List<VcloudCertificate>> vcloudCertificateMap = new LinkedHashMap<Long, List<VcloudCertificate>>(); String vcSql = "SELECT * FROM VCLOUD_CERTIFICATE"; List<VcloudCertificate> tmpVcloudCertificates = SQLMain.selectExecuteWithResult(vcSql, VcloudCertificate.class); for (VcloudCertificate vcloudCertificate : tmpVcloudCertificates) { List<VcloudCertificate> list = vcloudCertificateMap.get(vcloudCertificate.getUserNo()); if (list == null) { list = new ArrayList<VcloudCertificate>(); } list.add(vcloudCertificate); vcloudCertificateMap.put(vcloudCertificate.getUserNo(), list); } for (User user : users) { List<String> columns = new ArrayList<String>(); columns.add(user.getUsername()); // ?? if (!StringUtils.startsWith(user.getPassword(), disablecode)) { columns.add("enable"); } else { columns.add("disable"); } // TODO CLOUD BRANCHING StringBuilder sb = new StringBuilder(); List<AwsCertificate> awsCertificates = awsCertificateMap.get(user.getUserNo()); if (awsCertificates != null && !awsCertificates.isEmpty()) { for (AwsCertificate awsCertificate : awsCertificates) { Platform platform = platformMap.get(awsCertificate.getPlatformNo()); if ("aws".equals(platform.getPlatformType()) && BooleanUtils.isTrue(platform.getSelectable())) { sb.append(platform.getPlatformName()); sb.append(" "); } } } List<VmwareKeyPair> vmwareKeyPairs = vmwareKeyPairMap.get(user.getUserNo()); if (vmwareKeyPairs != null && !vmwareKeyPairs.isEmpty()) { for (VmwareKeyPair vmwareKeyPair : vmwareKeyPairs) { Platform platform = platformMap.get(vmwareKeyPair.getPlatformNo()); if ("vmware".equals(platform.getPlatformType()) && BooleanUtils.isTrue(platform.getSelectable())) { sb.append(platform.getPlatformName()); sb.append(" "); } } } List<NiftyCertificate> niftyCertificates = niftyCertificateMap.get(user.getUserNo()); if (niftyCertificates != null && !niftyCertificates.isEmpty()) { for (NiftyCertificate niftyCertificate : niftyCertificates) { Platform platform = platformMap.get(niftyCertificate.getPlatformNo()); if ("nifty".equals(platform.getPlatformType()) && BooleanUtils.isTrue(platform.getSelectable())) { sb.append(platform.getPlatformName()); sb.append(" "); } } } List<CloudstackCertificate> cloudstackCertificates = cloudstackCertificateMap.get(user.getUserNo()); if (cloudstackCertificates != null && !cloudstackCertificates.isEmpty()) { for (CloudstackCertificate cloudstackCertificate : cloudstackCertificates) { Platform platform = platformMap.get(cloudstackCertificate.getPlatformNo()); if ("cloudstack".equals(platform.getPlatformType()) && BooleanUtils.isTrue(platform.getSelectable())) { sb.append(platform.getPlatformName()); sb.append(" "); } } } List<VcloudCertificate> vcloudCertificates = vcloudCertificateMap.get(user.getUserNo()); if (vcloudCertificates != null && !vcloudCertificates.isEmpty()) { for (VcloudCertificate vcloudCertificate : vcloudCertificates) { Platform platform = platformMap.get(vcloudCertificate.getPlatformNo()); if ("vcloud".equals(platform.getPlatformType()) && BooleanUtils.isTrue(platform.getSelectable())) { sb.append(platform.getPlatformName()); sb.append(" "); } } } columns.add(sb.toString()); for (String column : columns) { System.out.print(StringUtils.rightPad(column, padSize, " ")); } System.out.println(); } log.info("????"); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage(), e); } }
From source file:com.haulmont.cuba.core.app.scheduling.Scheduling.java
protected void processTask(ScheduledTask task) { if (isRunning(task)) { log.trace("{} is running", task); return;// w w w . j a v a 2s . c o m } try { long now = timeSource.currentTimeMillis(); String me = serverInfo.getServerId(); Integer serverPriority = getServerPriority(task, me); if (!checkFirst(task, serverPriority, now)) return; long period = task.getPeriod() != null ? task.getPeriod() * 1000 : 0; long frame = task.getTimeFrame() != null ? task.getTimeFrame() * 1000 : period / 2; if (frame == 0) {//for cron tasks, where period is null we set default frame as scheduling interval frame = getSchedulingInterval(); } if (BooleanUtils.isTrue(task.getSingleton())) { if (task.getStartDate() != null || SchedulingType.CRON == task.getSchedulingType()) { long currentStart; if (SchedulingType.FIXED_DELAY == task.getSchedulingType()) { currentStart = calculateNextDelayDate(task, task.getLastStart(), coordinator.getLastFinished(task), now, frame, period); } else if (SchedulingType.CRON == task.getSchedulingType()) { currentStart = calculateNextCronDate(task, task.getLastStart(), now, frame); } else { currentStart = calculateNextPeriodDate(task, task.getLastStart(), now, frame, period); } if (needToStartInTimeFrame(now, frame, task.getLastStart(), currentStart)) { runSingletonTask(task, now, me); } else { log.trace("{}\n not in time frame to start", task); } } else { Integer lastServerPriority = task.getLastStartServer() == null ? null : getServerPriority(task, task.getLastStartServer()); // We should switch to me if the last server wasn't me and I have higher priority boolean shouldSwitch = lastServerWasNotMe(task, me) && (lastServerPriority == null || serverPriority.compareTo(lastServerPriority) < 0); // The last server wasn't me and it has higher priority boolean giveChanceToPreviousHost = lastServerWasNotMe(task, me) && (lastServerPriority != null && serverPriority.compareTo(lastServerPriority) > 0); log.trace("{}\n now={} lastStart={} lastServer={} shouldSwitch={} giveChanceToPreviousHost={}", task, now, task.getLastStart(), task.getLastStartServer(), shouldSwitch, giveChanceToPreviousHost); if (task.getLastStart() == 0 || shouldSwitch) { runSingletonTask(task, now, me); } else { long delay = giveChanceToPreviousHost ? period + period / 2 : period; if (SchedulingType.FIXED_DELAY == task.getSchedulingType()) { long lastFinish = coordinator.getLastFinished(task); if ((task.getLastStart() < lastFinish || !lastFinishCache.containsKey(task)) && lastFinish + delay < now) { runSingletonTask(task, now, me); } else { log.trace("{}\n time has not come and we shouldn't switch", task); } } else if (task.getLastStart() + delay <= now) { runSingletonTask(task, now, me); } else { log.trace("{}\n time has not come and we shouldn't switch", task); } } } } else { Long lastStart = lastStartCache.getOrDefault(task, 0L); Long lastFinish = lastFinishCache.getOrDefault(task, 0L); if (task.getStartDate() != null || SchedulingType.CRON == task.getSchedulingType()) { long currentStart; if (SchedulingType.FIXED_DELAY == task.getSchedulingType()) { currentStart = calculateNextDelayDate(task, lastStart, lastFinish, now, frame, period); } else if (SchedulingType.CRON == task.getSchedulingType()) { currentStart = calculateNextCronDate(task, lastStart, now, frame); } else { currentStart = calculateNextPeriodDate(task, lastStart, now, frame, period); } if (needToStartInTimeFrame(now, frame, lastStart, currentStart)) { runTask(task, now); } else { log.trace("{}\n not in time frame to start", task); } } else { log.trace("{}\n now={} lastStart={} lastFinish={}", task, now, lastStart, lastFinish); if (SchedulingType.FIXED_DELAY == task.getSchedulingType()) { if ((lastStart == 0 || lastStart < lastFinish) && now >= lastFinish + period) { runTask(task, now); } else { log.trace("{}\n time has not come", task); } } else if (now >= lastStart + period) { runTask(task, now); } else { log.trace("{}\n time has not come", task); } } } } catch (Throwable throwable) { log.error("Unable to process " + task, throwable); } }