本文整理汇总了Java中org.jboss.as.server.ServerEnvironment类的典型用法代码示例。如果您正苦于以下问题:Java ServerEnvironment类的具体用法?Java ServerEnvironment怎么用?Java ServerEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerEnvironment类属于org.jboss.as.server包,在下文中一共展示了ServerEnvironment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: activate
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
ServiceTarget target = serviceActivatorContext.getServiceTarget();
MetricsService service = new MetricsService();
ServiceBuilder<MetricsService> metricsServiceBuilder = target.addService(MetricsService.SERVICE_NAME, service);
RegistryFactory factory = new RegistryFactoryImpl();
ServiceBuilder<MetricsService> serviceBuilder = metricsServiceBuilder
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getServerEnvironmentInjector())
.addDependency(ServiceName.parse("jboss.eclipse.microprofile.config.config-provider"))
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector());
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
BinderService binderService = new BinderService(SWARM_MP_METRICS, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, SWARM_MP_METRICS), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(factory))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:27,代码来源:MetricsServiceActivator.java
示例2: getServerEnvironment
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
public ServerEnvironment getServerEnvironment() {
Properties props = new Properties();
File home = new File("target/jbossas");
delete(home);
home.mkdir();
props.put(ServerEnvironment.HOME_DIR, home.getAbsolutePath());
File standalone = new File(home, "standalone");
standalone.mkdir();
props.put(ServerEnvironment.SERVER_BASE_DIR, standalone.getAbsolutePath());
File configuration = new File(standalone, "configuration");
configuration.mkdir();
props.put(ServerEnvironment.SERVER_CONFIG_DIR, configuration.getAbsolutePath());
File xml = new File(configuration, "standalone.xml");
try {
xml.createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml");
return new ServerEnvironment(null, props, new HashMap<>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), null);
}
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:26,代码来源:TestModelControllerService11_0_0.java
示例3: createStandaloneServerEnvironment
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
private ServerEnvironment createStandaloneServerEnvironment() {
Properties props = new Properties();
File home = new File("target/jbossas");
delete(home);
home.mkdir();
delay(10);
props.put(ServerEnvironment.HOME_DIR, home.getAbsolutePath());
File standalone = new File(home, "standalone");
standalone.mkdir();
props.put(ServerEnvironment.SERVER_BASE_DIR, standalone.getAbsolutePath());
File configuration = new File(standalone, "configuration");
configuration.mkdir();
props.put(ServerEnvironment.SERVER_CONFIG_DIR, configuration.getAbsolutePath());
File xml = new File(configuration, "standalone.xml");
try {
xml.createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml");
return new ServerEnvironment(null, props, new HashMap<String, String>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), null);
}
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:27,代码来源:TestModelControllerService7_5_0.java
示例4: testDataAndConfigOverride
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Test
public void testDataAndConfigOverride() throws Exception {
Properties props = new Properties();
props.setProperty(EmbeddedStandaloneServerFactory.JBOSS_EMBEDDED_ROOT, embeddedRoot.toAbsolutePath().toString());
props.setProperty(ServerEnvironment.SERVER_DATA_DIR, alternativeDataDir.toAbsolutePath().toString());
props.setProperty(ServerEnvironment.SERVER_CONFIG_DIR, alternativeConfigDir.toAbsolutePath().toString());
EmbeddedStandaloneServerFactory.setupCleanDirectories(standardJBossHome, props);
Assert.assertEquals(4, props.size());
Assert.assertEquals(embeddedRoot.toAbsolutePath().toString(), props.getProperty(EmbeddedStandaloneServerFactory.JBOSS_EMBEDDED_ROOT));
assertPropertyAndEmbeddedRootFile(props, ServerEnvironment.SERVER_BASE_DIR, -1);
assertPropertyAndEmbeddedRootFile(props, ServerEnvironment.SERVER_DATA_DIR, 3);
assertPropertyAndEmbeddedRootFile(props, ServerEnvironment.SERVER_CONFIG_DIR, 4);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:14,代码来源:EmbeddedServerFactorySetupUnitTestCase.java
示例5: execute
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
final ModelNode model = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
final String logDir = pathManager.getPathEntry(ServerEnvironment.SERVER_LOG_DIR).resolvePath();
List<File> logFiles;
try {
logFiles = findFiles(logDir, model);
} catch (IOException e) {
logFiles = Collections.emptyList();
LoggingLogger.ROOT_LOGGER.errorProcessingLogDirectory(logDir);
}
final SimpleDateFormat dateFormat = new SimpleDateFormat(LogFileResourceDefinition.ISO_8601_FORMAT);
final ModelNode result = context.getResult().setEmptyList();
for (File logFile : logFiles) {
final ModelNode fileInfo = new ModelNode();
fileInfo.get(FILE_NAME.getName()).set(logFile.getName());
fileInfo.get(FILE_SIZE.getName()).set(logFile.length());
fileInfo.get(LAST_MODIFIED_DATE.getName()).set(dateFormat.format(new Date(logFile.lastModified())));
result.add(fileInfo);
}
context.completeStep(ResultHandler.NOOP_RESULT_HANDLER);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:LoggingResourceDefinition.java
示例6: execute
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
final ModelNode model = context.getResult();
final String name = LoggingOperations.getAddressName(operation);
final String logDir = pathManager.getPathEntry(ServerEnvironment.SERVER_LOG_DIR).resolvePath();
validateFile(context, logDir, name);
final Path path = Paths.get(logDir, name);
if (Files.notExists(path)) {
throw LoggingLogger.ROOT_LOGGER.logFileNotFound(name, logDir);
}
try {
updateModel(path, model);
} catch (IOException e) {
throw new RuntimeException(e);
}
context.completeStep(ResultHandler.NOOP_RESULT_HANDLER);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:LogFileResourceDefinition.java
示例7: getChildrenNames
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public Set<String> getChildrenNames(final String childType) {
if (LOG_FILE.equals(childType)) {
final String logDir = pathManager.getPathEntry(ServerEnvironment.SERVER_LOG_DIR).resolvePath();
try {
final Set<Path> validPaths = findFiles(logDir, getFileHandlersModel(), true);
final Set<String> result = new LinkedHashSet<>();
for (Path p : validPaths) {
result.add(p.toString());
}
return result;
} catch (IOException e) {
LoggingLogger.ROOT_LOGGER.errorProcessingLogDirectory(logDir);
}
}
return delegate.getChildrenNames(childType);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:LoggingResource.java
示例8: registerAttributes
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
resourceRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.LAUNCH_TYPE, (context,operation) -> {
readResourceServerConfig(context, operation);
context.getResult().set(ServerEnvironment.LaunchType.DOMAIN.toString());
});
resourceRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.SERVER_STATE, (context, operation) -> {
readResourceServerConfig(context, operation);
// note this is inconsistent with the other values, should be lower case, preserved for now.
context.getResult().set("STOPPED");
});
resourceRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.RUNTIME_CONFIGURATION_STATE,
(context, operation) -> {
readResourceServerConfig(context, operation);
context.getResult().set(ClientConstants.CONTROLLER_PROCESS_STATE_STOPPED);
}
);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:StoppedServerResource.java
示例9: registerCapabilities
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void registerCapabilities(ManagementResourceRegistration resourceRegistration) {
super.registerCapabilities(resourceRegistration);
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(HostControllerEnvironment.HOME_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(HostControllerEnvironment.DOMAIN_CONFIG_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(HostControllerEnvironment.DOMAIN_DATA_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(HostControllerEnvironment.DOMAIN_LOG_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(HostControllerEnvironment.DOMAIN_TEMP_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(HostControllerEnvironment.CONTROLLER_TEMP_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(ServerEnvironment.SERVER_BASE_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(ServerEnvironment.SERVER_CONFIG_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(ServerEnvironment.SERVER_DATA_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(ServerEnvironment.SERVER_LOG_DIR));
resourceRegistration.registerCapability(PATH_CAPABILITY.fromBaseCapability(ServerEnvironment.SERVER_TEMP_DIR));
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:HostResourceDefinition.java
示例10: addService
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
public static ServiceController<?> addService(ServiceTarget serviceTarget, HostPathManagerService service, HostControllerEnvironment hostEnvironment) {
ServiceBuilder<?> serviceBuilder = serviceTarget.addService(AbstractControllerService.PATH_MANAGER_CAPABILITY.getCapabilityServiceName(), service).addAliases(SERVICE_NAME);
// Add resources and capabilities for the always-present paths
service.addHardcodedAbsolutePath(serviceTarget, HostControllerEnvironment.HOME_DIR, hostEnvironment.getHomeDir().getAbsolutePath());
service.addHardcodedAbsolutePath(serviceTarget, HostControllerEnvironment.DOMAIN_CONFIG_DIR, hostEnvironment.getDomainConfigurationDir().getAbsolutePath());
service.addHardcodedAbsolutePath(serviceTarget, HostControllerEnvironment.DOMAIN_DATA_DIR, hostEnvironment.getDomainDataDir().getAbsolutePath());
service.addHardcodedAbsolutePath(serviceTarget, HostControllerEnvironment.DOMAIN_LOG_DIR, hostEnvironment.getDomainLogDir().getAbsolutePath());
service.addHardcodedAbsolutePath(serviceTarget, HostControllerEnvironment.DOMAIN_TEMP_DIR, hostEnvironment.getDomainTempDir().getAbsolutePath());
service.addHardcodedAbsolutePath(serviceTarget, HostControllerEnvironment.CONTROLLER_TEMP_DIR, hostEnvironment.getDomainTempDir().getAbsolutePath());
// Registering the actual standard server path capabilities so server config resources can reference them
//TODO look if those registrations could be moved to ServerService/DomainModelControllerService.initModel
registerServerPathCapability(service.localCapRegRef, ServerEnvironment.SERVER_BASE_DIR);
registerServerPathCapability(service.localCapRegRef, ServerEnvironment.SERVER_CONFIG_DIR);
registerServerPathCapability(service.localCapRegRef, ServerEnvironment.SERVER_DATA_DIR);
registerServerPathCapability(service.localCapRegRef, ServerEnvironment.SERVER_LOG_DIR);
registerServerPathCapability(service.localCapRegRef, ServerEnvironment.SERVER_TEMP_DIR);
return serviceBuilder.install();
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:HostPathManagerService.java
示例11: ModelControllerService
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
ModelControllerService(final ControlledProcessState processState, final StringConfigurationPersister persister, final ServerDelegatingResourceDefinition rootResourceDefinition) {
super(ProcessType.EMBEDDED_SERVER, new RunningModeControl(RunningMode.ADMIN_ONLY), persister, processState, rootResourceDefinition, null, ExpressionResolver.TEST_RESOLVER,
AuditLogger.NO_OP_LOGGER, new DelegatingConfigurableAuthorizer(), new ManagementSecurityIdentitySupplier(), new CapabilityRegistry(true));
this.persister = persister;
this.processState = processState;
this.rootResourceDefinition = rootResourceDefinition;
Properties properties = new Properties();
properties.put("jboss.home.dir", System.getProperty("basedir", ".") + File.separatorChar + "target");
final String hostControllerName = "hostControllerName"; // Host Controller name may not be null when in a managed domain
environment = new ServerEnvironment(hostControllerName, properties, new HashMap<String, String>(), null, null,
ServerEnvironment.LaunchType.DOMAIN, null, ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), ".", properties), false);
extensionRegistry =
new ExtensionRegistry(ProcessType.STANDALONE_SERVER, new RunningModeControl(RunningMode.NORMAL), null, null, null, RuntimeHostControllerInfoAccessor.SERVER);
capabilityRegistry = new CapabilityRegistry(processType.isServer());
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:InterfaceManagementUnitTestCase.java
示例12: createStandaloneServerEnvironment
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
private ServerEnvironment createStandaloneServerEnvironment() {
Properties props = new Properties();
File home = new File("target/jbossas");
delete(home);
home.mkdir();
delay(10);
props.put(ServerEnvironment.HOME_DIR, home.getAbsolutePath());
File standalone = new File(home, "standalone");
standalone.mkdir();
props.put(ServerEnvironment.SERVER_BASE_DIR, standalone.getAbsolutePath());
File configuration = new File(standalone, "configuration");
configuration.mkdir();
props.put(ServerEnvironment.SERVER_CONFIG_DIR, configuration.getAbsolutePath());
File xml = new File(configuration, "standalone.xml");
try {
xml.createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml");
ProductConfig pc = new ProductConfig("Test", Version.AS_VERSION, "main");
return new ServerEnvironment(null, props, new HashMap<String, String>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), pc, false);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:TestModelControllerService.java
示例13: getServerEnvironment
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
public ServerEnvironment getServerEnvironment() {
Properties props = new Properties();
File home = new File("target/jbossas");
delete(home);
home.mkdir();
props.put(ServerEnvironment.HOME_DIR, home.getAbsolutePath());
File standalone = new File(home, "standalone");
standalone.mkdir();
props.put(ServerEnvironment.SERVER_BASE_DIR, standalone.getAbsolutePath());
File configuration = new File(standalone, "configuration");
configuration.mkdir();
props.put(ServerEnvironment.SERVER_CONFIG_DIR, configuration.getAbsolutePath());
File xml = new File(configuration, "standalone.xml");
try {
xml.createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml");
return new ServerEnvironment(null, props, new HashMap<String, String>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), null, false);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:TestModelControllerService.java
示例14: createService
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
public static ServiceController<RhqMetricsService> createService(final ServiceTarget target,
final ServiceVerificationHandler verificationHandler,
ModelNode config) {
RhqMetricsService service = new RhqMetricsService(config);
return target.addService(SERVICE_NAME, service)
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class,
service.serverEnvironmentValue)
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class,
service.modelControllerValue)
.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class,
service.processStateValue)
.addListener(verificationHandler)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:hawkular,项目名称:wildfly-monitor,代码行数:18,代码来源:RhqMetricsService.java
示例15: installWildFlySingleton
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
private static void installWildFlySingleton(final ServiceRegistry registry,
final ServiceTarget target,
final Service service,
final ServiceName name) {
SingletonServiceBuilderFactory factory = null;
for(ServiceName each : SINGLETON_FACTORY_NAMES) {
ServiceController factoryService = registry.getService(each);
if (factoryService != null) {
factory = (SingletonServiceBuilderFactory)factoryService.getValue();
}
}
if (factory == null) {
throw new RuntimeException("Failed to locate singleton builder");
}
final InjectedValue<ServerEnvironment> env = new InjectedValue<>();
factory.createSingletonServiceBuilder(name, service)
.electionPolicy((SingletonElectionPolicy)electionPolicy())
.requireQuorum(1)
.build(target)
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, env)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:projectodd,项目名称:wunderboss,代码行数:26,代码来源:SingletonHelper.java
示例16: activate
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) {
log.info("HATimerService will be installed!");
HATimerService service = new HATimerService();
SingletonService<String> singleton = new SingletonService<String>(service, HATimerService.SINGLETON_SERVICE_NAME);
/*
* We can pass a chain of election policies to the singleton, for example to tell JGroups to prefer running the singleton on a node with a
* particular name
*/
// singleton.setElectionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference("node2/cluster")));
// Workaround for JBoss AS 7.1.2
// In later releases, SingleService.build(...) accepts a service target
singleton.build(new DelegatingServiceContainer(context.getServiceTarget(), context.getServiceRegistry()))
// singleton.build(context.getServiceTarget())
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.env)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install()
;
}
开发者ID:red-fox-mulder,项目名称:eap-6.1-quickstarts,代码行数:22,代码来源:HATimerServiceActivator.java
示例17: activate
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) {
log.info("HATimerService will be installed!");
HATimerService service = new HATimerService();
SingletonService<String> singleton = new SingletonService<String>(service, HATimerService.SINGLETON_SERVICE_NAME);
/*
* We can pass a chain of election policies to the singleton, for example to tell JGroups to prefer running the singleton on a node with a
* particular name
*/
// singleton.setElectionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference("node2/cluster")));
singleton.build(new DelegatingServiceContainer(context.getServiceTarget(), context.getServiceRegistry()))
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.env)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install()
;
}
开发者ID:wfink,项目名称:jboss-as-quickstart,代码行数:19,代码来源:HATimerServiceActivator.java
示例18: initialProperties
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
protected Properties initialProperties() {
Properties properties = new Properties();
ServerEnvironment serverEnv = getServerEnvironment();
File storageDir = new File(serverEnv.getServerDataDir(), Constants.RUNTIME_STORAGE_DEFAULT);
File configsDir = new File(serverEnv.getServerConfigurationDir(), "gravia" + File.separator + "configs");
File repositoryDir = new File(serverEnv.getServerDataDir().getPath() + File.separator + "repository");
// Gravia integration properties
properties.setProperty(Constants.RUNTIME_STORAGE_DIR, storageDir.getAbsolutePath());
properties.setProperty(Constants.RUNTIME_CONFIGURATIONS_DIR, configsDir.getAbsolutePath());
properties.setProperty(Constants.PROPERTY_REPOSITORY_STORAGE_DIR, repositoryDir.getAbsolutePath());
properties.setProperty(Constants.RUNTIME_TYPE, RuntimeType.WILDFLY.toString());
return properties;
}
开发者ID:tdiesler,项目名称:gravia,代码行数:17,代码来源:RuntimeService.java
示例19: activate
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
try {
SingletonPolicy policy = (SingletonPolicy) context.getServiceRegistry()
.getRequiredService(parse(SINGLETON_POLICY.getName())).awaitValue();
InjectedValue<ServerEnvironment> env = new InjectedValue<>();
HAService service = new HAService(env);
policy.createSingletonServiceBuilder(SERVICE_NAME, service).build(context.getServiceTarget())
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, env).install();
} catch (InterruptedException e) {
throw new ServiceRegistryException(e);
}
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:14,代码来源:HAServicePolicyActivator.java
示例20: install
import org.jboss.as.server.ServerEnvironment; //导入依赖的package包/类
private static void install(ServiceTarget target, SingletonServiceBuilderFactory factory, ServiceName name,
int quorum) {
InjectedValue<ServerEnvironment> env = new InjectedValue<>();
HAService service = new HAService(env);
factory.createSingletonServiceBuilder(name, service)
.electionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(),
new NamePreference(PREFERRED_NODE)))
.requireQuorum(quorum).build(target).addDependency(SERVICE_NAME, ServerEnvironment.class, env)
.install();
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:11,代码来源:HAServiceActivator.java
注:本文中的org.jboss.as.server.ServerEnvironment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论