本文整理汇总了Java中java.util.concurrent.TimeUnit.MINUTES属性的典型用法代码示例。如果您正苦于以下问题:Java TimeUnit.MINUTES属性的具体用法?Java TimeUnit.MINUTES怎么用?Java TimeUnit.MINUTES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.util.concurrent.TimeUnit
的用法示例。
在下文中一共展示了TimeUnit.MINUTES属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LogRollerRunnable
public LogRollerRunnable( Application csapApp ) {
this.csapApp = csapApp;
long initialDelay = 5;
long interval = csapApp.lifeCycleSettings().getLogRotationMinutes();
TimeUnit logRotationTimeUnit = TimeUnit.MINUTES;
if ( Application.isRunningOnDesktop() ) {
logger.warn( "Setting DESKTOP to seconds" );
logRotationTimeUnit = TimeUnit.SECONDS;
}
logger.warn(
"Scheduling logrotates to be triggered every {} {}. Logs only rotated if size exceeds threshold (default is 10mb)",
interval, logRotationTimeUnit );
ScheduledFuture<?> jobHandle = scheduledExecutorService
.scheduleAtFixedRate(
() -> executeLogRotateForAllServices(),
initialDelay,
interval,
logRotationTimeUnit );
}
示例2: updateProviderState
/**
* uses the {@link #providerProperties} and {@link #offlineMode}
* state to decide if the {@link PrefixccProvider} should be registered as
* a service or not. If the current state is different the desired state it
* creates and register / unregister destroys the {@link #provider<p>
* Consumes: {@link #providerProperties} and {@link #offlineMode}<br>
* Manages: {@link #provider} and {@link #providerRegistration}
*/
private synchronized void updateProviderState(){
if(providerProperties != null && offlineMode == null){ //register
if(providerRegistration == null){
provider = new PrefixccProvider(updateInterval, TimeUnit.MINUTES);
providerRegistration = bc.registerService(
NamespacePrefixProvider.class.getName(), provider, providerProperties);
log.info("registered prefix.cc NamespacePrefixProvider ...");
}
} else { //unregister
if(providerRegistration != null){
providerRegistration.unregister();
log.info("unregistered prefix.cc NamespacePrefixProvider ...");
}
if(provider != null){
provider.close();
provider = null;
}
}
}
示例3: getTime
/**
* Gets the duration and timeunit from string (like 1d or 5h)
*
* @param str The string
* @return The pair with both values
*/
public static Pair<Integer, TimeUnit> getTime(String str) {
if(!Validation.TIME.matches(str)) return null;
String timeUnitStr = str.substring(str.length() - 1, str.length());
int duration = Integer.parseInt(str.substring(0, str.length() - 1));
TimeUnit unit = null;
switch(timeUnitStr) {
case "d":
unit = TimeUnit.DAYS;
break;
case "h":
unit = TimeUnit.HOURS;
break;
case "m":
unit = TimeUnit.MINUTES;
break;
case "s":
unit = TimeUnit.SECONDS;
break;
}
return new Pair<>(duration, unit);
}
示例4: ConsulNameResolver
ConsulNameResolver(
final CatalogClient catalogClient,
final KeyValueClient keyValueClient,
final String serviceName,
final Optional<String> tag,
final Resource<ScheduledExecutorService> timerServiceResource,
final Resource<ExecutorService> executorResource
) {
this(
catalogClient, keyValueClient, serviceName,
tag, timerServiceResource, executorResource,
1, TimeUnit.MINUTES
);
}
示例5: createThreadPool
protected ThreadPoolExecutor createThreadPool(ThreadGroup parentGroup, String name, int minThreadCound,
int maxThreadCount, int queueSize, RejectedExecutionHandler rejectPolicy){
ThreadFactory threadFactory = new NamedThreadFactory(parentGroup, name, true);
BlockingQueue<Runnable> queue = new LinkedBlockingQueue<>(queueSize);
return new ThreadPoolExecutor(minThreadCound, maxThreadCount, 1, TimeUnit.MINUTES, queue, threadFactory,
rejectPolicy);
}
示例6: ALSServingModelManager
public ALSServingModelManager(Config config) {
super(config);
String rescorerProviderClass =
ConfigUtils.getOptionalString(config, "oryx.als.rescorer-provider-class");
rescorerProvider = loadRescorerProviders(rescorerProviderClass);
sampleRate = config.getDouble("oryx.als.sample-rate");
minModelLoadFraction = config.getDouble("oryx.serving.min-model-load-fraction");
Preconditions.checkArgument(sampleRate > 0.0 && sampleRate <= 1.0);
Preconditions.checkArgument(minModelLoadFraction >= 0.0 && minModelLoadFraction <= 1.0);
logRateLimit = new RateLimitCheck(1, TimeUnit.MINUTES);
}
示例7: GithubChangesJob
public GithubChangesJob(AvaIre avaire) {
super(avaire, 30, 75, TimeUnit.MINUTES);
if (!avaire.getCache().getAdapter(CacheType.FILE).has("github.commits")) {
run();
}
}
示例8: computeFirstResetTime
protected static LocalDateTime computeFirstResetTime(LocalDateTime baseTime, int time, TimeUnit unit) {
if (unit != TimeUnit.SECONDS && unit != TimeUnit.MINUTES && unit != TimeUnit.HOURS && unit != TimeUnit.DAYS) {
throw new IllegalArgumentException();
}
LocalDateTime t = baseTime;
switch (unit) {
case DAYS:
t = t.plusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
break;
case HOURS:
if (24 % time == 0) {
t = t.plusHours(time - t.getHour() % time);
} else {
t = t.plusHours(1);
}
t = t.withMinute(0).withSecond(0).withNano(0);
break;
case MINUTES:
if (60 % time == 0) {
t = t.plusMinutes(time - t.getMinute() % time);
} else {
t = t.plusMinutes(1);
}
t = t.withSecond(0).withNano(0);
break;
case SECONDS:
if (60 % time == 0) {
t = t.plusSeconds(time - t.getSecond() % time);
} else {
t = t.plusSeconds(1);
}
t = t.withNano(0);
break;
}
return t;
}
示例9: createFromSaveString
/**
* Creates a TimeOut object from a given, by createSaveString() generated, saveString
* @param s the SaveString
* @return the TimeOut object
*/
public static TimeOut createFromSaveString(String s) {
String [] split = s.split("\n</duration>\n");
Long duration = Long.parseLong(split[0].replace("<duration>\n", ""));
split = split[1].split("\n</timeunit>\n");
TimeUnit timeUnit = TimeUnit.MINUTES;
String timeunit = split[0].replace("<timeunit>\n", "");
switch(timeunit) {
case "MILLISECONDS":
timeUnit = TimeUnit.MILLISECONDS;
break;
case "MINUTES":
timeUnit = TimeUnit.MINUTES;
duration = TimeUnit.MILLISECONDS.toMinutes(duration);
break;
case "SECONDS":
timeUnit = TimeUnit.SECONDS;
duration = TimeUnit.MILLISECONDS.toSeconds(duration);
break;
case "HOURS":
timeUnit = TimeUnit.HOURS;
duration = TimeUnit.MILLISECONDS.toHours(duration);
break;
case "DAYS":
timeUnit = TimeUnit.DAYS;
duration = TimeUnit.MILLISECONDS.toDays(duration);
break;
default:
break;
}
return new TimeOut(timeUnit, duration);
}
示例10: performStart
@Override
protected void performStart () throws Exception
{
this.executor = new ExportedExecutorService ( Hive.class.getName (), 0, 1, 1, TimeUnit.MINUTES );
super.performStart ();
this.factory.setReceiver ( this.configurationReceiver );
}
示例11: MediaMuxerWraper
public MediaMuxerWraper(String path, int format) throws IOException {
mMuxer=new MediaMuxer(path,format);
datas=new LinkedBlockingQueue<>(30);
recycler=new Recycler<>();
ThreadFactory factory= Executors.defaultThreadFactory();
mExec=new ThreadPoolExecutor(1,1,1,TimeUnit.MINUTES,new LinkedBlockingQueue<Runnable>(16),factory);
}
示例12: parse
@Override
public void parse(CacheBuilderSpec spec, String key, String value) {
checkArgument(value != null && !value.isEmpty(), "value of key %s omitted", key);
try {
char lastChar = value.charAt(value.length() - 1);
TimeUnit timeUnit;
switch (lastChar) {
case 'd':
timeUnit = TimeUnit.DAYS;
break;
case 'h':
timeUnit = TimeUnit.HOURS;
break;
case 'm':
timeUnit = TimeUnit.MINUTES;
break;
case 's':
timeUnit = TimeUnit.SECONDS;
break;
default:
throw new IllegalArgumentException(
format(
"key %s invalid format. was %s, must end with one of [dDhHmMsS]", key, value));
}
long duration = Long.parseLong(value.substring(0, value.length() - 1));
parseDuration(spec, duration, timeUnit);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(
format("key %s value set to %s, must be integer", key, value));
}
}
示例13: ServiceImpl
public ServiceImpl ( final ConfigurationAdministrator service, final BundleContext context, final Executor executor ) throws Exception
{
super ( context, executor );
this.service = service;
this.executor = new ExportedExecutorService ( "org.eclipse.scada.ca.server.osgi.ServiceImpl", 1, 1, 1, TimeUnit.MINUTES ); //$NON-NLS-1$
}
示例14: ThreadPool
public ThreadPool(int threadCount, long keepAliveTime, boolean isGridMode) {
super(threadCount, threadCount, keepAliveTime, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>());
doSelectiveThreading = threadCount > 1 && !isGridMode;
}
示例15:
@LifeCache(duration = 2, timeUnit = TimeUnit.MINUTES)
Observable<Reply<List<User>>> getUsers(Observable<List<User>> users, DynamicKey idLastUserQueried, EvictProvider evictProvider);