public static DataSource lookupNonTxResource(ConnectorRuntime connectorRuntime, DeploymentContext ctx, String dataSourceName) throws NamingException { return DataSource.class.cast(connectorRuntime.lookupNonTxResource(getResourceInfo(ctx, dataSourceName), true)); }
private void cleanupConnectorRuntime() { try { Inhabitant<ConnectorRuntime> inhabitant = habitat.getInhabitantByType(ConnectorRuntime.class); if (inhabitant != null && inhabitant.isInstantiated()) { ConnectorRuntime connectorRuntime = inhabitant.get(); connectorRuntime.cleanUpResourcesAndShutdownAllActiveRAs(); } } catch (Throwable t) { _logger.log(Level.SEVERE, "Error in cleanupConnectorRuntime", t); } }
private void createActiveResourceAdapter(String rarModuleName) throws ConnectorRuntimeException { ConnectorRuntime cr = connectorRuntimeProvider.get(); ConnectorRegistry creg = ConnectorRegistry.getInstance(); if (creg.isRegistered(rarModuleName)) return; if (ConnectorAdminServiceUtils.isEmbeddedConnectorModule(rarModuleName)) { cr.createActiveResourceAdapterForEmbeddedRar(rarModuleName); } else { String moduleDir ; if (ConnectorsUtil.belongsToSystemRA(rarModuleName)) { moduleDir = ConnectorsUtil.getSystemModuleLocation(rarModuleName); }else{ moduleDir = configBeansUtilities.getLocation(rarModuleName); } ClassLoader loader = cr.createConnectorClassLoader(moduleDir, null, rarModuleName); cr.createActiveResourceAdapter(moduleDir, rarModuleName, loader); } }
crt.obtainManagedConnectionFactory(poolInfo); Subject subject = new Subject(); PasswordCredential pc = new PasswordCredential( xaresWrapper = (XAResourceWrapper) crt.getConnectorClassLoader().loadClass(wrapperclass). newInstance(); xaresWrapper.init(mc, subject);
private JavaEETransactionManager getTransactionManager() { return runtime.getTransactionManager(); }
try { ClassLoader ccl = getConnectorRuntime().getConnectorClassLoader(); Thread.currentThread().setContextClassLoader(ccl); switch (type) {
ConnectorRuntime cr = EjbContainerUtilImpl.getInstance().getDefaultHabitat() .getByContract(ConnectorRuntime.class); timeout = cr.getShutdownTimeout(); } catch (Throwable th) { _logger.log(Level.WARNING, "[MDBContainer] Got exception while trying " +
public java.lang.Object run() throws Exception { String module = ConnectorConstants.DEFAULT_JMS_ADAPTER; String loc = ConnectorsUtil.getSystemModuleLocation(module); connectorRuntime.createActiveResourceAdapter(loc, module, null); return (ActiveJmsResourceAdapter) ConnectorRegistry.getInstance(). getActiveResourceAdapter(module); } });
/** * sets the execution context for the work (traditional, 1.5 way) * * @param ec ExecutionContext * @throws WorkException when unable to setup the execution context */ private void setupExecutionContext(ExecutionContext ec) throws WorkException { JavaEETransactionManager tm = runtime.getTransactionManager(); if (ec != null && ec.getXid() != null) { tm.recreate(ec.getXid(), ec.getTransactionTimeout()); } }
try { ClassLoader ccl = getConnectorRuntime().getConnectorClassLoader(); Thread.currentThread().setContextClassLoader(ccl); switch (type) {
ConnectorRuntime cr = ejbContainerUtilImpl.getServices() .getService(ConnectorRuntime.class); timeout = cr.getShutdownTimeout(); } catch (Throwable th) { _logger.log(Level.WARNING, "[MDBContainer] Got exception while trying " +
private void lookupTimerResource() throws Exception { String resource_name = ejbContainerUtil.getTimerResource(); ConnectorRuntime connectorRuntime = ejbContainerUtil.getDefaultHabitat().getByContract(ConnectorRuntime.class); timerDataSource = DataSource.class.cast(connectorRuntime.lookupNonTxResource(resource_name, false)); }
private void cleanupConnectorRuntime() { try { /* Providers<ConnectorRuntime> txProviders = habitat.forContract(ConnectorRuntime.class); if (txProviders != null) { Provider<ConnectorRuntime> provider = txProviders.getProvider(); if (provider != null && provider.isActive()) { ConnectorRuntime connectorRuntime = provider.get(); connectorRuntime.cleanUpResourcesAndShutdownAllActiveRAs(); } } */ ServiceHandle<ConnectorRuntime> inhabitant = habitat.getServiceHandle(ConnectorRuntime.class); if (inhabitant != null && inhabitant.isActive()) { ConnectorRuntime connectorRuntime = inhabitant.getService(); connectorRuntime.cleanUpResourcesAndShutdownAllActiveRAs(); } } catch (Throwable t) { _logger.log(Level.SEVERE, "Error in cleanupConnectorRuntime", t); } }
JavaEETransactionManager tm = getConnectorRuntime().getTransactionManager(); List list = tm.getExistingResourceList(comp, invToUse); if (list == null) {
private void lookupTimerResource() throws Exception { String resource_name = getTimerResource(); ConnectorRuntime connectorRuntime = ejbContainerUtil.getServices().getService(ConnectorRuntime.class); timerDataSource = DataSource.class.cast(connectorRuntime.lookupNonTxResource(resource_name, false)); }
/** * Do cleanup of system-resource-adapter, resources, pools */ public void preDestroy() { if (isConnectorRuntimeInitialized()) { Collection<Resource> resources = ConnectorsUtil.getAllSystemRAResourcesAndPools(domain.getResources()); undeployResources(resources); ConnectorRuntime cr = getConnectorRuntime(); if (cr != null) { // clean up will take care of any system RA resources, pools // (including pools via datasource-definition) cr.cleanUpResourcesAndShutdownAllActiveRAs(); } } else { if(logger.isLoggable(Level.FINEST)) { logger.finest("ConnectorRuntime not initialized, hence skipping " + "resource-adapters shutdown, resources, pools cleanup"); } } removeListenerForAllResources(); removeListenerForResources(); removeListenerForResourceRefs(); removeListenerForServer(); }
(DataSource)cr.lookupNonTxResource(dsJndi,false);
(DataSource)cr.lookupNonTxResource(dsJndi,false);
(DataSource) connectorRuntime.lookupNonTxResource(dsJndi,false);