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


Java Duration.toMillis方法代码示例

本文整理汇总了Java中io.airlift.units.Duration.toMillis方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.toMillis方法的具体用法?Java Duration.toMillis怎么用?Java Duration.toMillis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.airlift.units.Duration的用法示例。


在下文中一共展示了Duration.toMillis方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNextPage

import io.airlift.units.Duration; //导入方法依赖的package包/类
@Nullable
public Page getNextPage(Duration maxWaitTime)
        throws InterruptedException
{
    checkState(!Thread.holdsLock(this), "Can not get next page while holding a lock on this");

    throwIfFailed();

    if (closed.get()) {
        return null;
    }

    scheduleRequestIfNecessary();

    Page page = pageBuffer.poll();
    // only wait for a page if we have remote clients
    if (page == null && maxWaitTime.toMillis() >= 1 && !allClients.isEmpty()) {
        page = pageBuffer.poll(maxWaitTime.toMillis(), TimeUnit.MILLISECONDS);
    }

    page = postProcessPage(page);
    return page;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:ExchangeClient.java

示例2: toMillis

import io.airlift.units.Duration; //导入方法依赖的package包/类
private static Long toMillis(Duration duration)
{
    if (duration == null) {
        return null;
    }
    return duration.toMillis();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:TaskSystemTable.java

示例3: getTaskInfo

import io.airlift.units.Duration; //导入方法依赖的package包/类
@GET
@Path("{taskId}")
@Produces(MediaType.APPLICATION_JSON)
public void getTaskInfo(@PathParam("taskId") final TaskId taskId,
        @HeaderParam(PRESTO_CURRENT_STATE) TaskState currentState,
        @HeaderParam(PRESTO_MAX_WAIT) Duration maxWait,
        @Context UriInfo uriInfo,
        @Suspended AsyncResponse asyncResponse)
{
    requireNonNull(taskId, "taskId is null");

    if (currentState == null || maxWait == null) {
        TaskInfo taskInfo = taskManager.getTaskInfo(taskId);
        if (shouldSummarize(uriInfo)) {
            taskInfo = taskInfo.summarize();
        }
        asyncResponse.resume(taskInfo);
        return;
    }

    CompletableFuture<TaskInfo> futureTaskInfo = addTimeout(
            taskManager.getTaskInfo(taskId, currentState),
            () -> taskManager.getTaskInfo(taskId),
            maxWait,
            timeoutExecutor);

    if (shouldSummarize(uriInfo)) {
        futureTaskInfo = futureTaskInfo.thenApply(TaskInfo::summarize);
    }

    // For hard timeout, add an additional 5 seconds to max wait for thread scheduling contention and GC
    Duration timeout = new Duration(maxWait.toMillis() + 5000, MILLISECONDS);
    bindAsyncResponse(asyncResponse, futureTaskInfo, responseExecutor)
            .withTimeout(timeout);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:36,代码来源:TaskResource.java

示例4: durationToMillis

import io.airlift.units.Duration; //导入方法依赖的package包/类
@Nullable
private static Long durationToMillis(@Nullable Duration duration)
{
    if (duration == null) {
        return null;
    }
    return duration.toMillis();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:SplitCompletionEvent.java

示例5: maxTimestamp

import io.airlift.units.Duration; //导入方法依赖的package包/类
private static Timestamp maxTimestamp(Duration duration)
{
    return new Timestamp(System.currentTimeMillis() - duration.toMillis());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:5,代码来源:ShardCleaner.java

示例6: HttpRemoteTask

import io.airlift.units.Duration; //导入方法依赖的package包/类
public HttpRemoteTask(Session session,
        TaskId taskId,
        String nodeId,
        int partition,
        URI location,
        PlanFragment planFragment,
        Multimap<PlanNodeId, Split> initialSplits,
        OutputBuffers outputBuffers,
        HttpClient httpClient,
        Executor executor,
        ScheduledExecutorService errorScheduledExecutor,
        Duration minErrorDuration,
        Duration refreshMaxWait,
        JsonCodec<TaskInfo> taskInfoCodec,
        JsonCodec<TaskUpdateRequest> taskUpdateRequestCodec,
        PartitionedSplitCountTracker partitionedSplitCountTracker)
{
    requireNonNull(session, "session is null");
    requireNonNull(taskId, "taskId is null");
    requireNonNull(nodeId, "nodeId is null");
    requireNonNull(location, "location is null");
    checkArgument(partition >= 0, "partition is negative");
    requireNonNull(planFragment, "planFragment1 is null");
    requireNonNull(outputBuffers, "outputBuffers is null");
    requireNonNull(httpClient, "httpClient is null");
    requireNonNull(executor, "executor is null");
    requireNonNull(taskInfoCodec, "taskInfoCodec is null");
    requireNonNull(taskUpdateRequestCodec, "taskUpdateRequestCodec is null");
    requireNonNull(partitionedSplitCountTracker, "partitionedSplitCountTracker is null");

    try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
        this.taskId = taskId;
        this.session = session;
        this.nodeId = nodeId;
        this.partition = partition;
        this.planFragment = planFragment;
        this.outputBuffers.set(outputBuffers);
        this.httpClient = httpClient;
        this.executor = executor;
        this.errorScheduledExecutor = errorScheduledExecutor;
        this.taskInfoCodec = taskInfoCodec;
        this.taskUpdateRequestCodec = taskUpdateRequestCodec;
        this.updateErrorTracker = new RequestErrorTracker(taskId, location, minErrorDuration, errorScheduledExecutor, "updating task");
        this.getErrorTracker = new RequestErrorTracker(taskId, location, minErrorDuration, errorScheduledExecutor, "getting info for task");
        this.partitionedSplitCountTracker = requireNonNull(partitionedSplitCountTracker, "partitionedSplitCountTracker is null");

        for (Entry<PlanNodeId, Split> entry : requireNonNull(initialSplits, "initialSplits is null").entries()) {
            ScheduledSplit scheduledSplit = new ScheduledSplit(nextSplitId.getAndIncrement(), entry.getValue());
            pendingSplits.put(entry.getKey(), scheduledSplit);
        }
        if (initialSplits.containsKey(planFragment.getPartitionedSource())) {
            pendingSourceSplitCount = initialSplits.get(planFragment.getPartitionedSource()).size();
        }

        List<BufferInfo> bufferStates = outputBuffers.getBuffers()
                .keySet().stream()
                .map(outputId -> new BufferInfo(outputId, false, 0, 0, PageBufferInfo.empty()))
                .collect(toImmutableList());

        TaskStats taskStats = new TaskStats(DateTime.now(), null);

        taskInfo = new StateMachine<>("task " + taskId, executor, new TaskInfo(
                taskId,
                "",
                TaskInfo.MIN_VERSION,
                TaskState.PLANNED,
                location,
                DateTime.now(),
                new SharedBufferInfo(BufferState.OPEN, true, true, 0, 0, 0, 0, bufferStates),
                ImmutableSet.<PlanNodeId>of(),
                taskStats,
                ImmutableList.<ExecutionFailureInfo>of()));

        long timeout = minErrorDuration.toMillis() / 3;
        requestTimeout = new Duration(timeout + refreshMaxWait.toMillis(), MILLISECONDS);
        continuousTaskInfoFetcher = new ContinuousTaskInfoFetcher(refreshMaxWait);

        partitionedSplitCountTracker.setPartitionedSplitCount(getPartitionedSplitCount());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:81,代码来源:HttpRemoteTask.java

示例7: SimulationSplit

import io.airlift.units.Duration; //导入方法依赖的package包/类
private SimulationSplit(Duration requiredProcessTime, Duration processTimePerCall)
{
    this.requiredProcessMillis = requiredProcessTime.toMillis();
    this.processMillisPerCall = processTimePerCall.toMillis();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:6,代码来源:TaskExecutorSimulator.java


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