Search in sources :

Example 1 with SocketBinding

use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.

the class UndertowConnectorTestCase method getAddress.

@Test
public void getAddress() throws UnknownHostException {
    InetAddress expected = InetAddress.getLocalHost();
    NetworkInterfaceBinding interfaceBinding = new NetworkInterfaceBinding(Collections.<NetworkInterface>emptySet(), expected);
    SocketBindingManager bindingManager = mock(SocketBindingManager.class);
    SocketBinding binding = new SocketBinding("socket", 1, true, null, 0, interfaceBinding, bindingManager, Collections.<ClientMapping>emptyList());
    when(this.listener.getSocketBinding()).thenReturn(binding);
    InetAddress result = this.connector.getAddress();
    assertSame(expected, result);
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding) NetworkInterfaceBinding(org.jboss.as.network.NetworkInterfaceBinding) InetAddress(java.net.InetAddress) SocketBindingManager(org.jboss.as.network.SocketBindingManager) Test(org.junit.Test)

Example 2 with SocketBinding

use of org.jboss.as.network.SocketBinding 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);
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding) ExpiredContactScanner(com.arjuna.ats.internal.jts.recovery.contact.ExpiredContactScanner) AtomicActionRecoveryModule(com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule) ExpiredTransactionStatusManagerScanner(com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner) ArrayList(java.util.ArrayList) TopLevelTransactionRecoveryModule(com.arjuna.ats.internal.jts.recovery.transactions.TopLevelTransactionRecoveryModule) ManagedBinding(org.jboss.as.network.ManagedBinding) CommitMarkableResourceRecordRecoveryModule(com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule) RecoveryManagerService(com.arjuna.ats.jbossatx.jta.RecoveryManagerService) PostInitLoader(com.arjuna.orbportability.internal.utils.PostInitLoader) StartException(org.jboss.msc.service.StartException) ExpiredToplevelScanner(com.arjuna.ats.internal.jts.recovery.transactions.ExpiredToplevelScanner) TORecoveryModule(com.arjuna.ats.internal.txoj.recovery.TORecoveryModule) RecoveryEnvironmentBean(com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean) RecoverySuspendController(org.jboss.as.txn.suspend.RecoverySuspendController) JCAServerTransactionRecoveryModule(com.arjuna.ats.internal.jta.recovery.jts.JCAServerTransactionRecoveryModule) ServerTransactionRecoveryModule(com.arjuna.ats.internal.jts.recovery.transactions.ServerTransactionRecoveryModule) JCAServerTransactionRecoveryModule(com.arjuna.ats.internal.jta.recovery.jts.JCAServerTransactionRecoveryModule) ExpiredServerScanner(com.arjuna.ats.internal.jts.recovery.transactions.ExpiredServerScanner) ORB(org.omg.CORBA.ORB)

Example 3 with SocketBinding

use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.

the class ListenerService method unregisterBinding.

protected void unregisterBinding() {
    final SocketBinding binding = this.binding.getValue();
    binding.getSocketBindings().getNamedRegistry().unregisterBinding(binding.getName());
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding)

Example 4 with SocketBinding

use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.

the class Server method registerListener.

protected void registerListener(ListenerService listener) {
    listeners.add(listener);
    if (!listener.isSecure()) {
        SocketBinding binding = listener.getBinding().getValue();
        SocketBinding redirectBinding = listener.getRedirectSocket().getOptionalValue();
        if (redirectBinding != null) {
            securePortMappings.put(binding.getAbsolutePort(), redirectBinding.getAbsolutePort());
        } else {
            securePortMappings.put(binding.getAbsolutePort(), -1);
        }
    }
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding)

Example 5 with SocketBinding

use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.

the class Server method unregisterListener.

protected void unregisterListener(ListenerService listener) {
    listeners.remove(listener);
    if (!listener.isSecure()) {
        SocketBinding binding = listener.getBinding().getValue();
        securePortMappings.remove(binding.getAbsolutePort());
    }
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding)

Aggregations

SocketBinding (org.jboss.as.network.SocketBinding)13 InetSocketAddress (java.net.InetSocketAddress)3 StartException (org.jboss.msc.service.StartException)3 InetAddress (java.net.InetAddress)2 ArrayList (java.util.ArrayList)2 NetworkInterfaceBinding (org.jboss.as.network.NetworkInterfaceBinding)2 OutboundSocketBinding (org.jboss.as.network.OutboundSocketBinding)2 SocketBindingManager (org.jboss.as.network.SocketBindingManager)2 Test (org.junit.Test)2 CoreEnvironmentBean (com.arjuna.ats.arjuna.common.CoreEnvironmentBean)1 CoreEnvironmentBeanException (com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException)1 RecoveryEnvironmentBean (com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean)1 AtomicActionRecoveryModule (com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule)1 ExpiredTransactionStatusManagerScanner (com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner)1 UuidProcessId (com.arjuna.ats.internal.arjuna.utils.UuidProcessId)1 CommitMarkableResourceRecordRecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule)1 JCAServerTransactionRecoveryModule (com.arjuna.ats.internal.jta.recovery.jts.JCAServerTransactionRecoveryModule)1 ExpiredContactScanner (com.arjuna.ats.internal.jts.recovery.contact.ExpiredContactScanner)1 ExpiredServerScanner (com.arjuna.ats.internal.jts.recovery.transactions.ExpiredServerScanner)1 ExpiredToplevelScanner (com.arjuna.ats.internal.jts.recovery.transactions.ExpiredToplevelScanner)1