Search in sources :

Example 1 with ServiceRegistrationException

use of org.jboss.remoting3.ServiceRegistrationException in project wildfly by wildfly.

the class RemotingTransactionServiceService method start.

public void start(final StartContext context) throws StartException {
    final RemotingTransactionService remotingTransactionService = RemotingTransactionService.builder().setEndpoint(endpointInjector.getValue()).setTransactionContext(localTransactionContextInjector.getValue()).build();
    try {
        registration = remotingTransactionService.register();
    } catch (ServiceRegistrationException e) {
        throw new StartException(e);
    }
    value = remotingTransactionService;
}
Also used : ServiceRegistrationException(org.jboss.remoting3.ServiceRegistrationException) StartException(org.jboss.msc.service.StartException) RemotingTransactionService(org.wildfly.transaction.client.provider.remoting.RemotingTransactionService)

Example 2 with ServiceRegistrationException

use of org.jboss.remoting3.ServiceRegistrationException in project wildfly by wildfly.

the class EJBRemoteConnectorService method start.

@Override
public void start(StartContext context) throws StartException {
    final AssociationService associationService = associationServiceInjectedValue.getValue();
    final Endpoint endpoint = endpointValue.getValue();
    Executor executor = executorService.getOptionalValue();
    if (executor != null) {
        associationService.setExecutor(executor);
    }
    RemoteEJBService remoteEJBService = RemoteEJBService.create(associationService.getAssociation(), remotingTransactionServiceInjectedValue.getValue());
    final ControlledProcessStateService processStateService = controlledProcessStateServiceInjectedValue.getValue();
    if (processStateService.getCurrentState() == ControlledProcessState.State.STARTING) {
        final PropertyChangeListener listener = new PropertyChangeListener() {

            public void propertyChange(final PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals("currentState") && evt.getOldValue() == ControlledProcessState.State.STARTING) {
                    remoteEJBService.serverUp();
                    // can't use a lambda because of this line...
                    processStateService.removePropertyChangeListener(this);
                }
            }
        };
        processStateService.addPropertyChangeListener(listener);
        // this is actually racy, so we have to double-check the state afterwards just to be sure it didn't transition before we got here.
        if (processStateService.getCurrentState() != ControlledProcessState.State.STARTING) {
            // this method is idempotent so it's OK if the listener got fired
            remoteEJBService.serverUp();
            // this one too
            processStateService.removePropertyChangeListener(listener);
        }
    } else {
        remoteEJBService.serverUp();
    }
    // Register an EJB channel open listener
    OpenListener channelOpenListener = remoteEJBService.getOpenListener();
    try {
        registration = endpoint.registerService(EJB_CHANNEL_NAME, channelOpenListener, this.channelCreationOptions);
    } catch (ServiceRegistrationException e) {
        throw new StartException(e);
    }
}
Also used : RemoteEJBService(org.jboss.ejb.protocol.remote.RemoteEJBService) ControlledProcessStateService(org.jboss.as.controller.ControlledProcessStateService) PropertyChangeEvent(java.beans.PropertyChangeEvent) Executor(java.util.concurrent.Executor) Endpoint(org.jboss.remoting3.Endpoint) PropertyChangeListener(java.beans.PropertyChangeListener) OpenListener(org.jboss.remoting3.OpenListener) ServiceRegistrationException(org.jboss.remoting3.ServiceRegistrationException) StartException(org.jboss.msc.service.StartException)

Aggregations

StartException (org.jboss.msc.service.StartException)2 ServiceRegistrationException (org.jboss.remoting3.ServiceRegistrationException)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 Executor (java.util.concurrent.Executor)1 ControlledProcessStateService (org.jboss.as.controller.ControlledProcessStateService)1 RemoteEJBService (org.jboss.ejb.protocol.remote.RemoteEJBService)1 Endpoint (org.jboss.remoting3.Endpoint)1 OpenListener (org.jboss.remoting3.OpenListener)1 RemotingTransactionService (org.wildfly.transaction.client.provider.remoting.RemotingTransactionService)1