List of usage examples for org.apache.commons.lang3.time DateUtils MILLIS_PER_MINUTE
long MILLIS_PER_MINUTE
To view the source code for org.apache.commons.lang3.time DateUtils MILLIS_PER_MINUTE.
Click Source Link
From source file:ca.uhn.fhir.jpa.term.BaseHapiTerminologySvc.java
private void processReindexing() { if (System.currentTimeMillis() < myNextReindexPass) { return;//from w ww. j a v a 2 s.c o m } TransactionTemplate tt = new TransactionTemplate(myTransactionMgr); tt.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); tt.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus theArg0) { int maxResult = 1000; Page<TermConcept> resources = myConceptDao .findResourcesRequiringReindexing(new PageRequest(0, maxResult)); if (resources.hasContent() == false) { myNextReindexPass = System.currentTimeMillis() + DateUtils.MILLIS_PER_MINUTE; return; } ourLog.info("Indexing {} / {} concepts", resources.getContent().size(), resources.getTotalElements()); int count = 0; StopWatch stopwatch = new StopWatch(); for (TermConcept resourceTable : resources) { saveConcept(resourceTable); count++; } ourLog.info("Indexed {} / {} concepts in {}ms - Avg {}ms / resource", new Object[] { count, resources.getContent().size(), stopwatch.getMillis(), stopwatch.getMillisPerOperation(count) }); } }); }
From source file:de.tor.tribes.ui.wiz.ret.RetimerCalculationPanel.java
private List<Attack> getRetimesForVillage(Attack pAttack, VillageTroopsHolder pHolder) { List<Attack> results = new LinkedList<>(); Village target = pAttack.getSource(); Village source = pHolder.getVillage(); long returnTime = pAttack.getReturnTime().getTime(); List<UnitHolder> units = pHolder.getTroops().getContainedUnits(null); Collections.sort(units, UnitHolder.RUNTIME_COMPARATOR); for (int i = units.size() - 1; i >= 0; i--) { UnitHolder unit = units.get(i);//from w ww . j a v a2s .c o m if (unit.isRetimeUnit()) { notifyStatusUpdate(" - Teste Einheit '" + unit.getName() + "'"); long sendTime = returnTime - DSCalculator.calculateMoveTimeInMillis(source, target, unit.getSpeed()); if (sendTime > System.currentTimeMillis() + DateUtils.MILLIS_PER_MINUTE) { boolean allowFromSame = true; if (source.getId() == pAttack.getTarget().getId()) { if (sendTime < pAttack.getArriveTime().getTime() + DateUtils.MILLIS_PER_MINUTE) { notifyStatusUpdate( " - Angriffsziel und Retime-Herkunft identisch, Abschickzeit zu nah an Ankunft"); allowFromSame = false; } } if (allowFromSame) { notifyStatusUpdate(" - Einheit fr Retime geeignet"); Attack a = new Attack(); a.setSource(source); a.setTarget(target); a.setUnit(unit); a.setSendTime(new Date(sendTime)); a.setType(Attack.CLEAN_TYPE); a.setTroopsByType(); results.add(a); } } } } return results; }
From source file:com.nridge.core.app.mgr.AppMgr.java
/** * Loads the default property files ("application.properties" and * "logback.xml") from the file system and assigns default application * properties./*from w ww . j a v a 2 s . c o m*/ * <p> * <b>Note:</b> This method will establish a default 5 minute reloading * policy for the "application.properties" file. Therefore, any * changes to this property file while the application is running * will be recognized within a 5 minute period. * </p> * * @throws NSException Typically thrown for I/O related issues. */ public void loadPropertyFiles() throws NSException { String logFileName; try { // First, we will read our application properties. mConfiguration = new CompositeConfiguration(); mConfiguration.setDelimiterParsingDisabled(true); mConfiguration.addConfiguration(new SystemConfiguration()); mConfiguration.addConfiguration(new EnvironmentConfiguration()); PropertiesConfiguration propertyCfg = new PropertiesConfiguration(deriveCfgPathFileName()); FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy(); reloadingStrategy.setRefreshDelay(DateUtils.MILLIS_PER_MINUTE * 2L); propertyCfg.setReloadingStrategy(reloadingStrategy); mConfiguration.addConfiguration(propertyCfg); // Next, we will load our Logback properties file and configure our application logger. if (mCmdLine == null) logFileName = LOG_PROPERTY_FILE_NAME; else logFileName = mCmdLine.getOptionValue("logfile", LOG_PROPERTY_FILE_NAME); File logFile = new File(logFileName); if (!logFile.exists()) { String logPathFileName = String.format("%s%c%s", deriveCfgPathName(), File.separatorChar, logFileName); logFile = new File(logPathFileName); if (logFile.exists()) logFileName = logPathFileName; else throw new NSException("Unable to locate logging properties file: " + logFileName); } if (StringUtils.isEmpty(getString(APP_PROPERTY_INS_PATH))) mConfiguration.addProperty(APP_PROPERTY_INS_PATH, getInsPathName()); if (StringUtils.isEmpty(getString(APP_PROPERTY_CFG_PATH))) mConfiguration.addProperty(APP_PROPERTY_CFG_PATH, deriveCfgPathName()); if (StringUtils.isEmpty(getString(APP_PROPERTY_LOG_PATH))) mConfiguration.addProperty(APP_PROPERTY_LOG_PATH, deriveLogPathName()); if (StringUtils.isEmpty(getString(APP_PROPERTY_DS_PATH))) mConfiguration.addProperty(APP_PROPERTY_DS_PATH, deriveDSPathName()); if (StringUtils.isEmpty(getString(APP_PROPERTY_RDB_PATH))) mConfiguration.addProperty(APP_PROPERTY_RDB_PATH, deriveRDBMSPathName()); if (StringUtils.isEmpty(getString(APP_PROPERTY_GDB_PATH))) mConfiguration.addProperty(APP_PROPERTY_GDB_PATH, deriveGraphPathName()); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); JoranConfigurator joranConfigurator = new JoranConfigurator(); joranConfigurator.setContext(loggerContext); loggerContext.reset(); joranConfigurator.doConfigure(logFileName); } catch (ConfigurationException e) { throw new NSException("Configuration parsing error: " + e.getMessage()); } catch (JoranException e) { throw new NSException("Logback parsing error: " + e.getMessage()); } catch (ClassCastException ignored) { /* Note that a WARNING related to java.lang.ClassCastException will trigger due to Smart GWT and NSD being dependent on different releases of the same logging framework. http://www.slf4j.org/codes.html */ } }
From source file:org.apache.eagle.security.auditlog.AbstractHdfsAuditLogApplication.java
public static PartitionStrategy createStrategy(Config config) { // TODO: Refactor configuration structure to avoid repeated config processing configure ~ hao String host = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.HOST); Integer port = config.getInt(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PORT); String username = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME); String password = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD); String topic = config.getString("dataSourceConfig.topic"); DataDistributionDao dao = new DataDistributionDaoImpl(host, port, username, password, topic); PartitionAlgorithm algorithm = new GreedyPartitionAlgorithm(); String key1 = EagleConfigConstants.EAGLE_PROPS + ".partitionRefreshIntervalInMin"; Integer partitionRefreshIntervalInMin = config.hasPath(key1) ? config.getInt(key1) : 60; String key2 = EagleConfigConstants.EAGLE_PROPS + ".kafkaStatisticRangeInMin"; Integer kafkaStatisticRangeInMin = config.hasPath(key2) ? config.getInt(key2) : 60; PartitionStrategy strategy = new PartitionStrategyImpl(dao, algorithm, partitionRefreshIntervalInMin * DateUtils.MILLIS_PER_MINUTE, kafkaStatisticRangeInMin * DateUtils.MILLIS_PER_MINUTE); return strategy; }
From source file:suonos.models.MTime.java
public MTime(int mtime) { super(DateUtils.MILLIS_PER_MINUTE * mtime); }
From source file:suonos.models.MTime.java
public static int fromTime(long time) { return (int) (time / DateUtils.MILLIS_PER_MINUTE); }