• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Duration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.brooklyn.util.time.Duration的典型用法代码示例。如果您正苦于以下问题:Java Duration类的具体用法?Java Duration怎么用?Java Duration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Duration类属于org.apache.brooklyn.util.time包,在下文中一共展示了Duration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: run

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Override
public void run() {
    boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString()))
            .every(Duration.ONE_SECOND)
            .until(new Callable<Boolean>() {
                @Override
                public Boolean call() throws Exception {
                    final String json = HttpTool.httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers).getContentAsString();
                    final String status = JsonPath.read(json, "$.Requests.request_status");
                    if (!VALID_STATES.contains(status)) {
                        throw new RuntimeException(
                                "Request fails with state " + status +
                                        ". Check here for details " + builder.request.getHref());
                    }
                    return StringUtils.equals(status, "COMPLETED");
                }
            })
            .limitTimeTo(builder.timeout)
            .rethrowExceptionImmediately()
            .run();

    if (!done) {
        throw new RuntimeException(builder.errorMessage);
    }
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:26,代码来源:RequestCheckRunnable.java


示例2: build

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
public RequestCheckRunnable build() {
    Preconditions.checkNotNull(this.request);

    if (this.headers == null) {
        this.headers = ImmutableMap.of();
    }
    if (this.timeout == null) {
        this.timeout = Duration.FIVE_MINUTES;
    }
    if (StringUtils.isEmpty(this.errorMessage)) {
        this.errorMessage = String.format("The request did not finish with the status \"COMPLETED\" or within %s", this.timeout.toString());
    }
    if (this.httpClient == null) {
        this.httpClient = HttpTool.httpClientBuilder().build();
    }

    return new RequestCheckRunnable(this);
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:19,代码来源:RequestCheckRunnable.java


示例3: addHostsToHostGroup

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Override
public void addHostsToHostGroup(final String blueprintName, final String hostgroupName, final List<String> hosts, final String cluster) {
    Iterable<Map> hostGroupMapping = Iterables.transform(hosts, fqdnsToMaps(blueprintName, hostgroupName));
    LOG.info("hosts " + hostGroupMapping.iterator().hasNext());

    HostEndpoint hostEndpoint = restAdapter.create(HostEndpoint.class);
    Request request = hostEndpoint.addHosts(
            cluster,
            Lists.newArrayList(hostGroupMapping));

    RequestCheckRunnable.check(request)
            .headers(ImmutableMap.of(HttpHeaders.AUTHORIZATION, HttpTool.toBasicAuthorizationValue(usernamePasswordCredentials)))
            .timeout(Duration.ONE_HOUR)
            .errorMessage(String.format("Error during adding %s to %s", hosts, hostgroupName))
            .build()
            .run();
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:18,代码来源:AmbariServerImpl.java


示例4: assertNoFires

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
void assertNoFires(final Entity app) {
    EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, Boolean.valueOf(true));
    EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
    Asserts.succeedsEventually(ImmutableMap.of("timeout", Duration.FIVE_MINUTES), new Runnable() {
        public void run() {
            Iterator i$ = Entities.descendants(app).iterator();

            while (i$.hasNext()) {
                Entity entity = (Entity) i$.next();
                Assert.assertNotEquals(entity.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE);
                Assert.assertNotEquals(entity.getAttribute(Attributes.SERVICE_UP), Boolean.valueOf(false));
                if (entity instanceof SoftwareProcess) {
                    EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
                    EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_UP, Boolean.TRUE);
                }
            }

        }
    });
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:21,代码来源:BlueprintTestHelper.java


示例5: testSuccessfulRequestFinishes

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Test
public void testSuccessfulRequestFinishes() {
    Throwable throwable = null;

    try {
        new RequestCheckRunnable.Builder(mockRequest("http://www.example.com"))
                .client(mockHttpClient("{\"Requests\":{\"request_status\": \"COMPLETED\"}}"))
                .timeout(Duration.FIVE_SECONDS)
                .build()
                .run();
    } catch (Throwable t) {
        throwable = t;
    }

    assertNull(throwable);
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:17,代码来源:RequestCheckRunnableTest.java


示例6: blockUntilTaskCompletes

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
public void blockUntilTaskCompletes(String id, Duration timeout, Object[] results) throws PollingException {
    try {
        Repeater.create()
                .every(Duration.ONE_SECOND)
                .until(() -> {
                    TaskSummary summary = getRestApi().getActivityApi().get(id);
                    if (summary.isError() || summary.isCancelled() || (summary.getSubmitTimeUtc() == null)) {
                        throw new PollingException(new IllegalStateException("Effector call failed: " + summary));
                    }
                    if (summary.getEndTimeUtc() != null) {
                        results[0] = summary.getResult();
                        return true;
                    }
                    return false;
                })
                .rethrowExceptionImmediately()
                .limitTimeTo(timeout)
                .runRequiringTrue();
    } catch (Exception e) {
        LOG.error("Failed to get task summary: " + e);
        throw new PollingException(e);
    }
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:24,代码来源:BrooklynRestAdmin.java


示例7: waitForServerStartOrExit

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
/**
 * Waits for the given endpoint to respond true to {@link ServerApi#isUp}
 * or for the forked process to have exited.
 */
private void waitForServerStartOrExit(final ForkedServer forkedServer) throws MojoFailureException {
    final URL url = forkedServer.getServer();
    final ServerApi api = getApi(url).getServerApi();
    getLog().info("Waiting for server at " + url + " to be ready within " + getTimeout());
    boolean isUp = Repeater.create("Waiting for server at " + url + " to be ready within " + getTimeout())
            .every(Duration.ONE_SECOND)
            .limitTimeTo(getTimeout())
            .until(new Callable<Boolean>() {
                @Override
                public Boolean call() throws Exception {
                    // The order of these is important - if forkedServer.hasExited() then api.isUp()
                    // will throw an exception! The exception is thrown by RESTEasy.
                    return forkedServer.hasExited() || api.isUp();
                }
            })
            .run();
    if (forkedServer.hasExited()) {
        throw new MojoFailureException("Forked server exited unexpectedly (exit code " + forkedServer.getExitCode() + ")");
    } else if (!isUp) {
        throw new MojoFailureException("Server at " + url + " does not appear to be running after " + getTimeout());
    }
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-maven-plugin,代码行数:27,代码来源:StartBrooklynMojo.java


示例8: connectServiceLatencySensor

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
private void connectServiceLatencySensor() {
    serverLatencyFeed = FunctionFeed.builder()
            .entity(this)
            .period(Duration.seconds(2))
            .poll(new FunctionPollConfig<Double, Double>(SERVER_LATENCY)
                    .onException(Functions.constant(0.0))
                    .callable(new Callable<Double>() {
                        public Double call() {

                            Double total = getAttribute(SERVER_PROCESSING_TIME);
                            Double num = getAttribute(SERVER_REQUESTS);
                            return total / num;
                        }
                    }))
            .build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:17,代码来源:JavaCloudFoundryPaasWebAppImpl.java


示例9: connectServiceRequestPerSecondSensor

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
private void connectServiceRequestPerSecondSensor() {
    requestPerSecondLatencyFeed = FunctionFeed.builder()
            .entity(this)
            .period(Duration.seconds(1))
            .poll(new FunctionPollConfig<Double, Double>(REQUEST_PER_SECOND)
                    .onException(Functions.constant(0.0))
                    .callable(new Callable<Double>() {
                        public Double call() {
                            Double currentRequestPerSecond = getAttribute(SERVER_REQUESTS) - lastTotalRequest;
                            if (currentRequestPerSecond >= 0) {
                                lastTotalRequest = getAttribute(SERVER_REQUESTS);
                                return currentRequestPerSecond;
                            } else {
                                return getAttribute(SERVER_REQUESTS);
                            }
                        }
                    }))
            .build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:20,代码来源:JavaCloudFoundryPaasWebAppImpl.java


示例10: assertHadoopClusterEventuallyDeployed

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
protected void assertHadoopClusterEventuallyDeployed(Application app) {
    AmbariServer ambariServer = Entities.descendants(app, AmbariServer.class).iterator().next();
    EntityAsserts.assertAttributeEventually(
            ImmutableMap.of("timeout", Duration.minutes(60)),
            ambariServer,
            AmbariServer.CLUSTER_STATE,
            Predicates.not(Predicates.or(Predicates.equalTo("ABORTED"), Predicates.equalTo("FAILED"), Predicates.equalTo("TIMEDOUT")))
    );
    EntityAsserts.assertAttributeEventually(
            ImmutableMap.of("timeout", Duration.minutes(60)),
            ambariServer,
            AmbariServer.CLUSTER_STATE,
            Predicates.equalTo("COMPLETED"));
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:15,代码来源:AmbariLiveTestHelper.java


示例11: testTimeoutRequestThrowsRuntimeEx

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = ERROR_MESSAGE)
public void testTimeoutRequestThrowsRuntimeEx() throws IOException {
    new RequestCheckRunnable.Builder(mockRequest("http://www.example.com"))
            .client(mockHttpClient("{\"Requests\":{\"request_status\": \"IN_PROGRESS\"}}"))
            .timeout(Duration.FIVE_SECONDS)
            .errorMessage(ERROR_MESSAGE)
            .build()
            .run();
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:10,代码来源:RequestCheckRunnableTest.java


示例12: testInvalidReponseThrowsParseEx

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Test(expectedExceptions = PathNotFoundException.class)
public void testInvalidReponseThrowsParseEx() throws IOException {
    new RequestCheckRunnable.Builder(mockRequest("http://www.example.com"))
            .client(mockHttpClient("Invalid body: No Json"))
            .timeout(Duration.FIVE_SECONDS)
            .build()
            .run();
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:9,代码来源:RequestCheckRunnableTest.java


示例13: newServiceInstanceBindingCreatedSuccessfullyWithBindEffector

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Test
public void newServiceInstanceBindingCreatedSuccessfullyWithBindEffector()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException, PollingException {
   when(admin.getRestApi()).thenReturn(brooklynApi);
   when(admin.getCredentialsFromSensors(
           anyString(),
           anyString(),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class)
   )).thenReturn(new AsyncResult<>(Collections.<String, Object>emptyMap()));
   when(admin.hasEffector(anyString(), anyString(), anyString())).thenReturn(new AsyncResult<>(true));
   when(admin.invokeEffector(anyString(), anyString(), anyString(), anyString(), anyMap())).thenReturn(new AsyncResult<>(TASK_RESPONSE_COMPLETE));
   when(brooklynApi.getActivityApi()).thenReturn(activityApi);
   when(activityApi.get(anyString()))
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_COMPLETE);
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString());
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString(), any(Duration.class), any(Object[].class));
   when(instanceRepository.findOne(anyString(), anyBoolean())).thenReturn(serviceInstance);
   when(serviceDefinition.getMetadata()).thenReturn(ImmutableMap.of());
   when(brooklynCatalogService.getServiceDefinition(anyString())).thenReturn(serviceDefinition);
   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);
   CreateServiceInstanceBindingResponse binding = bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));

   // TODO assert binding was completed successfully
   //assertEquals(SVC_INST_BIND_ID, binding.getServiceBindingId());
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:33,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例14: testServiceInstanceBindingFailureWithBindEffector

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testServiceInstanceBindingFailureWithBindEffector()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException, PollingException {
   when(admin.getRestApi()).thenReturn(brooklynApi);
   when(admin.getCredentialsFromSensors(
           anyString(),
           anyString(),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class)
   )).thenReturn(new AsyncResult<>(Collections.<String, Object>emptyMap()));
   when(admin.hasEffector(anyString(), anyString(), anyString())).thenReturn(new AsyncResult<>(true));
   when(admin.invokeEffector(anyString(), anyString(), anyString(), anyString(), anyMap())).thenReturn(new AsyncResult<>(null));
   when(brooklynApi.getActivityApi()).thenReturn(activityApi);
   when(activityApi.get(anyString()))
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_COMPLETE);
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString());
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString(), any(Duration.class), any(Object[].class));
   when(instanceRepository.findOne(anyString(), anyBoolean())).thenReturn(serviceInstance);
   when(serviceDefinition.getMetadata()).thenReturn(ImmutableMap.of());
   when(brooklynCatalogService.getServiceDefinition(anyString())).thenReturn(serviceDefinition);
   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);
   bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:30,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例15: newApplicationContext

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
public static ApplicationContext newApplicationContext(ManagementContext mgmt, ResourceLoader resourceLoader) throws Exception {
    log.info("Loading Alien4Cloud platform...");
    // TODO if ES cannot find a config file, it will hang waiting for peers; should warn if does not complete in 1m
    try {
        Stopwatch s = Stopwatch.createStarted();

        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        
        if (null != resourceLoader) {
            ctx.setResourceLoader(resourceLoader);
        }

        // messy, but seems we must manually load the properties before loading the beans; otherwise we get e.g.
        // Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'directories.alien' in string value "${directories.alien}/plugins"
        final YamlPropertiesFactoryBean yamlPropertiesFactoryBean = AlienBrooklynYamlPropertiesFactoryBeanFactory.get(mgmt, ctx);
        if (yamlPropertiesFactoryBean == null) {
            throw new IllegalStateException("Could not load configuration for A4C. Expected either a value for ConfigKey " +
                    AlienBrooklynYamlPropertiesFactoryBeanFactory.ALIEN_CONFIG_FILE.getName() + " or for a resource named " +
                    AlienYamlPropertiesFactoryBeanFactory.ALIEN_CONFIGURATION_YAML + " to be available.");
        }


        ctx.getEnvironment().getPropertySources().addFirst(new PropertiesPropertySource("user",
                yamlPropertiesFactoryBean.getObject()));
        ctx.getBeanFactory().registerSingleton("brooklynManagementContext", mgmt);

        ctx.register(Alien4CloudSpringContext.class, Alien4CloudSpringConfig.class);
        ctx.refresh();
        ctx.registerShutdownHook();
        log.info("Finished loading Alien4Cloud platform (" + Duration.of(s) + ")");
        return ctx;

    } catch (Throwable t) {
        log.warn("Errors loading Alien4Cloud platform (rethrowing): " + t, t);
        throw Exceptions.propagate(t);
    }
}
 
