Package com.peterhi.net2

Examples of com.peterhi.net2.Endpoint$EndpointDataListener


        this.optionMap = optionMap;
    }

    /** {@inheritDoc} */
    public synchronized void start(final StartContext context) throws StartException {
        final Endpoint endpoint;
        try {
            boolean ok = false;
            endpoint = Remoting.createEndpoint(endpointName, optionMap);
            try {
                endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(), OptionMap.create(Options.SSL_ENABLED, Boolean.FALSE));
                ok = true;
            } finally {
                if (! ok) {
                    endpoint.closeAsync();
                }
            }
        } catch (IOException e) {
            throw new StartException("Failed to start service", e);
        }
View Full Code Here


        }
    }

    /** {@inheritDoc} */
    public synchronized Endpoint getValue() throws IllegalStateException {
        final Endpoint endpoint = this.endpoint;
        if (endpoint == null) throw new IllegalStateException();
        return endpoint;
    }
View Full Code Here

    public static IoFuture<Connection> connect(final ProtocolConnectionConfiguration configuration) throws IOException {
        return connect(configuration.getCallbackHandler(), configuration);
    }

    private static IoFuture<Connection> connect(final CallbackHandler handler, final ProtocolConnectionConfiguration configuration) throws IOException {
        final Endpoint endpoint = configuration.getEndpoint();
        final OptionMap options = getOptions(configuration);
        final CallbackHandler actualHandler = handler != null ? handler : new AnonymousCallbackHandler();
        return endpoint.connect(configuration.getUri(), options, actualHandler, configuration.getSslContext());
    }
View Full Code Here

    private OptionMap optionMap;
    private ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener;

    public synchronized void start(final StartContext context) throws StartException {
        final Endpoint endpoint = endpointInjectedValue.getValue();
        final NetworkServerProvider provider;
        try {
            // We can just use "remote" here because that just means that any SSL config is relegated to us.
            provider = endpoint.getConnectionProviderInterface("remote", NetworkServerProvider.class);
        } catch (UnknownURISchemeException e) {
            throw new StartException(e);
        }
        listener = provider.getServerListener(optionMap, authenticationProviderInjectedValue.getValue());
    }
View Full Code Here

        safeClose(endpoint);
    }

    /** {@inheritDoc} */
    public synchronized Endpoint getValue() throws IllegalStateException {
        final Endpoint endpoint = this.endpoint;
        if (endpoint == null) throw new IllegalStateException();
        return endpoint;
    }
View Full Code Here

    private void addClusterNodes(final EJBClientContext ejbClientContext, final String clusterName, final Map<String, List<ClientMapping>> addedNodes) {
        if (addedNodes == null || addedNodes.isEmpty()) {
            return;
        }
        final EJBRemoteConnectorService ejbRemoteConnectorService = this.ejbRemoteConnectorServiceValue.getOptionalValue();
        final Endpoint endpoint = this.endpointValue.getOptionalValue();
        if(ejbRemoteConnectorService == null || endpoint == null) {
            return;
        }
        final SocketBinding ejbRemoteConnectorSocketBinding = ejbRemoteConnectorService.getEJBRemoteConnectorSocketBinding();
        final InetAddress bindAddress = ejbRemoteConnectorSocketBinding.getAddress();
View Full Code Here

    }

    @Override
    @SuppressWarnings("deprecation")
    public synchronized void start(final StartContext context) throws StartException {
        final Endpoint endpoint = endpointInjector.getValue();
        try {
            final URI connectionURI = new URI("remote://" + NetworkUtils.formatPossibleIpv6Address(hostName) + ":" + port);
            final OptionMap options = OptionMap.create(Options.SASL_DISALLOWED_MECHANISMS, Sequence.of(JBOSS_LOCAL_USER));
            // Create the connection configuration
            final ProtocolConnectionConfiguration configuration = ProtocolConnectionConfiguration.create(endpoint, connectionURI, options);
View Full Code Here

        if (configuration == null) {
            throw MESSAGES.nullVar("configuration");
        }
        configuration.validate();

        final Endpoint endpoint;
        if (configuration.getEndpoint() != null) {
            endpoint = configuration.getEndpoint();
            return new ProtocolChannelClient(false, endpoint, null, configuration);
        } else {
            endpoint = Remoting.createEndpoint(configuration.getEndpointName(), configuration.getOptionMap());
            Registration providerRegistration = endpoint.addConnectionProvider(configuration.getUri().getScheme(), new RemoteConnectionProviderFactory(), OptionMap.EMPTY);
            return new ProtocolChannelClient(true, endpoint, providerRegistration, configuration);
        }
    }
View Full Code Here

        if (configuration == null) {
            throw MESSAGES.nullVar("configuration");
        }
        configuration.validate();

        final Endpoint endpoint;
        if (configuration.getEndpoint() != null) {
            endpoint = configuration.getEndpoint();
            return new ProtocolChannelClient(false, endpoint, null, configuration);
        } else {
            endpoint = Remoting.createEndpoint(configuration.getEndpointName(), configuration.getOptionMap());
            Registration providerRegistration = endpoint.addConnectionProvider(configuration.getUri().getScheme(), new RemoteConnectionProviderFactory(), OptionMap.EMPTY);
            return new ProtocolChannelClient(true, endpoint, providerRegistration, configuration);
        }
    }
View Full Code Here

        if (configuration == null) {
            throw MESSAGES.nullVar("configuration");
        }
        configuration.validate();

        final Endpoint endpoint;
        if (configuration.getEndpoint() != null) {
            endpoint = configuration.getEndpoint();
            return new ProtocolChannelClient<T>(false, endpoint, null, configuration.getUri(), configuration.getChannelFactory());
        } else {
            endpoint = Remoting.createEndpoint(configuration.getEndpointName(), configuration.getOptionMap());
            Registration providerRegistration = endpoint.addConnectionProvider(configuration.getUri().getScheme(), new RemoteConnectionProviderFactory(), OptionMap.create(Options.SSL_ENABLED, Boolean.FALSE));
            return new ProtocolChannelClient<T>(true, endpoint, providerRegistration, configuration.getUri(), configuration.getChannelFactory());
        }
    }
View Full Code Here

TOP

Related Classes of com.peterhi.net2.Endpoint$EndpointDataListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.