public Registration register() throws ServiceRegistrationException { return endpoint.registerService("txn", new OpenListener() { public void channelOpened(final Channel channel) { getServerForConnection(channel.getConnection()).openChannel(channel); } public void registrationTerminated() { // no operation } }, OptionMap.EMPTY); }
public Registration addConnectionProvider(final String uriScheme, final ConnectionProviderFactory providerFactory, final OptionMap optionMap) throws DuplicateRegistrationException, IOException { return endpoint.addConnectionProvider(uriScheme, providerFactory, optionMap); }
@Override public IoFuture<Connection> connect(URI destination, InetSocketAddress bindAddress, OptionMap connectOptions, SSLContext sslContext, AuthenticationConfiguration connectionConfiguration) { return this.endpoint.connect(destination, bindAddress, connectOptions, sslContext, connectionConfiguration); }
public boolean supportsScheme(final String scheme) { return Endpoint.getCurrent().isValidUriScheme(scheme); }
protected InetSocketAddress getSourceAddress(final InetSocketAddress destination) { return Endpoint.getCurrent().getXnioWorker().getBindAddress(destination.getAddress()); }
@Override public void close() throws IOException { this.endpoint.close(); }
endpoint = Endpoint.builder().setEndpointName("endpoint").build(); final SSLContext sslContext = tempContext; context = sslContext != null ? context.withSsl(MatchRule.ALL, () -> sslContext) : context; final IoFuture<Connection> futureConnection = endpoint.connect(convert(serviceUrl), getOptionMap(disabledMechanisms), context); IoFuture.Status result = futureConnection.await(getTimeoutValue(Timeout.CONNECTION, env), TimeUnit.SECONDS);
@Override public XnioWorker getXnioWorker() { return this.endpoint.getXnioWorker(); } }
public void close(final boolean isFinalize) { try { if (isFinalize) { clientEndpoint.closeAsync(); } else { clientEndpoint.close(); } } catch (IOException e) { throw new RuntimeException("Failed to release endpoint", e); } } });
@Override public boolean isValidUriScheme(String uriScheme) { return this.endpoint.isValidUriScheme(uriScheme); }
/** * Create an endpoint with the given configuration and existing worker. * * @param endpointName the name of the endpoint * @param xnioWorker the XNIO worker instance to use * @param optionMap the options to configure the endpoint * @return the new endpoint * @throws IOException if an error occurs */ public static Endpoint createEndpoint(final String endpointName, final XnioWorker xnioWorker, final OptionMap optionMap) throws IOException { if (endpointName == null) { throw new IllegalArgumentException("endpointName is null"); } if (optionMap == null) { throw new IllegalArgumentException("optionMap is null"); } final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(CREATE_ENDPOINT_PERM); } EndpointBuilder builder = Endpoint.builder(); builder.setXnioWorker(xnioWorker); builder.setEndpointName(endpointName); // JBEAP-14783 - legacy endpoint return new LegacyEndpoint(builder.build()); }
@Override public <T> T getConnectionProviderInterface(String uriScheme, Class<T> expectedType) throws UnknownURISchemeException, ClassCastException { return this.endpoint.getConnectionProviderInterface(uriScheme, expectedType); }
private synchronized void createConnection() { try { endpoint = Remoting.createEndpoint("endpoint", OptionMap.EMPTY); endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(), OptionMap.create(Options.SSL_ENABLED, Boolean.FALSE)); // open a connection final IoFuture<Connection> futureConnection = endpoint.connect(new URI(hostUrl), OptionMap.create(Options.SASL_POLICY_NOANONYMOUS, Boolean.FALSE, Options.SASL_POLICY_NOPLAINTEXT, Boolean.FALSE), callbackHandler); connection = IoFutureHelper.get(futureConnection, 30L, TimeUnit.SECONDS); final EJBClientContext ejbClientContext = EJBClientContext.create(); ejbClientContext.registerConnection(connection); this.clientContext = ejbClientContext; } catch (IOException e) { throw new RuntimeException(e); } catch (URISyntaxException e) { throw new RuntimeException(e); } }
final EndpointBuilder endpointBuilder = Endpoint.builder(); final String endpointName = properties.getEndpointName(); if (endpointName != null) { endpoint.getConnection(uri, "ejb", "jboss");
/** {@inheritDoc} */ public synchronized void stop(final StopContext context) { context.asynchronous(); try { endpoint.closeAsync(); } finally { endpoint.addCloseHandler(new CloseHandler<Endpoint>() { public void handleClose(final Endpoint closed, final IOException exception) { context.complete(); } }); } }
/** {@inheritDoc} */ public synchronized void start(final StartContext context) throws StartException { final Endpoint endpoint; try { boolean ok = false; endpoint = Remoting.createEndpoint(endpointName, optionMap); try { // Reuse the options for the remote connection factory for now endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(), optionMap); ok = true; } finally { if (! ok) { endpoint.closeAsync(); } } } catch (IOException e) { throw MESSAGES.couldNotStart(e); } this.endpoint = endpoint; }
public LegacyEndpoint(Endpoint endpoint) { this.endpoint = endpoint; // JBEAP-14783 - add a handler to shutdown the xnio worker otherwise legacy Remoting 4.0 will not stop // completely when endpoint is closed as it did in 4.0 this.endpoint.addCloseHandler(new CloseHandler<Endpoint>() { @Override public void handleClose(org.jboss.remoting3.Endpoint closed, IOException exception) { endpoint.getXnioWorker().shutdown(); } }); }
public static Endpoint createEndpoint(final String name, final TcpConnector tcpConnector, final SslTcpConnector sslConnector, final Executor executor, final OptionMap optionMap) throws IOException { final Endpoint endpoint = Remoting.createEndpoint(name, executor, optionMap); endpoint.addProtocolService(ProtocolServiceType.MARSHALLER_PROVIDER_DESCRIPTOR, "river", new RiverProviderDescriptor()); endpoint.addConnectionProvider("remote", new ConnectionProviderFactory() { public ConnectionProvider createInstance(final ConnectionProviderContext context) { return RemoteProtocol.getRemoteConnectionProvider(context, tcpConnector); } }); if (sslConnector != null) endpoint.addConnectionProvider("remote+ssl", new ConnectionProviderFactory() { public ConnectionProvider createInstance(final ConnectionProviderContext context) { return RemoteProtocol.getRemoteConnectionProvider(context, sslConnector); } }); return endpoint; } }
this.endpoint = null; try { endpoint.closeAsync(); } catch (UnsupportedOperationException ignored) { endpoint.awaitClosed(); } catch (InterruptedException e) { final InterruptedIOException cause = new InterruptedIOException(e.getLocalizedMessage());
@Override public void closeAsync() { this.endpoint.closeAsync(); }