开发者ID:cloudsoft,项目名称:brooklyn-tosca,代码行数:38,代码来源:Alien4CloudSpringContext.java


示例16: addPropertyDefinitions

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
private void addPropertyDefinitions(CatalogEntitySummary brooklynEntity, IndexedNodeType toscaType) {
    Set<EntityConfigSummary> entityConfigSummaries = brooklynEntity.getConfig(); // properties in TOSCA
    Map<String, PropertyDefinition> properties = Maps.newHashMap();
    toscaType.setProperties(properties);
    if (entityConfigSummaries == null) {
        return;
    }
    for (EntityConfigSummary entityConfigSummary : entityConfigSummaries) {
        String propertyType = TYPE_MAPPING.get(entityConfigSummary.getType());
        if (propertyType == null) {
            log.warn("Skipping entityConfigSummary {} as type {} is not recognized", entityConfigSummary, entityConfigSummary.getType());
        } else {
            PropertyDefinition propertyDefinition = new PropertyDefinition();
            propertyDefinition.setDescription(entityConfigSummary.getDescription());
            propertyDefinition.setType(propertyType);
            if (entityConfigSummary.getDefaultValue() != null) {
                if (propertyType.equals(ToscaType.TIME)) {
                    propertyDefinition.setDefault(Duration.of(entityConfigSummary.getDefaultValue()).toSeconds() + " s");
                } else {
                    propertyDefinition.setDefault(entityConfigSummary.getDefaultValue().toString());
                }
            }
            if (ToscaType.MAP.equals(propertyType)) {
                PropertyDefinition mapDefinition = new PropertyDefinition();
                // TODO: More complex map types. Unfortunately the type is not available from EntityConfigSummary
                mapDefinition.setType(ToscaType.STRING);
                propertyDefinition.setEntrySchema(mapDefinition);
            }
            propertyDefinition.setRequired(false);
            toscaType.getProperties().put(entityConfigSummary.getName(), propertyDefinition);
        }
    }
}
 
