本文整理匯總了Java中org.easyrec.utils.io.autoimport.AutoImportTimerTask類的典型用法代碼示例。如果您正苦於以下問題:Java AutoImportTimerTask類的具體用法?Java AutoImportTimerTask怎麽用?Java AutoImportTimerTask使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AutoImportTimerTask類屬於org.easyrec.utils.io.autoimport包,在下文中一共展示了AutoImportTimerTask類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: activate
import org.easyrec.utils.io.autoimport.AutoImportTimerTask; //導入依賴的package包/類
public void activate() {
if (active == false) {
active = true;
if (autoImportTimer == null) {
autoImportTimer = new Timer();
}
autoImportTask = new AutoImportTimerTask(directory, typeToCommandMap, defaultCommandKeyword);
autoImportTimer.scheduleAtFixedRate(autoImportTask, timeout, timeout);
if (logger.isInfoEnabled()) {
logger.info("scheduled 'AutoImport' every " + timeout + " millis");
}
} else {
if (logger.isInfoEnabled()) {
logger.info("'AutoImport' already running every " + timeout + " millis, activation not necessary");
}
}
}
示例2: AutoImportServiceImpl
import org.easyrec.utils.io.autoimport.AutoImportTimerTask; //導入依賴的package包/類
public AutoImportServiceImpl(boolean active, String directoryPath, long timeout, String defaultCommandKeyword,
HashMap<String, AutoImportCommand> typeToCommandMap) {
this.active = active;
setDirectory(directoryPath);
this.timeout = timeout;
this.defaultCommandKeyword = defaultCommandKeyword;
this.typeToCommandMap = typeToCommandMap;
if (logger.isInfoEnabled()) {
printServiceLogInfo();
}
// schedule the AutoImportTimerTask for the 'AutoImporter'
if (active) {
if (logger.isInfoEnabled()) {
logger.info("'AutoImport' is ACTIVATED");
logger.info("'AutoImport' will poll directory: '" + directory.getAbsoluteFile() + "'");
logger.info("'AutoImport' will be started every '" + timeout + "' ms");
}
// start TimerTask anyway (even if deactivated in spring bean config xml
// file, maybe it will be changed during runtime)
autoImportTimer = new Timer();
autoImportTask = new AutoImportTimerTask(directory, typeToCommandMap, defaultCommandKeyword);
autoImportTask.deleteCurrentRunningFiles();
autoImportTimer.scheduleAtFixedRate(autoImportTask, timeout, timeout);
if (active && logger.isInfoEnabled()) {
logger.info("scheduled 'AutoImport' every " + timeout + " millis");
}
} else {
if (logger.isInfoEnabled()) {
logger.info("'AutoImport' is DEACTIVATED");
}
}
}