com.vmware.xenon.common.Utils.buildServiceConfig()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中com.vmware.xenon.common.Utils.buildServiceConfig()方法的一些代码示例,展示了Utils.buildServiceConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.buildServiceConfig()方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:buildServiceConfig

Utils.buildServiceConfig介绍

[英]Construct common data in ServiceConfiguration.
[中]在ServiceConfiguration中构造公共数据。

代码示例

代码示例来源:origin: vmware/xenon

@Override
public void handleConfigurationRequest(Operation request) {
  if (request.getAction() == Action.PATCH) {
    super.handleConfigurationRequest(request);
    return;
  }
  if (request.getAction() != Action.GET) {
    request.fail(new IllegalArgumentException("Action not supported: " + request.getAction()));
    return;
  }
  FactoryServiceConfiguration config = Utils.buildServiceConfig(new FactoryServiceConfiguration(), this);
  config.childOptions = this.childOptions;
  request.setBodyNoCloning(config).complete();
}

代码示例来源:origin: vmware/xenon

@Override
public void handleConfigurationRequest(Operation request) {
  if (request.getAction() == Action.PATCH) {
    allocateUtilityService();
    this.utilityService.handlePatchConfiguration(request, null);
    return;
  }
  if (request.getAction() != Action.GET) {
    request.fail(new IllegalArgumentException("Action not supported: "
        + request.getAction()));
    return;
  }
  ServiceConfiguration config = Utils.buildServiceConfig(new ServiceConfiguration(), this);
  request.setBodyNoCloning(config).complete();
}

代码示例来源:origin: vmware/xenon

@Override
public void handleConfigurationRequest(Operation op) {
  if (op.getAction() == Action.PATCH && op.hasBody()) {
    ServiceConfigUpdateRequest body = op.getBody(ServiceConfigUpdateRequest.class);
    if (body.operationQueueLimit != null) {
      this.operationQueueLimit = body.operationQueueLimit;
    }
  }
  if (op.getAction() == Action.GET) {
    ServiceConfiguration cfg = Utils.buildServiceConfig(new ServiceConfiguration(), this);
    cfg.epoch = 0;
    cfg.operationQueueLimit = (int) this.operationQueueLimit;
    op.setBodyNoCloning(cfg).complete();
    return;
  }
  super.handleConfigurationRequest(op);
}

代码示例来源:origin: vmware/xenon

ServiceConfiguration cfg = Utils.buildServiceConfig(new ServiceConfiguration(), this);
cfg.epoch = this.context.epoch;
cfg.operationQueueLimit = this.context.operationQueue.getLimit();

代码示例来源:origin: vmware/xenon

@Test
public void testBuildServiceConfig() {
  Service exampleService = new ExampleService();
  exampleService.setHost(VerificationHost.create());
  ServiceConfiguration config = new ServiceConfiguration();
  Utils.buildServiceConfig(config, exampleService);
  assertEquals(exampleService.getOptions(), config.options);
  assertEquals(exampleService.getMaintenanceIntervalMicros(), config.maintenanceIntervalMicros);
  assertEquals(ExampleServiceState.VERSION_RETENTION_LIMIT, config.versionRetentionLimit);
  assertEquals(ExampleServiceState.VERSION_RETENTION_FLOOR, config.versionRetentionFloor);
  assertEquals(exampleService.getPeerNodeSelectorPath(), config.peerNodeSelectorPath);
  assertEquals(exampleService.getDocumentIndexPath(), config.documentIndexPath);
}

代码示例来源:origin: com.vmware.xenon/xenon-common

@Test
public void testBuildServiceConfig() {
  Service exampleService = new ExampleService();
  exampleService.setHost(VerificationHost.create());
  ServiceConfiguration config = new ServiceConfiguration();
  Utils.buildServiceConfig(config, exampleService);
  assertEquals(exampleService.getOptions(), config.options);
  assertEquals(exampleService.getMaintenanceIntervalMicros(), config.maintenanceIntervalMicros);
  assertEquals(ExampleServiceState.VERSION_RETENTION_LIMIT, config.versionRetentionLimit);
  assertEquals(ExampleServiceState.VERSION_RETENTION_FLOOR, config.versionRetentionFloor);
  assertEquals(exampleService.getPeerNodeSelectorPath(), config.peerNodeSelectorPath);
  assertEquals(exampleService.getDocumentIndexPath(), config.documentIndexPath);
}

相关文章