private void performCoreEnvironmentBootTime(OperationContext context, ModelNode coreEnvModel) throws OperationFailedException { // Configure the core configuration. final String nodeIdentifier = TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.resolveModelAttribute(context, coreEnvModel).asString(); TransactionLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s%n", nodeIdentifier); final CoreEnvironmentService coreEnvironmentService = new CoreEnvironmentService(nodeIdentifier); String socketBindingName = null; if (TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.resolveModelAttribute(context, coreEnvModel).asBoolean(false)) { // Use the UUID based id UuidProcessId id = new UuidProcessId(); coreEnvironmentService.setProcessImplementation(id); } else { // Use the socket process id coreEnvironmentService.setProcessImplementationClassName(ProcessIdType.SOCKET.getClazz()); socketBindingName = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.resolveModelAttribute(context, coreEnvModel).asString(); int ports = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS.resolveModelAttribute(context, coreEnvModel).asInt(); coreEnvironmentService.setSocketProcessIdMaxPorts(ports); } final ServiceBuilder<?> coreEnvBuilder = context.getServiceTarget().addService(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT, coreEnvironmentService); if (socketBindingName != null) { // Add a dependency on the socket id binding ServiceName bindingName = SocketBinding.JBOSS_BINDING_NAME.append(socketBindingName); coreEnvBuilder.addDependency(bindingName, SocketBinding.class, coreEnvironmentService.getSocketProcessBindingInjector()); } coreEnvBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install(); }
/** * Returns an instance of a class implementing com.arjuna.ats.arjuna.utils.Process. * * If there is no pre-instantiated instance set and classloading or instantiation fails, * this method will log an appropriate warning and return null, not throw an exception. * * @return a Process implementation instance, or null. */ public Process getProcessImplementation() { if(processImplementation == null && processImplementationClassName != null) { synchronized(this) { if(processImplementation == null && processImplementationClassName != null) { try { processImplementation = ClassloadingUtility.loadAndInstantiateClass(Process.class, processImplementationClassName, null); } catch (final java.lang.NoClassDefFoundError ex) { if (Utility.isAndroid()) // todo android return new AndroidProcessId(); else throw ex; } } } } return processImplementation; }
/** * @message com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2 [com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2] - SocketProcessId.getpid could not get unique port. */ public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.log_mesg.getString("com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2")); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
/** * Returns an instance of a class implementing com.arjuna.ats.arjuna.utils.Process. * * If there is no pre-instantiated instance set and classloading or instantiation fails, * this method will log an appropriate warning and return null, not throw an exception. * * @return a Process implementation instance, or null. */ public Process getProcessImplementation() { if(processImplementation == null && processImplementationClassName != null) { synchronized(this) { if(processImplementation == null && processImplementationClassName != null) { try { processImplementation = ClassloadingUtility.loadAndInstantiateClass(Process.class, processImplementationClassName, null); } catch (final java.lang.NoClassDefFoundError ex) { if (Utility.isAndroid()) // todo android return new AndroidProcessId(); else throw ex; } } } } return processImplementation; }
@Override public void start(StartContext context) throws StartException { // Global configuration. final CoreEnvironmentBean coreEnvironmentBean = arjPropertyManager.getCoreEnvironmentBean(); if(coreEnvironmentBean.getProcessImplementationClassName() == null) { UuidProcessId id = new UuidProcessId(); coreEnvironmentBean.setProcessImplementation(id); } try { coreEnvironmentBean.setNodeIdentifier(nodeIdentifier); } catch (CoreEnvironmentBeanException e) { throw new StartException(e.getCause()); } // Setup the socket process id if there is a binding SocketBinding binding = socketProcessBindingInjector.getOptionalValue(); if(binding != null) { int port = binding.getPort(); coreEnvironmentBean.setSocketProcessIdPort(port); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
/** * Returns an instance of a class implementing com.arjuna.ats.arjuna.utils.Process. * * If there is no pre-instantiated instance set and classloading or instantiation fails, * this method will log an appropriate warning and return null, not throw an exception. * * @return a Process implementation instance, or null. */ public Process getProcessImplementation() { if(processImplementation == null && processImplementationClassName != null) { synchronized(this) { if(processImplementation == null && processImplementationClassName != null) { try { processImplementation = ClassloadingUtility.loadAndInstantiateClass(Process.class, processImplementationClassName, null); } catch (final java.lang.NoClassDefFoundError ex) { if (Utility.isAndroid()) // todo android return new AndroidProcessId(); else throw ex; } } } } return processImplementation; }
private void performCoreEnvironmentBootTime(OperationContext context, ModelNode coreEnvModel) throws OperationFailedException { // Configure the core configuration. final String nodeIdentifier = TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.resolveModelAttribute(context, coreEnvModel).asString(); TransactionLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s%n", nodeIdentifier); final CoreEnvironmentService coreEnvironmentService = new CoreEnvironmentService(nodeIdentifier); String socketBindingName = null; if (TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.resolveModelAttribute(context, coreEnvModel).asBoolean(false)) { // Use the UUID based id UuidProcessId id = new UuidProcessId(); coreEnvironmentService.setProcessImplementation(id); } else { // Use the socket process id coreEnvironmentService.setProcessImplementationClassName(ProcessIdType.SOCKET.getClazz()); socketBindingName = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.resolveModelAttribute(context, coreEnvModel).asString(); int ports = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS.resolveModelAttribute(context, coreEnvModel).asInt(); coreEnvironmentService.setSocketProcessIdMaxPorts(ports); } final ServiceBuilder<?> coreEnvBuilder = context.getServiceTarget().addService(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT, coreEnvironmentService); if (socketBindingName != null) { // Add a dependency on the socket id binding ServiceName bindingName = SocketBinding.JBOSS_BINDING_NAME.append(socketBindingName); coreEnvBuilder.addDependency(bindingName, SocketBinding.class, coreEnvironmentService.getSocketProcessBindingInjector()); } coreEnvBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install(); }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
private void performCoreEnvironmentBootTime(OperationContext context, ModelNode coreEnvModel) throws OperationFailedException { // Configure the core configuration. final String nodeIdentifier = TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.resolveModelAttribute(context, coreEnvModel).asString(); TransactionLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s%n", nodeIdentifier); final CoreEnvironmentService coreEnvironmentService = new CoreEnvironmentService(nodeIdentifier); String socketBindingName = null; if (TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.resolveModelAttribute(context, coreEnvModel).asBoolean(false)) { // Use the UUID based id UuidProcessId id = new UuidProcessId(); coreEnvironmentService.setProcessImplementation(id); } else { // Use the socket process id coreEnvironmentService.setProcessImplementationClassName(ProcessIdType.SOCKET.getClazz()); socketBindingName = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.resolveModelAttribute(context, coreEnvModel).asString(); int ports = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS.resolveModelAttribute(context, coreEnvModel).asInt(); coreEnvironmentService.setSocketProcessIdMaxPorts(ports); } final ServiceBuilder<?> coreEnvBuilder = context.getServiceTarget().addService(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT, coreEnvironmentService); if (socketBindingName != null) { // Add a dependency on the socket id binding ServiceName bindingName = SocketBinding.JBOSS_BINDING_NAME.append(socketBindingName); coreEnvBuilder.addDependency(bindingName, SocketBinding.class, coreEnvironmentService.getSocketProcessBindingInjector()); } coreEnvBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install(); }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
@Override public void start(StartContext context) throws StartException { // Global configuration. final CoreEnvironmentBean coreEnvironmentBean = arjPropertyManager.getCoreEnvironmentBean(); if(coreEnvironmentBean.getProcessImplementationClassName() == null) { UuidProcessId id = new UuidProcessId(); coreEnvironmentBean.setProcessImplementation(id); } try { coreEnvironmentBean.setNodeIdentifier(nodeIdentifier); } catch (CoreEnvironmentBeanException e) { throw new StartException(e.getCause()); } // Setup the socket process id if there is a binding SocketBinding binding = socketProcessBindingInjector.getOptionalValue(); if(binding != null) { int port = binding.getPort(); coreEnvironmentBean.setSocketProcessIdPort(port); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
@Override public void start(StartContext context) throws StartException { // Global configuration. final CoreEnvironmentBean coreEnvironmentBean = arjPropertyManager.getCoreEnvironmentBean(); if(coreEnvironmentBean.getProcessImplementationClassName() == null) { UuidProcessId id = new UuidProcessId(); coreEnvironmentBean.setProcessImplementation(id); } try { coreEnvironmentBean.setNodeIdentifier(nodeIdentifier); } catch (CoreEnvironmentBeanException e) { throw new StartException(e.getCause()); } // Setup the socket process id if there is a binding SocketBinding binding = socketProcessBindingInjector.getOptionalValue(); if(binding != null) { int port = binding.getPort(); coreEnvironmentBean.setSocketProcessIdPort(port); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }
public SocketProcessId() { int port = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdPort(); int maxPorts = arjPropertyManager.getCoreEnvironmentBean().getSocketProcessIdMaxPorts(); int maxPort; if (maxPorts <= 1) { maxPort = port; } else if (Utility.MAX_PORT - maxPorts < port) { maxPort = Utility.MAX_PORT; } else { maxPort = port + maxPorts; } do { _theSocket = createSocket(port); } while (_theSocket == null && ++port < maxPort); _thePort = ((_theSocket == null) ? -1 : _theSocket.getLocalPort()); if (_thePort == -1) { throw new FatalError(tsLogger.i18NLogger.get_utils_SocketProcessId_2()); } }