当前位置: 首页>>代码示例>>Java>>正文


Java TimeUnit.MINUTES属性代码示例

本文整理汇总了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 );

	}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:26,代码来源:LogRollerRunnable.java

示例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;
        }
    }
}
 
开发者ID:teamdigitale,项目名称:ontonethub,代码行数:27,代码来源:PrefixccProviderComponent.java

示例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);
}
 
开发者ID:Superioz,项目名称:MooProject,代码行数:28,代码来源:TimeUtil.java

示例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
    );
}
 
开发者ID:indeedeng-alpha,项目名称:indeed-grpc-java,代码行数:14,代码来源:ConsulNameResolver.java

示例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);
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:7,代码来源:BaseExecutorGuiceModule.java

示例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);
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:11,代码来源:ALSServingModelManager.java

示例7: GithubChangesJob

public GithubChangesJob(AvaIre avaire) {
    super(avaire, 30, 75, TimeUnit.MINUTES);

    if (!avaire.getCache().getAdapter(CacheType.FILE).has("github.commits")) {
        run();
    }
}
 
开发者ID:avaire,项目名称:avaire,代码行数:7,代码来源:GithubChangesJob.java

示例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;
}
 
开发者ID:alibaba,项目名称:jetcache,代码行数:36,代码来源:DefaultCacheMonitorManager.java

示例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);
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:36,代码来源:TimeOutSaverLoader.java

示例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 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:9,代码来源:Hive.java

示例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);
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:7,代码来源:MediaMuxerWraper.java

示例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));
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:32,代码来源:CacheBuilderSpec.java

示例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$
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:ServiceImpl.java

示例14: ThreadPool

public ThreadPool(int threadCount, long keepAliveTime, boolean isGridMode) {
    super(threadCount, threadCount, keepAliveTime, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>());
    doSelectiveThreading = threadCount > 1 && !isGridMode;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:4,代码来源:ThreadPool.java

示例15:

@LifeCache(duration = 2, timeUnit = TimeUnit.MINUTES)
Observable<Reply<List<User>>> getUsers(Observable<List<User>> users, DynamicKey idLastUserQueried, EvictProvider evictProvider);
 
开发者ID:hshare,项目名称:MVPArmsTest1,代码行数:2,代码来源:CommonCache.java


注:本文中的java.util.concurrent.TimeUnit.MINUTES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。