use of com.arjuna.ats.jbossatx.jta.RecoveryManagerService in project wildfly by wildfly.
the class ArjunaRecoveryManagerService method start.
public synchronized void start(StartContext context) throws StartException {
// Recovery env bean
final RecoveryEnvironmentBean recoveryEnvironmentBean = recoveryPropertyManager.getRecoveryEnvironmentBean();
final SocketBinding recoveryBinding = recoveryBindingInjector.getValue();
recoveryEnvironmentBean.setRecoveryInetAddress(recoveryBinding.getSocketAddress().getAddress());
recoveryEnvironmentBean.setRecoveryPort(recoveryBinding.getSocketAddress().getPort());
final SocketBinding statusBinding = statusBindingInjector.getValue();
recoveryEnvironmentBean.setTransactionStatusManagerInetAddress(statusBinding.getSocketAddress().getAddress());
recoveryEnvironmentBean.setTransactionStatusManagerPort(statusBinding.getSocketAddress().getPort());
recoveryEnvironmentBean.setRecoveryListener(recoveryListener);
if (recoveryListener) {
ManagedBinding binding = ManagedBinding.Factory.createSimpleManagedBinding(recoveryBinding);
bindingManager.getValue().getNamedRegistry().registerBinding(binding);
}
final List<String> recoveryExtensions = new ArrayList<String>();
// must be first
recoveryExtensions.add(CommitMarkableResourceRecordRecoveryModule.class.getName());
recoveryExtensions.add(AtomicActionRecoveryModule.class.getName());
recoveryExtensions.add(TORecoveryModule.class.getName());
final List<String> expiryScanners;
if (System.getProperty("RecoveryEnvironmentBean.expiryScannerClassNames") != null) {
expiryScanners = recoveryEnvironmentBean.getExpiryScannerClassNames();
} else {
expiryScanners = new ArrayList<String>();
expiryScanners.add(ExpiredTransactionStatusManagerScanner.class.getName());
}
if (!jts) {
recoveryExtensions.add(com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.class.getName());
recoveryEnvironmentBean.setRecoveryModuleClassNames(recoveryExtensions);
recoveryEnvironmentBean.setExpiryScannerClassNames(expiryScanners);
recoveryEnvironmentBean.setRecoveryActivators(null);
final RecoveryManagerService recoveryManagerService = new RecoveryManagerService();
try {
recoveryManagerService.create();
} catch (Exception e) {
throw TransactionLogger.ROOT_LOGGER.managerStartFailure(e, "Recovery");
}
recoveryManagerService.start();
this.recoveryManagerService = recoveryManagerService;
} else {
final ORB orb = orbInjector.getValue();
new PostInitLoader(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"), orb);
recoveryExtensions.add(TopLevelTransactionRecoveryModule.class.getName());
recoveryExtensions.add(ServerTransactionRecoveryModule.class.getName());
recoveryExtensions.add(JCAServerTransactionRecoveryModule.class.getName());
recoveryExtensions.add(com.arjuna.ats.internal.jta.recovery.jts.XARecoveryModule.class.getName());
expiryScanners.add(ExpiredContactScanner.class.getName());
expiryScanners.add(ExpiredToplevelScanner.class.getName());
expiryScanners.add(ExpiredServerScanner.class.getName());
recoveryEnvironmentBean.setRecoveryModuleClassNames(recoveryExtensions);
recoveryEnvironmentBean.setExpiryScannerClassNames(expiryScanners);
recoveryEnvironmentBean.setRecoveryActivatorClassNames(Collections.singletonList(com.arjuna.ats.internal.jts.orbspecific.recovery.RecoveryEnablement.class.getName()));
try {
final RecoveryManagerService recoveryManagerService = new com.arjuna.ats.jbossatx.jts.RecoveryManagerService(orb);
recoveryManagerService.create();
recoveryManagerService.start();
this.recoveryManagerService = recoveryManagerService;
} catch (Exception e) {
throw TransactionLogger.ROOT_LOGGER.managerStartFailure(e, "Recovery");
}
}
recoverySuspendController = new RecoverySuspendController(recoveryManagerService);
suspendControllerInjector.getValue().registerActivity(recoverySuspendController);
}
use of com.arjuna.ats.jbossatx.jta.RecoveryManagerService in project wildfly by wildfly.
the class TransactionSubsystemAdd method performRecoveryEnvBoottime.
private void performRecoveryEnvBoottime(OperationContext context, ModelNode model, final boolean jts, List<ServiceName> deps) throws OperationFailedException {
//recovery environment
final String recoveryBindingName = TransactionSubsystemRootResourceDefinition.BINDING.resolveModelAttribute(context, model).asString();
final String recoveryStatusBindingName = TransactionSubsystemRootResourceDefinition.STATUS_BINDING.resolveModelAttribute(context, model).asString();
final boolean recoveryListener = TransactionSubsystemRootResourceDefinition.RECOVERY_LISTENER.resolveModelAttribute(context, model).asBoolean();
final ArjunaRecoveryManagerService recoveryManagerService = new ArjunaRecoveryManagerService(recoveryListener, jts);
final ServiceBuilder<RecoveryManagerService> recoveryManagerServiceServiceBuilder = context.getServiceTarget().addService(TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER, recoveryManagerService);
// add dependency on JTA environment bean
recoveryManagerServiceServiceBuilder.addDependencies(deps);
// Register WildFly transaction services - TODO: this should eventually be separated from the Narayana subsystem
final LocalTransactionContextService localTransactionContextService = new LocalTransactionContextService();
context.getServiceTarget().addService(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, localTransactionContextService).addDependency(TxnServices.JBOSS_TXN_EXTENDED_JBOSS_XA_TERMINATOR, ExtendedJBossXATerminator.class, localTransactionContextService.getExtendedJBossXATerminatorInjector()).addDependency(TxnServices.JBOSS_TXN_ARJUNA_TRANSACTION_MANAGER, com.arjuna.ats.jbossatx.jta.TransactionManagerService.class, localTransactionContextService.getTransactionManagerInjector()).addDependency(// no injection
TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER).setInitialMode(Mode.ACTIVE).install();
if (context.hasOptionalCapability("org.wildfly.remoting.endpoint", TransactionSubsystemRootResourceDefinition.TRANSACTION_CAPABILITY.getName(), null)) {
final RemotingTransactionServiceService remoteTransactionServiceService = new RemotingTransactionServiceService();
context.getServiceTarget().addService(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE, remoteTransactionServiceService).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, remoteTransactionServiceService.getLocalTransactionContextInjector()).addDependency(RemotingServices.SUBSYSTEM_ENDPOINT, Endpoint.class, remoteTransactionServiceService.getEndpointInjector()).setInitialMode(Mode.ACTIVE).install();
}
if (context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, TransactionSubsystemRootResourceDefinition.TRANSACTION_CAPABILITY.getName(), null)) {
final TransactionRemoteHTTPService remoteHTTPService = new TransactionRemoteHTTPService();
context.getServiceTarget().addService(TxnServices.JBOSS_TXN_HTTP_REMOTE_TRANSACTION_SERVICE, remoteHTTPService).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, remoteHTTPService.getLocalTransactionContextInjectedValue()).addDependency(context.getCapabilityServiceName(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, PathHandler.class), PathHandler.class, remoteHTTPService.getPathHandlerInjectedValue()).install();
}
final XATerminatorService xaTerminatorService;
final ExtendedJBossXATerminatorService extendedJBossXATerminatorService;
if (jts) {
recoveryManagerServiceServiceBuilder.addDependency(ServiceName.JBOSS.append("iiop-openjdk", "orb-service"), ORB.class, recoveryManagerService.getOrbInjector());
com.arjuna.ats.internal.jbossatx.jts.jca.XATerminator terminator = new com.arjuna.ats.internal.jbossatx.jts.jca.XATerminator();
xaTerminatorService = new XATerminatorService(terminator);
extendedJBossXATerminatorService = new ExtendedJBossXATerminatorService(terminator);
} else {
com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator terminator = new com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator();
xaTerminatorService = new XATerminatorService(terminator);
extendedJBossXATerminatorService = new ExtendedJBossXATerminatorService(terminator);
}
context.getServiceTarget().addService(TxnServices.JBOSS_TXN_XA_TERMINATOR, xaTerminatorService).setInitialMode(Mode.ACTIVE).install();
context.getServiceTarget().addService(TxnServices.JBOSS_TXN_EXTENDED_JBOSS_XA_TERMINATOR, extendedJBossXATerminatorService).setInitialMode(Mode.ACTIVE).install();
final JBossContextXATerminatorService contextXATerminatorService = new JBossContextXATerminatorService();
context.getServiceTarget().addService(TxnServices.JBOSS_TXN_CONTEXT_XA_TERMINATOR, contextXATerminatorService).addDependency(TxnServices.JBOSS_TXN_XA_TERMINATOR, JBossXATerminator.class, contextXATerminatorService.getJBossXATerminatorInjector()).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, contextXATerminatorService.getLocalTransactionContextInjector()).setInitialMode(Mode.ACTIVE).install();
recoveryManagerServiceServiceBuilder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(recoveryBindingName), SocketBinding.class, recoveryManagerService.getRecoveryBindingInjector()).addDependency(SocketBinding.JBOSS_BINDING_NAME.append(recoveryStatusBindingName), SocketBinding.class, recoveryManagerService.getStatusBindingInjector()).addDependency(SocketBindingManager.SOCKET_BINDING_MANAGER, SocketBindingManager.class, recoveryManagerService.getBindingManager()).addDependency(SuspendController.SERVICE_NAME, SuspendController.class, recoveryManagerService.getSuspendControllerInjector()).addDependency(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT).addDependency(TxnServices.JBOSS_TXN_ARJUNA_OBJECTSTORE_ENVIRONMENT).setInitialMode(ServiceController.Mode.ACTIVE).install();
}
use of com.arjuna.ats.jbossatx.jta.RecoveryManagerService in project narayana by jbosstm.
the class ServerImpl method initialise.
public void initialise(LookupProvider lookupProvider, String nodeName, int portOffset, String[] clusterBuddies, ClassLoader classLoaderForTransactionManager) throws CoreEnvironmentBeanException, IOException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
this.nodeName = nodeName;
this.classLoaderForTransactionManager = classLoaderForTransactionManager;
RecoveryEnvironmentBean recoveryEnvironmentBean = com.arjuna.ats.arjuna.common.recoveryPropertyManager.getRecoveryEnvironmentBean();
recoveryEnvironmentBean.setRecoveryBackoffPeriod(1);
recoveryEnvironmentBean.setRecoveryInetAddress(InetAddress.getByName("localhost"));
recoveryEnvironmentBean.setRecoveryPort(4712 + portOffset);
recoveryEnvironmentBean.setTransactionStatusManagerInetAddress(InetAddress.getByName("localhost"));
recoveryEnvironmentBean.setTransactionStatusManagerPort(4713 + portOffset);
List<String> recoveryModuleClassNames = new ArrayList<String>();
recoveryModuleClassNames.add("com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule");
// recoveryModuleClassNames.add("com.arjuna.ats.internal.txoj.recovery.TORecoveryModule");
recoveryModuleClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule");
recoveryModuleClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule");
recoveryEnvironmentBean.setRecoveryModuleClassNames(recoveryModuleClassNames);
List<String> expiryScannerClassNames = new ArrayList<String>();
expiryScannerClassNames.add("com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner");
recoveryEnvironmentBean.setExpiryScannerClassNames(expiryScannerClassNames);
recoveryEnvironmentBean.setRecoveryActivators(null);
CoreEnvironmentBean coreEnvironmentBean = com.arjuna.ats.arjuna.common.arjPropertyManager.getCoreEnvironmentBean();
// coreEnvironmentBean.setSocketProcessIdPort(4714 + nodeName);
coreEnvironmentBean.setNodeIdentifier(nodeName);
// coreEnvironmentBean.setSocketProcessIdMaxPorts(1);
coreEnvironmentBean.setProcessImplementationClassName(ManualProcessId.class.getName());
coreEnvironmentBean.setPid(portOffset);
CoordinatorEnvironmentBean coordinatorEnvironmentBean = com.arjuna.ats.arjuna.common.arjPropertyManager.getCoordinatorEnvironmentBean();
coordinatorEnvironmentBean.setEnableStatistics(false);
coordinatorEnvironmentBean.setDefaultTimeout(300);
coordinatorEnvironmentBean.setTransactionStatusManagerEnable(false);
coordinatorEnvironmentBean.setDefaultTimeout(0);
ObjectStoreEnvironmentBean actionStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, null);
actionStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/distributedjta-tests/tx-object-store/" + nodeName);
ObjectStoreEnvironmentBean stateStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "stateStore");
stateStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/distributedjta-tests/tx-object-store/" + nodeName);
ObjectStoreEnvironmentBean communicationStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "communicationStore");
communicationStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/distributedjta-tests/tx-object-store/" + nodeName);
JTAEnvironmentBean jTAEnvironmentBean = com.arjuna.ats.jta.common.jtaPropertyManager.getJTAEnvironmentBean();
jTAEnvironmentBean.setLastResourceOptimisationInterface(org.jboss.tm.LastResource.class);
jTAEnvironmentBean.setTransactionManagerClassName("com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate");
jTAEnvironmentBean.setUserTransactionClassName("com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple");
jTAEnvironmentBean.setTransactionSynchronizationRegistryClassName("com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple");
List<String> xaRecoveryNodes = new ArrayList<String>();
xaRecoveryNodes.add(nodeName);
jTAEnvironmentBean.setXaRecoveryNodes(xaRecoveryNodes);
List<String> xaResourceOrphanFilterClassNames = new ArrayList<String>();
xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter");
xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter");
xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateJTAXAResourceOrphanFilter");
xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinationManagerXAResourceOrphanFilter");
jTAEnvironmentBean.setXaResourceOrphanFilterClassNames(xaResourceOrphanFilterClassNames);
jTAEnvironmentBean.setXAResourceRecordWrappingPlugin(new XAResourceRecordWrappingPluginImpl());
recoveryManagerService = new RecoveryManagerService();
recoveryManagerService.create();
recoveryManagerService.addXAResourceRecovery(new TestResourceRecovery(nodeName));
// This MUST be the last XAResourceRecovery class registered or you will
// get unexpected recovery results, could add a specific interface for
// this?
recoveryManagerService.addXAResourceRecovery(new ProxyXAResourceRecovery(nodeName, clusterBuddies));
recoveryManagerService.addSerializableXAResourceDeserializer(new ProxyXAResourceDeserializer());
// recoveryManagerService.start();
_recoveryManager = RecoveryManager.manager();
RecoveryManager.manager().initialize();
transactionManagerService = new TransactionManagerService();
TxControl txControl = new com.arjuna.ats.arjuna.coordinator.TxControl();
transactionManagerService.setJbossXATerminator(new com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator());
transactionManagerService.setTransactionSynchronizationRegistry(new com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple());
transactionManagerService.create();
}
use of com.arjuna.ats.jbossatx.jta.RecoveryManagerService in project narayana by jbosstm.
the class OsgiServer method doStart.
public void doStart() throws Exception {
Properties properties = PropertiesFactory.getDefaultProperties();
if (configuration != null) {
for (Enumeration<String> keyEnum = configuration.keys(); keyEnum.hasMoreElements(); ) {
String key = keyEnum.nextElement();
String val = configuration.get(key).toString();
properties.put(key, val);
}
}
OsgiTransactionManager transactionManager = new OsgiTransactionManager();
JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
jtaEnvironmentBean.setTransactionManager(transactionManager);
jtaEnvironmentBean.setUserTransaction(transactionManager);
RecoveryManagerService rmSvc = new RecoveryManagerService();
rmSvc.create();
recoveryManagerService = rmSvc;
resourceRecoveryTracker = new ServiceTracker<>(bundleContext, XAResourceRecovery.class, this);
TransactionManagerService tmSvc = new TransactionManagerService();
tmSvc.setTransactionSynchronizationRegistry(jtaEnvironmentBean.getTransactionSynchronizationRegistry());
tmSvc.create();
transactionManagerService = tmSvc;
ObjStoreBrowser osb = new ObjStoreBrowser();
osb.setExposeAllRecordsAsMBeans(true);
objStoreBrowserService = new ObjStoreBrowserImpl(osb);
resourceRecoveryTracker.open();
transactionManagerService.start();
recoveryManagerService.start();
objStoreBrowserService.start();
register(TransactionManager.class, transactionManagerService.getTransactionManager());
register(TransactionSynchronizationRegistry.class, transactionManagerService.getTransactionSynchronizationRegistry());
register(UserTransaction.class, transactionManagerService.getUserTransaction());
register(ObjStoreBrowserService.class, objStoreBrowserService);
try {
registrations.add(PlatformTransactionManagerImple.register(bundleContext, (OsgiTransactionManager) transactionManagerService.getTransactionManager()));
} catch (Throwable t) {
// Ignore, this is most certainly spring-tx which is not available
}
}
Aggregations