當前位置: 首頁>>代碼示例>>Java>>正文


Java Duration.milliseconds方法代碼示例

本文整理匯總了Java中io.dropwizard.util.Duration.milliseconds方法的典型用法代碼示例。如果您正苦於以下問題:Java Duration.milliseconds方法的具體用法?Java Duration.milliseconds怎麽用?Java Duration.milliseconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.dropwizard.util.Duration的用法示例。


在下文中一共展示了Duration.milliseconds方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldCompleteRequestIfShutdownPeriodLongerThanLongRunningRequest

import io.dropwizard.util.Duration; //導入方法依賴的package包/類
@Test
public void shouldCompleteRequestIfShutdownPeriodLongerThanLongRunningRequest() throws Exception {
    final Duration shutdownPeriod = Duration.milliseconds(3000L);
    final Duration slowRequestDuration = Duration.milliseconds(1000L);

    testShutdownPeriodHonoured(shutdownPeriod, slowRequestDuration, (requestDurationFut, shutdownDurationFut) -> {
        try {
            final Duration requestDuration =
                    requestDurationFut.get(add(slowRequestDuration, DELTA).toMilliseconds(), TimeUnit.MILLISECONDS);
            assertEqualsWithTolerance(requestDuration, slowRequestDuration, DELTA);
        } catch (final Exception e) {
            throw new RuntimeException(e);
        }
    });
}
 
開發者ID:msteinhoff,項目名稱:dropwizard-grpc,代碼行數:16,代碼來源:GrpcServerTests.java

示例2: shouldHonourShutdownPeriodIfShutdownPeriodShorterThanLongRunningRequest

import io.dropwizard.util.Duration; //導入方法依賴的package包/類
@Test
public void shouldHonourShutdownPeriodIfShutdownPeriodShorterThanLongRunningRequest() throws Exception {
    final Duration shutdownPeriod = Duration.milliseconds(1000L);
    final Duration slowRequestDuration = Duration.milliseconds(3000L);

    testShutdownPeriodHonoured(shutdownPeriod, slowRequestDuration, (requestDurationFut, shutdownDurationFut) -> {
        try {
            final Duration shutdownDuration =
                    shutdownDurationFut.get(add(shutdownPeriod, DELTA).toMilliseconds(), TimeUnit.MILLISECONDS);
            assertEqualsWithTolerance(shutdownPeriod, shutdownDuration, DELTA);
        } catch (final Exception e) {
            throw new RuntimeException(e);
        }
    });
}
 
開發者ID:msteinhoff,項目名稱:dropwizard-grpc,代碼行數:16,代碼來源:GrpcServerTests.java

示例3: MockDistributedLockManager

import io.dropwizard.util.Duration; //導入方法依賴的package包/類
public MockDistributedLockManager(Duration timeout) throws URISyntaxException, StorageException {
    super(mockLockManager(), timeout, Duration.milliseconds(10));
}
 
開發者ID:yammer,項目名稱:backups,代碼行數:4,代碼來源:MockDistributedLockManager.java

示例4: QueryClient

import io.dropwizard.util.Duration; //導入方法依賴的package包/類
public QueryClient(QueryRunner queryRunner, org.joda.time.Duration timeout, String query)
{
    this(queryRunner, Duration.milliseconds(timeout.getMillis()), query);
}
 
開發者ID:airbnb,項目名稱:airpal,代碼行數:5,代碼來源:QueryClient.java


注:本文中的io.dropwizard.util.Duration.milliseconds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。