本文整理汇总了Java中org.jboss.msc.service.ServiceName.append方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceName.append方法的具体用法?Java ServiceName.append怎么用?Java ServiceName.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.msc.service.ServiceName
的用法示例。
在下文中一共展示了ServiceName.append方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getServiceName
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
private static ServiceName getServiceName(final OperationContext context) {
String deploymentName = null;
String subdeploymentName = null;
final PathAddress address = context.getCurrentAddress();
for (PathElement element : address) {
if (ModelDescriptionConstants.DEPLOYMENT.equals(element.getKey())) {
deploymentName = getRuntimeName(context, element);
//deploymentName = element.getValue();
} else if (ModelDescriptionConstants.SUBDEPLOYMENT.endsWith(element.getKey())) {
subdeploymentName = element.getValue();
}
}
if (deploymentName == null) {
throw LoggingLogger.ROOT_LOGGER.deploymentNameNotFound(address);
}
final ServiceName result;
if (subdeploymentName == null) {
result = Services.deploymentUnitName(deploymentName);
} else {
result = Services.deploymentUnitName(deploymentName, subdeploymentName);
}
return result.append("logging", "configuration");
}
示例2: removeThreadPoolService
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
static void removeThreadPoolService(final String threadPoolName,
final ServiceName serviceNameBase,
final String threadFactoryName,
final ThreadFactoryResolver threadFactoryResolver,
final String handoffExecutorName,
final HandoffExecutorResolver handoffExecutorResolver,
final OperationContext operationContext) {
final ServiceName threadPoolServiceName = serviceNameBase.append(threadPoolName);
operationContext.removeService(threadPoolServiceName);
threadFactoryResolver.releaseThreadFactory(threadFactoryName, threadPoolName, threadPoolServiceName, operationContext);
if (handoffExecutorResolver != null) {
handoffExecutorResolver.releaseHandoffExecutor(handoffExecutorName, threadPoolName, threadPoolServiceName, operationContext);
}
}
示例3: createServiceName
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
private static ServiceName createServiceName(PathAddress address) {
ServiceName name = ServiceName.JBOSS;
name = name.append("test");
for (PathElement element : address) {
name = name.append(element.getKey(), element.getValue());
}
return name;
}
示例4: performRuntime
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String name = address.getLastElement().getValue();
final ServiceName serviceName = DeploymentScannerService.getServiceName(name);
final ServiceName pathServiceName = serviceName.append("path");
context.removeService(serviceName);
context.removeService(pathServiceName);
}
示例5: installThreadPoolService
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
static <T> void installThreadPoolService(final Service<T> threadPoolService,
final String threadPoolName,
final ServiceName serviceNameBase,
final String threadFactoryName,
final ThreadFactoryResolver threadFactoryResolver,
final Injector<ThreadFactory> threadFactoryInjector,
final String handoffExecutorName,
final HandoffExecutorResolver handoffExecutorResolver,
final Injector<Executor> handoffExecutorInjector,
final ServiceTarget target) {
final ServiceName threadPoolServiceName = serviceNameBase.append(threadPoolName);
final ServiceBuilder<?> serviceBuilder = target.addService(threadPoolServiceName, threadPoolService);
final ServiceName threadFactoryServiceName = threadFactoryResolver.resolveThreadFactory(threadFactoryName,
threadPoolName, threadPoolServiceName, target);
serviceBuilder.addDependency(threadFactoryServiceName, ThreadFactory.class, threadFactoryInjector);
if (handoffExecutorInjector != null) {
ServiceName handoffServiceName = handoffExecutorResolver.resolveHandoffExecutor(handoffExecutorName,
threadPoolName, threadPoolServiceName, target);
if (handoffServiceName != null) {
serviceBuilder.addDependency(handoffServiceName, Executor.class, handoffExecutorInjector);
}
}
serviceBuilder.install();
}
示例6: createServiceName
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
public static ServiceName createServiceName(final ServiceName parentService, final boolean trustOnly) {
return parentService.append(trustOnly ? TRUST_ONLY_SERVICE_SUFFIX : SERVICE_SUFFIX);
}
示例7: createServiceName
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
public static ServiceName createServiceName(final ServiceName parentService) {
return parentService.append(SERVICE_SUFFIX);
}
示例8: parseServiceName
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
/**
* Parses a string into a {@link ServiceName} using the same algorithm as {@link ServiceName#parse(String)}
* but also attempts to ensure that once parsing occurs if any other name that is
* {@link ServiceName#equals(ServiceName) equal to} the parsed name or one of its
* {@link ServiceName#getParent() ancestors} has been parsed previously that that previously parsed name
* is used.
*
* @param toParse the string form of a service name. Cannot be {@code null}
* @return a {@code ServiceName} instance
*/
public static ServiceName parseServiceName(String toParse) {
ServiceName original = ServiceName.parse(toParse);
// Try to use cached elements of the ServiceName chain
// Cost of a duplicate ServiceName instance
// 1) int for hashCode
// 2) pointer to simple name
// 3) pointer to canonical name
// 4) pointer to parent
// 5) the simple name (cost depends on string length but at least 2 pointers plus the char[] and the object)
// 6) Possibly a long string for canonicalName
// Cost of a ConcurrentHashMap Node where key == value
// 1) int for hash code
// 2) pointer to key
// 3) pointer to value
// 4) pointer to next
// 5) ~ 1 pointer to the Node itself in the table (some table elements have > 1 Node but some are empty
// Based on this, if there's roughly a > 50% chance of a name being duplicated, it's worthwhile
// to intern it. As a heuristic for whether there is a > 50% chance, we'll intern all names
// of 4 elements or less and for larger names, all but the last element
int length = original.length();
ServiceName[] ancestry = new ServiceName[length];
ServiceName sn = original;
for (int i = length - 1; i >= 0 ; i--) {
ancestry[i] = sn;
sn = sn.getParent();
}
int max = length > 4 ? length - 1 : length;
for (int i = 0; i < max; i++) {
ServiceName interned = cache.putIfAbsent(ancestry[i], ancestry[i]);
if (interned != null && ancestry[i] != interned) {
// Replace this one in the ancestry with the interned one
ServiceName parent = ancestry[i] = interned;
// Replace all descendants
boolean checkCache = true;
for (int j = i+1; j < length; j++) {
parent = parent.append(ancestry[j].getSimpleName());
if (checkCache && j < max) {
ServiceName cached = cache.get(parent);
if (cached != null) {
// Use what we already have
parent = cached;
// We don't need to recheck in the outer loop.
i = j;
} else {
// Assume we'll miss the rest of the way
checkCache = false;
}
}
ancestry[j] = parent;
}
}
}
return ancestry[length - 1];
}
示例9: serviceName
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
public static ServiceName serviceName(final ServiceName deploymentUnitServiceName) {
return deploymentUnitServiceName.append(SERVICE_NAME);
}
示例10: resolveDefaultThreadFactory
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
/**
* Installs a {@link ThreadFactoryService} whose service name is the service name of the thread pool with {@code thread-factory} appended.
*
* @param threadPoolName the name of the thread pool
* @param threadPoolServiceName the full name of the {@link org.jboss.msc.service.Service} that provides the thread pool
* @param serviceTarget service target that is installing the thread pool service; can be used to install
* a {@link org.jboss.as.threads.ThreadFactoryService}
* @return the {@link ServiceName} of the {@link ThreadFactoryService} the thread pool should use. Cannot be
* {@code null}
*/
private ServiceName resolveDefaultThreadFactory(String threadPoolName, ServiceName threadPoolServiceName,
ServiceTarget serviceTarget) {
final ServiceName threadFactoryServiceName = threadPoolServiceName.append("thread-factory");
final ThreadFactoryService service = new ThreadFactoryService();
service.setThreadGroupName(getThreadGroupName(threadPoolName));
service.setNamePattern("%G - %t");
serviceTarget.addService(threadFactoryServiceName, service).install();
return threadFactoryServiceName;
}
示例11: releaseDefaultThreadFactory
import org.jboss.msc.service.ServiceName; //导入方法依赖的package包/类
/**
* Removes any default thread factory installed in {@link #resolveDefaultThreadFactory(String, org.jboss.msc.service.ServiceName, org.jboss.msc.service.ServiceTarget)}.
*
* @param threadPoolServiceName the full name of the {@link org.jboss.msc.service.Service} that provides the thread pool
* @param context the context of the current operation; can be used to perform any necessary
* {@link OperationContext#removeService(ServiceName) service removals}
*/
private void releaseDefaultThreadFactory(ServiceName threadPoolServiceName, OperationContext context) {
final ServiceName threadFactoryServiceName = threadPoolServiceName.append("thread-factory");
context.removeService(threadFactoryServiceName);
}