本文整理匯總了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);
}
});
}
示例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);
}
});
}
示例3: MockDistributedLockManager
import io.dropwizard.util.Duration; //導入方法依賴的package包/類
public MockDistributedLockManager(Duration timeout) throws URISyntaxException, StorageException {
super(mockLockManager(), timeout, Duration.milliseconds(10));
}
示例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);
}