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


Java Context.contains方法代码示例

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


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

示例1: sendManagementCallRequest

import org.terracotta.management.model.context.Context; //导入方法依赖的package包/类
@Override
public String sendManagementCallRequest(ClientDescriptor caller, final Context context, String capabilityName, String methodName, Class<?> returnType, Parameter... parameters) {
  LOGGER.trace("[{}] sendManagementCallRequest({}, {}, {})", consumerId, context, capabilityName, methodName);

  String managementCallIdentifier = UUID.randomUUID().toString();
  Context fullContext = null;

  if (context.contains(Client.KEY)) {
    // handle client call
    ClientIdentifier to = ClientIdentifier.valueOf(context.get(Client.KEY));
    fullContext = context.with(topologyService.getManageableClientContext(to)
        .orElseThrow(() -> new IllegalArgumentException("Client " + to + " is either not found or not manageable")));
  }

  if ((context.contains(Server.NAME_KEY) || context.contains(Server.KEY))
      && (context.contains(ServerEntity.CONSUMER_ID) || context.contains(ServerEntity.TYPE_KEY) && context.contains(ServerEntity.NAME_KEY))) {
    // handle entity call
    String serverName = context.getOrDefault(Server.NAME_KEY, context.get(Server.KEY));
    Context entityCtx = (context.contains(ServerEntity.CONSUMER_ID) ?
        topologyService.getManageableEntityContext(serverName, Long.parseLong(context.get(ServerEntity.CONSUMER_ID))) :
        topologyService.getManageableEntityContext(serverName, context.get(ServerEntity.NAME_KEY), context.get(ServerEntity.TYPE_KEY)))
        .orElseThrow(() -> new IllegalArgumentException("Server Entity " + context + " is either not found or not manageable"));
    fullContext = context.with(entityCtx);
  }

  if (fullContext == null) {
    // this method is called from an entity invoke, so throwing is OK
    throw new IllegalArgumentException(context.toString());
  }

  track(caller, managementCallIdentifier);

  firingService.fireManagementCallRequest(managementCallIdentifier, new ContextualCall<>(fullContext, capabilityName, methodName, returnType, parameters));

  return managementCallIdentifier;
}
 
开发者ID:Terracotta-OSS,项目名称:terracotta-platform,代码行数:37,代码来源:DefaultManagementService.java

示例2: findExposedObject

import org.terracotta.management.model.context.Context; //导入方法依赖的package包/类
protected ExposedObject<T> findExposedObject(Context context) {
  if (!contextValid(context)) {
    return null;
  }
  for (ExposedObject<T> exposedObject : exposedObjects) {
    if (context.contains(exposedObject.getContext())) {
      return exposedObject;
    }
  }
  return null;
}
 
开发者ID:Terracotta-OSS,项目名称:terracotta-platform,代码行数:12,代码来源:AbstractManagementProvider.java

示例3: call

import org.terracotta.management.model.context.Context; //导入方法依赖的package包/类
@Override
public Future<String> call(@ClientId Object callerDescriptor, Context context, String capabilityName, String methodName, Class<?> returnType, Parameter... parameters) {
  if (context.contains(Stripe.KEY)) {
    context = context.with(Stripe.KEY, "SINGLE");
  }
  return CompletableFuture.completedFuture(managementService.sendManagementCallRequest((ClientDescriptor) callerDescriptor, context, capabilityName, methodName, returnType, parameters));
}
 
开发者ID:Terracotta-OSS,项目名称:terracotta-platform,代码行数:8,代码来源:ActiveNmsServerEntity.java


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