开发者ID:cloudsoft,项目名称:brooklyn-tosca,代码行数:34,代码来源:BrooklynCatalogMapper.java


示例17: connectInstancesNumberSensor

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
/**
 * For connecting the {@link #INSTANCES_NUM} sensor.
 * <p>
 * Should be called inside {@link #connectSensors()}.
 *
 * @see #disconnectInstancesNumberSensor()
 */
protected void connectInstancesNumberSensor() {
    usedNumberOfInstances = FunctionFeed.builder()
            .entity(this)
            .period(Duration.seconds(2))
            .poll(new FunctionPollConfig<Integer, Integer>(INSTANCES_NUM)
                    .onException(Functions.constant(0))
                    .callable(new Callable<Integer>() {
                        public Integer call() {
                            return getDriver().getInstancesNumber();
                        }
                    }))
            .build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:21,代码来源:CloudFoundryWebAppImpl.java


示例18: connectDiskQuotaSensor

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
/**
 * For connecting the {@link #DISK} sensor.
 * <p>
 * Should be called inside {@link #connectSensors()}.
 *
 * @see #disconnectDiskQuotaSensor()
 */
protected void connectDiskQuotaSensor() {
    usedDisk = FunctionFeed.builder()
            .entity(this)
            .period(Duration.seconds(2))
            .poll(new FunctionPollConfig<Integer, Integer>(DISK)
                    .onException(Functions.constant(0))
                    .callable(new Callable<Integer>() {
                        public Integer call() {
                            return getDriver().getDisk();
                        }
                    }))
            .build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:21,代码来源:CloudFoundryWebAppImpl.java


示例19: connectMemorySensor

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
/**
 * For connecting the {@link #MEMORY} sensor.
 * <p>
 * Should be called inside {@link #connectSensors()}.
 *
 * @see #disconnectMemorySensor()
 */
protected void connectMemorySensor() {
    usedMemory = FunctionFeed.builder()
            .entity(this)
            .period(Duration.seconds(2))
            .poll(new FunctionPollConfig<Integer, Integer>(MEMORY)
                    .onException(Functions.constant(0))
                    .callable(new Callable<Integer>() {
                        public Integer call() {
                            return getDriver().getMemory();
                        }
                    }))
            .build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:21,代码来源:CloudFoundryWebAppImpl.java


示例20: connectResourceLatencySensor

import org.apache.brooklyn.util.time.Duration; //导入依赖的package包/类
private void connectResourceLatencySensor() {
    resourceLatencyFeed = FunctionFeed.builder()
            .entity(this)
            .period(Duration.seconds(2))
            .poll(new FunctionPollConfig<Double, Double>(RESOURCE_LATENCY)
                    .onException(Functions.constant(0.0))
                    .callable(new Callable<Double>() {
                        public Double call() {
                            Double total = getAttribute(DURATION_SUM);
                            Double num = getAttribute(RESOURCE_HITS);
                            return total / num;
                        }
                    }))
            .build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:16,代码来源:JavaCloudFoundryPaasWebAppImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Group类代码示例发布时间:2022-05-22
下一篇:
Java FtpFile类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap