Skip to content
Snippets Groups Projects
Commit 9b0f85b3 authored by Rick Herrick's avatar Rick Herrick
Browse files

XNAT-4282 Delayed tag initialization until actually accessed to delay call to...

XNAT-4282 Delayed tag initialization until actually accessed to delay call to config service. Also fixed concurrent modification error in alias token scheduling.
parent 33ee7c64
No related branches found
No related tags found
No related merge requests found
No preview for this file type
#Mon Mar 14 17:41:56 CDT 2016
#Sat May 28 14:49:32 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
......@@ -6,12 +6,30 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
......@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
......@@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
......@@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
......
......@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
......
......@@ -10,10 +10,7 @@
*/
package org.nrg.dcm.id;
import java.util.regex.Pattern;
import javax.inject.Provider;
import com.google.common.collect.ImmutableSortedSet;
import org.dcm4che2.data.DicomObject;
import org.nrg.dcm.ChainExtractor;
import org.nrg.dcm.Extractor;
......@@ -22,67 +19,57 @@ import org.nrg.xft.security.UserI;
import org.nrg.xnat.DicomObjectIdentifier;
import org.nrg.xnat.Labels;
import com.google.common.collect.ImmutableSortedSet;
public class CompositeDicomObjectIdentifier implements
DicomObjectIdentifier<XnatProjectdata> {
private final DicomProjectIdentifier projectID;
private final Extractor subjectExtractor, sessionExtractor, aaExtractor;
private final ImmutableSortedSet<Integer> tags;
import javax.inject.Provider;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.regex.Pattern;
public CompositeDicomObjectIdentifier(final DicomProjectIdentifier projectID,
final Extractor subjectExtractor,
final Extractor sessionExtractor,
final Extractor aaExtractor) {
this.projectID = projectID;
this.subjectExtractor = subjectExtractor;
this.sessionExtractor = sessionExtractor;
this.aaExtractor = aaExtractor;
ImmutableSortedSet.Builder<Integer> builder = ImmutableSortedSet.naturalOrder();
builder.addAll(projectID.getTags());
builder.addAll(aaExtractor.getTags());
builder.addAll(sessionExtractor.getTags());
builder.addAll(subjectExtractor.getTags());
tags = builder.build();
public class CompositeDicomObjectIdentifier implements DicomObjectIdentifier<XnatProjectdata> {
public CompositeDicomObjectIdentifier(final DicomProjectIdentifier identifier,
final Extractor subjectExtractor,
final Extractor sessionExtractor,
final Extractor aaExtractor) {
_identifier = identifier;
_subjectExtractor = subjectExtractor;
_sessionExtractor = sessionExtractor;
_aaExtractor = aaExtractor;
}
public CompositeDicomObjectIdentifier(final DicomProjectIdentifier projectID,
final Iterable<Extractor> subjectExtractors,
final Iterable<Extractor> sessionExtractors,
final Iterable<Extractor> aaExtractors) {
this(projectID, new ChainExtractor(subjectExtractors),
new ChainExtractor(sessionExtractors), new ChainExtractor(aaExtractors));
public CompositeDicomObjectIdentifier(final DicomProjectIdentifier identifier,
final Iterable<Extractor> subjectExtractors,
final Iterable<Extractor> sessionExtractors,
final Iterable<Extractor> aaExtractors) {
this(identifier,
new ChainExtractor(subjectExtractors),
new ChainExtractor(sessionExtractors),
new ChainExtractor(aaExtractors));
}
private UserI user = null;
private Provider<UserI> userProvider = null;
/*
* (non-Javadoc)
* @see org.nrg.xnat.DicomObjectIdentifier#getProject(org.dcm4che2.data.DicomObject)
*/
public final XnatProjectdata getProject(final DicomObject o) {
if (null == user && null != userProvider) {
user = userProvider.get();
}
return projectID.apply(user, o);
if (null == user && null != userProvider) {
user = userProvider.get();
}
return _identifier.apply(user, o);
}
/*
* (non-Javadoc)
* @see org.nrg.xnat.DicomObjectIdentifier#getSessionLabel(org.dcm4che2.data.DicomObject)
*/
public final String getSessionLabel(final DicomObject o) {
return Labels.toLabelChars(sessionExtractor.extract(o));
return Labels.toLabelChars(_sessionExtractor.extract(o));
}
/*
* (non-Javadoc)
* @see org.nrg.xnat.DicomObjectIdentifier#getSubjectLabel(org.dcm4che2.data.DicomObject)
*/
public final String getSubjectLabel(final DicomObject o) {
return Labels.toLabelChars(subjectExtractor.extract(o));
return Labels.toLabelChars(_subjectExtractor.extract(o));
}
/*
......@@ -90,18 +77,18 @@ DicomObjectIdentifier<XnatProjectdata> {
* @see org.nrg.xnat.DicomObjectIdentifier#getTags()
*/
public final ImmutableSortedSet<Integer> getTags() {
return tags;
if (!_initialized) {
initialize();
}
return ImmutableSortedSet.copyOf(_tags);
}
private static final Pattern TRUE = Pattern.compile("t(?:rue)?", Pattern.CASE_INSENSITIVE);
private static final Pattern FALSE = Pattern.compile("f(?:alse)?", Pattern.CASE_INSENSITIVE);
/*
* (non-Javadoc)
* @see org.nrg.xnat.DicomObjectIdentifier#requestsAutoarchive(org.dcm4che2.data.DicomObject)
*/
public final Boolean requestsAutoarchive(DicomObject o) {
final String aa = aaExtractor.extract(o);
final String aa = _aaExtractor.extract(o);
if (null == aa) {
return null;
} else if (TRUE.matcher(aa).matches()) {
......@@ -112,12 +99,33 @@ DicomObjectIdentifier<XnatProjectdata> {
return null;
}
}
public final void setUser(final UserI user) {
this.user = user;
}
public final void setUserProvider(final Provider<UserI> userProvider) {
this.userProvider = userProvider;
}
private void initialize() {
ImmutableSortedSet.Builder<Integer> builder = ImmutableSortedSet.naturalOrder();
builder.addAll(_identifier.getTags());
builder.addAll(_aaExtractor.getTags());
builder.addAll(_sessionExtractor.getTags());
builder.addAll(_subjectExtractor.getTags());
_tags.addAll(builder.build());
_initialized = true;
}
private static final Pattern TRUE = Pattern.compile("t(?:rue)?", Pattern.CASE_INSENSITIVE);
private static final Pattern FALSE = Pattern.compile("f(?:alse)?", Pattern.CASE_INSENSITIVE);
private UserI user = null;
private Provider<UserI> userProvider = null;
private final DicomProjectIdentifier _identifier;
private final Extractor _subjectExtractor, _sessionExtractor, _aaExtractor;
private final SortedSet<Integer> _tags = new TreeSet<>();
private boolean _initialized = false;
}
......@@ -10,11 +10,10 @@
package org.nrg.dcm.id;
import java.util.SortedSet;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSortedSet;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
import org.dcm4che2.data.DicomObject;
import org.nrg.xdat.om.XnatProjectdata;
import org.nrg.xft.security.UserI;
......@@ -23,27 +22,22 @@ import org.nrg.xnat.helpers.prearchive.PrearcUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Lists;
public class DbBackedProjectIdentifier implements DicomProjectIdentifier {
private final Logger logger = LoggerFactory.getLogger(DbBackedProjectIdentifier.class);
private final Iterable<DicomDerivedString> extractors;
private final ImmutableSortedSet<Integer> tags;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
public DbBackedProjectIdentifier(final Iterable<DicomDerivedString> identifiers) {
this.extractors = Lists.newArrayList(identifiers);
final ImmutableSortedSet.Builder<Integer> b = ImmutableSortedSet.naturalOrder();
for (final DicomObjectFunction f : identifiers) {
b.addAll(f.getTags());
}
tags = b.build();
public abstract class DbBackedProjectIdentifier implements DicomProjectIdentifier {
public DbBackedProjectIdentifier() {
_log.debug("Creating DbBackedProjectIdentifier object with default constructor.");
}
public final XnatProjectdata apply(final UserI user, final DicomObject o) {
if (!_initialized) {
initialize();
}
final Cache cache = GradualDicomImporter.getUserProjectCache(user);
for (final DicomDerivedString extractor : extractors) {
for (final DicomDerivedString extractor : _extractors) {
final String alias = extractor.apply(o);
if (!Strings.isNullOrEmpty(alias)) {
// added caching here to prevent duplicate project queries in every file transaction
......@@ -51,31 +45,52 @@ public class DbBackedProjectIdentifier implements DicomProjectIdentifier {
final Element pe = cache.get(alias);
if (null == pe) {
// no cached value, look in the db
final XnatProjectdata p = XnatProjectdata.getProjectByIDorAlias(alias.toString(), user, false);
if (null != p && canCreateIn(user,p)) {
final XnatProjectdata p = XnatProjectdata.getProjectByIDorAlias(alias, user, false);
if (null != p && canCreateIn(user, p)) {
cache.put(new Element(alias, p));
return p;
} else {
// this alias is either not a project or not one we can write to
GradualDicomImporter.cacheNonWriteableProject(cache, alias);
}
}
} else if (!GradualDicomImporter.isCachedNotWriteableProject(pe)) {
return (XnatProjectdata)pe.getObjectValue();
} // else cache returned no-such-writeable-project, so continue
return (XnatProjectdata) pe.getObjectValue();
} // else cache returned no-such-writable-project, so continue
}
}
return null;
}
public SortedSet<Integer> getTags() {
if (!_initialized) {
initialize();
}
return ImmutableSortedSet.copyOf(_tags);
}
abstract protected List<DicomDerivedString> getIdentifiers();
private synchronized void initialize() {
_extractors.clear();
_tags.clear();
for (final DicomDerivedString function : getIdentifiers()) {
_extractors.add(function);
_tags.addAll(function.getTags());
}
_initialized = true;
}
private boolean canCreateIn(final UserI user, final XnatProjectdata p) {
try {
return PrearcUtils.canModify(user, p.getId());
} catch (Exception e) {
logger.error("Unable to check permissions for " + user + " in " + p, e);
_log.error("Unable to check permissions for " + user + " in " + p, e);
return false;
}
}
public final SortedSet<Integer> getTags() { return tags; }
private final Logger _log = LoggerFactory.getLogger(DbBackedProjectIdentifier.class);
private final List<DicomDerivedString> _extractors = new ArrayList<>();
private final SortedSet<Integer> _tags = new TreeSet<>();
private boolean _initialized = false;
}
......@@ -28,15 +28,9 @@ import java.util.regex.Pattern;
class Xnat15DicomProjectIdentifier extends DbBackedProjectIdentifier {
private static final String DICOM_PROJECT_RULES = "dicom-project.rules";
Xnat15DicomProjectIdentifier() {
super(getIdentifiers());
}
private static Logger slog() {
return LoggerFactory.getLogger(Xnat15DicomProjectIdentifier.class);
}
private static final Logger _log = LoggerFactory.getLogger(Xnat15DicomProjectIdentifier.class);
private static List<DicomDerivedString> getIdentifiers() {
protected List<DicomDerivedString> getIdentifiers() {
final List<DicomDerivedString> identifiers = Lists.newArrayList();
identifiers.add(new ContainedAssignmentDicomIdentifier(Tag.PatientComments, "Project", Pattern.CASE_INSENSITIVE));
identifiers.add(new ContainedAssignmentDicomIdentifier(Tag.StudyComments, "Project", Pattern.CASE_INSENSITIVE));
......@@ -73,19 +67,16 @@ class Xnat15DicomProjectIdentifier extends DbBackedProjectIdentifier {
} catch (FileNotFoundException ignored) {
//
} catch (IOException e) {
slog().error("An error occurred trying to open the DICOM project rules configuration", e);
_log.error("An error occurred trying to open the DICOM project rules configuration", e);
}
}
private static final Pattern CUSTOM_RULE_PATTERN = Pattern.compile("\\((\\p{XDigit}{4})\\,(\\p{XDigit}{4})\\):(.+?)(?::(\\d+))?");
private static final DicomDerivedString parseRule(final String rule) {
private static DicomDerivedString parseRule(final String rule) {
final Matcher matcher = CUSTOM_RULE_PATTERN.matcher(rule);
if (matcher.matches()) {
final StringBuilder tagsb = new StringBuilder("0x");
tagsb.append(matcher.group(1)).append(matcher.group(2));
final int tag = Integer.decode(tagsb.toString());
final int tag = Integer.decode("0x" + matcher.group(1) + matcher.group(2));
final String regexp = matcher.group(3);
final String groupIdx = matcher.group(4);
final int group = null == groupIdx ? 1 : Integer.parseInt(groupIdx);
......
package org.nrg.xnat.configuration;
import org.apache.commons.lang.StringUtils;
import org.nrg.config.exceptions.SiteConfigurationException;
import org.nrg.framework.services.ContextService;
import org.nrg.xdat.XDAT;
import org.nrg.xdat.preferences.InitializerSiteConfiguration;
import org.nrg.xdat.preferences.NotificationsPreferences;
import org.nrg.xdat.preferences.SiteConfigPreferences;
import org.nrg.xdat.security.*;
import org.nrg.xdat.security.HistoricPasswordValidator;
import org.nrg.xdat.security.PasswordValidatorChain;
import org.nrg.xdat.security.RegExpValidator;
import org.nrg.xdat.security.XDATUserMgmtServiceImpl;
import org.nrg.xdat.security.services.UserManagementServiceI;
import org.nrg.xdat.services.ThemeService;
import org.nrg.xdat.services.impl.ThemeServiceImpl;
......@@ -19,7 +20,10 @@ import org.nrg.xnat.utils.XnatUserProvider;
import org.springframework.context.annotation.*;
import javax.inject.Inject;
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@Configuration
@ComponentScan({"org.nrg.automation.repositories", "org.nrg.config.daos", "org.nrg.dcm.xnat", "org.nrg.dicomtools.filters",
......@@ -79,9 +83,8 @@ public class ApplicationConfig {
}
@Bean
public PasswordValidatorChain validator(final RegExpValidator regExpValidator, final HistoricPasswordValidator historicPasswordValidator) {
public PasswordValidatorChain validator() {
return new PasswordValidatorChain();
}
// MIGRATION: I'm not even sure this is used, but we need to do away with it in favor of prefs.
......@@ -98,12 +101,12 @@ public class ApplicationConfig {
@Bean
public XnatRestletExtensions xnatRestletExtensions() {
return new XnatRestletExtensions(new HashSet<>(Arrays.asList(new String[]{"org.nrg.xnat.restlet.extensions"})));
return new XnatRestletExtensions(new HashSet<>(Arrays.asList(new String[] {"org.nrg.xnat.restlet.extensions"})));
}
@Bean
public ImporterHandlerPackages importerHandlerPackages() {
return new ImporterHandlerPackages(new HashSet<>(Arrays.asList(new String[]{"org.nrg.xnat.restlet.actions", "org.nrg.xnat.archive"})));
return new ImporterHandlerPackages(new HashSet<>(Arrays.asList(new String[] {"org.nrg.xnat.restlet.actions", "org.nrg.xnat.archive"})));
}
@Inject
......
......@@ -9,11 +9,8 @@ import org.nrg.xdat.preferences.PreferenceEvent;
import org.nrg.xnat.helpers.prearchive.SessionXMLRebuilder;
import org.nrg.xnat.security.ResetEmailRequests;
import org.nrg.xnat.utils.XnatUserProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
......@@ -28,48 +25,10 @@ import java.util.List;
@Configuration
@EnableScheduling
public class SchedulerConfig implements SchedulingConfigurer {
// @Bean
// public TriggerTask disableInactiveUsers() throws SiteConfigurationException {
// try {
// final DisableInactiveUsers task = new DisableInactiveUsers(_preferences.getInactivityBeforeLockout(), (int) SiteConfigPreferences.convertPGIntervalToSeconds(_preferences.getMaxFailedLoginsLockoutDuration()));
// return new TriggerTask(task, new CronTrigger(_preferences.getInactivityBeforeLockoutSchedule()));
// } catch (SQLException e) {
// // This isn't a real thing: PGInterval doesn't actually access the database. But just to make everyone happy...
// throw new NrgServiceRuntimeException(NrgServiceError.Unknown, "This really shouldn't happen.", e);
// }
// }
// @Bean
// public TriggerTask resetFailedLogins() throws SiteConfigurationException {
// return new TriggerTask(new ResetFailedLogins(_template, _preferences.getMaxFailedLoginsLockoutDuration()), new PeriodicTrigger(900000));
// }
@Bean
public TriggerTask resetEmailRequests() {
return new TriggerTask(new ResetEmailRequests(_emailRequestLogService), new PeriodicTrigger(900000));
}
//
// @Bean
// public TriggerTask clearExpiredAliasTokens() throws SiteConfigurationException {
// return new TriggerTask(new ClearExpiredAliasTokens(_template), new Trigger() {
// @Override public Date nextExecutionTime(TriggerContext triggerContext) {
// Calendar nextExecutionTime = new GregorianCalendar();
// Date lastActualExecutionTime = triggerContext.lastActualExecutionTime();
// nextExecutionTime.setTime(lastActualExecutionTime != null ? lastActualExecutionTime : new Date());
// long expirationInterval = XDAT.getSiteConfigPreferences().getAliasTokenTimeout();
// if(expirationInterval<120){//Check every minute if interval is 2 hours or less
// nextExecutionTime.add(Calendar.MINUTE, 1);
// }
// else if(expirationInterval<2880){//Check every hour if interval is 2 days or less
// nextExecutionTime.add(Calendar.HOUR, 1);
// }
// else{//Check every day
// nextExecutionTime.add(Calendar.DAY_OF_MONTH, 1);
// }
// return nextExecutionTime.getTime();
// }
// });
// }
@Bean
public TriggerTask rebuildSessionXmls() throws SiteConfigurationException {
......@@ -80,17 +39,14 @@ public class SchedulerConfig implements SchedulingConfigurer {
@Bean(destroyMethod = "shutdown")
public ThreadPoolTaskScheduler taskScheduler() {
return new ThreadPoolTaskScheduler();
final ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setRemoveOnCancelPolicy(true);
return scheduler;
}
@Override
public void configureTasks(final ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.setScheduler(taskScheduler());
// taskRegistrar.addTriggerTask(resetFailedLogins());
// taskRegistrar.addTriggerTask(disableInactiveUsers());
// taskRegistrar.addTriggerTask(resetEmailRequests());
// taskRegistrar.addTriggerTask(clearExpiredAliasTokens());
// taskRegistrar.addTriggerTask(rebuildSessionXmls());
_eventService.triggerEvent(new PreferenceEvent("aliasTokenTimeout", String.valueOf(XDAT.getSiteConfigPreferences().getAliasTokenTimeout())));
_eventService.triggerEvent(new PreferenceEvent("inactivityBeforeLockout", String.valueOf(XDAT.getSiteConfigPreferences().getInactivityBeforeLockout())));
_eventService.triggerEvent(new PreferenceEvent("maxFailedLoginsLockoutDuration", String.valueOf(XDAT.getSiteConfigPreferences().getMaxFailedLoginsLockoutDuration())));
......@@ -106,10 +62,6 @@ public class SchedulerConfig implements SchedulingConfigurer {
@Inject
private EmailRequestLogService _emailRequestLogService;
@Autowired
@Lazy
private JdbcTemplate _template;
@Inject
private XnatUserProvider _provider;
......
......@@ -32,22 +32,18 @@ public class AliasTokenPreferenceHandlerMethod extends AbstractSiteConfigPrefere
@Override
public void handlePreference(final String preference, final String value) {
if(PREFERENCES.contains(preference)){
if (PREFERENCES.contains(preference)) {
updateAliasTokenTimeout();
}
}
private void updateAliasTokenTimeout(){
private void updateAliasTokenTimeout() {
try {
_scheduler.getScheduledThreadPoolExecutor().setRemoveOnCancelPolicy(true);
Iterator<Runnable> iter = _scheduler.getScheduledThreadPoolExecutor().getQueue().iterator();
for(ScheduledFuture temp: scheduledAliasTokenTimeouts){
temp.cancel(false);
for (final ScheduledFuture future : _timeouts) {
future.cancel(false);
}
scheduledAliasTokenTimeouts.add(_scheduler.schedule(new ClearExpiredAliasTokens(_template), new CronTrigger(XDAT.getSiteConfigPreferences().getAliasTokenTimeoutSchedule())));
_timeouts.clear();
_timeouts.add(_scheduler.schedule(new ClearExpiredAliasTokens(_template), new CronTrigger(XDAT.getSiteConfigPreferences().getAliasTokenTimeoutSchedule())));
} catch (Exception e1) {
_log.error("", e1);
}
......@@ -60,7 +56,7 @@ public class AliasTokenPreferenceHandlerMethod extends AbstractSiteConfigPrefere
@Lazy
private JdbcTemplate _template;
private ArrayList<ScheduledFuture> scheduledAliasTokenTimeouts = new ArrayList<>();
private ArrayList<ScheduledFuture> _timeouts = new ArrayList<>();
@Autowired
@Qualifier("taskScheduler")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment