本文整理汇总了Java中javax.resource.spi.BootstrapContext类的典型用法代码示例。如果您正苦于以下问题:Java BootstrapContext类的具体用法?Java BootstrapContext怎么用?Java BootstrapContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BootstrapContext类属于javax.resource.spi包,在下文中一共展示了BootstrapContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* This is called when a resource adapter instance is bootstrapped.
*
* @param ctx
* A bootstrap context containing references
* @throws ResourceAdapterInternalException
* indicates bootstrap failure.
*/
public void start(BootstrapContext ctx)
throws ResourceAdapterInternalException {
log.tracef("start(%s)", ctx);
this.bootstrapContext = ctx;
rabbitCF = new ConnectionFactory();
try {
rabbitCF.setUri(uri);
rabbitCF.setConnectionTimeout(getConnectionTimeout());
rabbitCF.setRequestedHeartbeat(getRequestedHeartbeat());
} catch (KeyManagementException | NoSuchAlgorithmException
| URISyntaxException e) {
throw new ResourceAdapterInternalException(e);
}
}
示例2: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* Start
*
* @param ctx The bootstrap context
* @throws ResourceAdapterInternalException Thrown if an error occurs
*/
@Override
public void start(final BootstrapContext ctx) throws ResourceAdapterInternalException {
if (logger.isTraceEnabled()) {
logger.trace("start(" + ctx + ")");
}
tm = ServiceUtils.getTransactionManager();
recoveryManager.start(useAutoRecovery);
this.ctx = ctx;
if (!configured.getAndSet(true)) {
try {
setup();
} catch (ActiveMQException e) {
throw new ResourceAdapterInternalException("Unable to create activation", e);
}
}
ActiveMQRALogger.LOGGER.resourceAdaptorStarted();
}
示例3: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
@Override
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
log.debug("");
workManager = ctx.getWorkManager();
xaTerminator = ctx.getXATerminator();
try {
timer = ctx.createTimer();
perMinuteTimerTask = new PerMinuteTimerTask();
perMinuteTimerTask.init();
timer.schedule(perMinuteTimerTask, perMinuteTimerTask.getDelay(), perMinuteTimerTask.getPeriod());
} catch (UnavailableException e) {
log.warn("", e);
//throw new ResourceAdapterInternalException(e);
}
//bind();
log.debug("workManager={}, xaTerminator={}, timer={}", workManager, xaTerminator, timer);
}
示例4: ResourceAdapterImpl
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* Constructor
* @param resourceAdapter The resource adapter
* @param bc The BootstrapContext
* @param configProperties The configuration properties
* @param statistics The statistics
* @param productName The product name
* @param productVersion The product version
* @param messageListeners The message listeners
* @param is16 Is a 1.6+ archive
* @param beanValidation Bean validation
* @param bvGroups The bean validation groups
* @param ti The transaction integration
*/
public ResourceAdapterImpl(javax.resource.spi.ResourceAdapter resourceAdapter,
BootstrapContext bc,
Collection<ConfigProperty> configProperties,
StatisticsPlugin statistics,
String productName, String productVersion,
Map<String, ActivationSpecImpl> messageListeners,
boolean is16, BeanValidation beanValidation, List<String> bvGroups,
TransactionIntegration ti)
{
this.activated = false;
this.resourceAdapter = resourceAdapter;
this.bc = bc;
this.configProperties = configProperties;
this.statistics = statistics;
this.productName = productName;
this.productVersion = productVersion;
this.messageListeners = messageListeners;
this.is16 = is16;
this.beanValidation = beanValidation;
this.bvGroups = bvGroups;
this.activeEndpoints = new HashMap<>();
this.transactionIntegration = ti;
}
示例5: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
try {
Class.forName(ORG_CAMUNDA_BPM_ENGINE_PROCESS_ENGINE);
} catch (Exception e) {
log.info("ProcessEngine classes not found in shared libraries. Not initializing camunda Platform JobExecutor Resource Adapter.");
return;
}
// initialize the ExecutorService (CommonJ or JCA, depending on configuration)
if(isUseCommonJWorkManager) {
if(commonJWorkManagerName != null & commonJWorkManagerName.length() > 0) {
executorServiceWrapper.setExecutorService(new CommonJWorkManagerExecutorService(this, commonJWorkManagerName));
} else {
throw new RuntimeException("Resource Adapter configuration property 'isUseCommonJWorkManager' is set to true but 'commonJWorkManagerName' is not provided.");
}
} else {
executorServiceWrapper.setExecutorService(new JcaWorkManagerExecutorService(this, ctx.getWorkManager()));
}
log.log(Level.INFO, "camunda BPM executor service started.");
}
示例6: postProcessBeanFactory
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addBeanPostProcessor(new BootstrapContextAwareProcessor(this.bootstrapContext));
beanFactory.ignoreDependencyInterface(BootstrapContextAware.class);
beanFactory.registerResolvableDependency(BootstrapContext.class, this.bootstrapContext);
// JCA WorkManager resolved lazily - may not be available.
beanFactory.registerResolvableDependency(WorkManager.class, new ObjectFactory<WorkManager>() {
@Override
public WorkManager getObject() {
return bootstrapContext.getWorkManager();
}
});
}
示例7: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* This implementation loads a Spring ApplicationContext through the
* {@link #createApplicationContext} template method.
*/
@Override
public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
if (logger.isInfoEnabled()) {
logger.info("Starting SpringContextResourceAdapter with BootstrapContext: " + bootstrapContext);
}
this.applicationContext = createApplicationContext(bootstrapContext);
}
示例8: createApplicationContext
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* Build a Spring ApplicationContext for the given JCA BootstrapContext.
* <p>The default implementation builds a {@link ResourceAdapterApplicationContext}
* and delegates to {@link #loadBeanDefinitions} for actually parsing the
* specified configuration files.
* @param bootstrapContext this ResourceAdapter's BootstrapContext
* @return the Spring ApplicationContext instance
*/
protected ConfigurableApplicationContext createApplicationContext(BootstrapContext bootstrapContext) {
ResourceAdapterApplicationContext applicationContext =
new ResourceAdapterApplicationContext(bootstrapContext);
// Set ResourceAdapter's ClassLoader as bean class loader.
applicationContext.setClassLoader(getClass().getClassLoader());
// Extract individual config locations.
String[] configLocations =
StringUtils.tokenizeToStringArray(getContextConfigLocation(), CONFIG_LOCATION_DELIMITERS);
if (configLocations != null) {
loadBeanDefinitions(applicationContext, configLocations);
}
applicationContext.refresh();
return applicationContext;
}
示例9: postProcessBeanFactory
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addBeanPostProcessor(new BootstrapContextAwareProcessor(this.bootstrapContext));
beanFactory.ignoreDependencyInterface(BootstrapContextAware.class);
beanFactory.registerResolvableDependency(BootstrapContext.class, this.bootstrapContext);
// JCA WorkManager resolved lazily - may not be available.
beanFactory.registerResolvableDependency(WorkManager.class, new ObjectFactory<WorkManager>() {
public WorkManager getObject() {
return bootstrapContext.getWorkManager();
}
});
}
示例10: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* This implementation loads a Spring ApplicationContext through the
* {@link #createApplicationContext} template method.
*/
public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
if (logger.isInfoEnabled()) {
logger.info("Starting SpringContextResourceAdapter with BootstrapContext: " + bootstrapContext);
}
this.applicationContext = createApplicationContext(bootstrapContext);
}
示例11: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
@Override
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
log.info("[TrafficResourceAdapter] start()");
/* Get the work manager from the container to submit tasks to
* be executed in container-managed threads */
workManager = ctx.getWorkManager();
}
示例12: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
@Override
public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
this.bootstrapContext = bootstrapContext;
try {
fileSystem = FileSystems.getDefault();
watchService = fileSystem.newWatchService();
} catch (IOException e) {
throw new ResourceAdapterInternalException(e);
}
new FSWatchingThread(watchService, this).start();
}
示例13: start
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void start(BootstrapContext ctx)
throws ResourceAdapterInternalException
{
this.bc = (CloneableBootstrapContext) ctx;
this.workManager = ctx.getWorkManager();
}
示例14: testDeployment
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* Deployment
* @throws Throwable In case of an error
*/
@Test
public void testDeployment() throws Throwable
{
assertNotNull(cf);
assertNotNull(cf2);
TestConnection conn = cf.getConnection();
assertNotNull(conn);
TestConnection conn2 = cf2.getConnection();
assertNotNull(conn2);
assertNotEquals(conn, conn2);
assertNotEquals(conn.getWorkManager(), conn2.getWorkManager());
assertEquals("Default", conn.getWorkManagerName());
assertEquals("WorkManager2", conn2.getWorkManagerName());
assertTrue(conn.getBootstrapContext() instanceof BootstrapContext);
assertTrue(conn.getBootstrapContext() instanceof org.ironjacamar.core.api.bootstrapcontext.BootstrapContext);
assertTrue(conn.getBootstrapContext() instanceof CloneableBootstrapContext);
assertTrue(conn2.getBootstrapContext() instanceof BootstrapContext);
assertTrue(conn2.getBootstrapContext() instanceof org.ironjacamar.core.api.bootstrapcontext.BootstrapContext);
assertTrue(conn2.getBootstrapContext() instanceof CloneableBootstrapContext);
assertNotEquals(((CloneableBootstrapContext) conn.getBootstrapContext()).getId(),
((CloneableBootstrapContext) conn2.getBootstrapContext()).getId());
assertNotEquals(((CloneableBootstrapContext) conn.getBootstrapContext()).getName(),
((CloneableBootstrapContext) conn2.getBootstrapContext()).getName());
assertEquals(conn.getBootstrapContext().getTransactionSynchronizationRegistry(),
conn2.getBootstrapContext().getTransactionSynchronizationRegistry());
conn.close();
conn2.close();
}
示例15: testDeployment
import javax.resource.spi.BootstrapContext; //导入依赖的package包/类
/**
* Deployment
* @throws Throwable In case of an error
*/
@Test
public void testDeployment() throws Throwable
{
assertNotNull(cf);
assertNotNull(cf2);
TestConnection conn = cf.getConnection();
assertNotNull(conn);
TestConnection conn2 = cf2.getConnection();
assertNotNull(conn2);
assertNotEquals(conn, conn2);
assertEquals(conn.getWorkManager(), conn2.getWorkManager());
assertTrue(conn.getBootstrapContext() instanceof BootstrapContext);
assertTrue(conn.getBootstrapContext() instanceof org.ironjacamar.core.api.bootstrapcontext.BootstrapContext);
assertTrue(conn.getBootstrapContext() instanceof CloneableBootstrapContext);
assertEquals(((CloneableBootstrapContext) conn.getBootstrapContext()).getId(),
((CloneableBootstrapContext) conn2.getBootstrapContext()).getId());
assertEquals(((CloneableBootstrapContext) conn.getBootstrapContext()).getName(),
((CloneableBootstrapContext) conn2.getBootstrapContext()).getName());
assertEquals(conn.getBootstrapContext().getTransactionSynchronizationRegistry(),
conn2.getBootstrapContext().getTransactionSynchronizationRegistry());
conn.close();
conn2.close();
}