Search in sources :

Example 1 with NettyTransport

use of org.infinispan.server.core.transport.NettyTransport in project infinispan by infinispan.

the class AbstractProtocolServer method startTransport.

protected void startTransport() {
    log.debugf("Starting Netty transport for %s on %s:%s", configuration.name(), configuration.host(), configuration.port());
    InetSocketAddress address = new InetSocketAddress(configuration.host(), configuration.port());
    transport = new NettyTransport(address, configuration, getQualifiedName(), cacheManager);
    transport.initializeHandler(getInitializer());
    // Register transport and worker MBeans regardless
    registerServerMBeans();
    try {
        transport.start();
    } catch (Throwable re) {
        try {
            unregisterServerMBeans();
        } catch (Exception e) {
            throw new CacheException(e);
        }
        throw re;
    }
    registerMetrics();
}
Also used : CacheException(org.infinispan.commons.CacheException) InetSocketAddress(java.net.InetSocketAddress) NettyTransport(org.infinispan.server.core.transport.NettyTransport) CacheException(org.infinispan.commons.CacheException)

Example 2 with NettyTransport

use of org.infinispan.server.core.transport.NettyTransport in project infinispan by infinispan.

the class SinglePortEndpointRouter method start.

@Override
public void start(RoutingTable routingTable, EmbeddedCacheManager ecm) {
    this.routingTable = routingTable;
    this.routingTable.streamRoutes().forEach(r -> r.getRouteDestination().getProtocolServer().setEnclosingProtocolServer(this));
    this.cacheManager = ecm;
    InetSocketAddress address = new InetSocketAddress(configuration.host(), configuration.port());
    transport = new NettyTransport(address, configuration, getQualifiedName(), cacheManager);
    transport.initializeHandler(getInitializer());
    if (cacheManager != null) {
        BasicComponentRegistry bcr = getGlobalComponentRegistry(cacheManager).getComponent(BasicComponentRegistry.class);
        bcr.replaceComponent(getQualifiedName(), this, false);
    }
    registerServerMBeans();
    try {
        transport.start();
    } catch (Throwable re) {
        try {
            unregisterServerMBeans();
        } catch (Exception e) {
            re.addSuppressed(e);
        }
        throw re;
    }
    registerMetrics();
    RouterLogger.SERVER.debugf("REST EndpointRouter listening on %s:%d", transport.getHostName(), transport.getPort());
}
Also used : BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) InetSocketAddress(java.net.InetSocketAddress) NettyTransport(org.infinispan.server.core.transport.NettyTransport) UnknownHostException(java.net.UnknownHostException)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)2 NettyTransport (org.infinispan.server.core.transport.NettyTransport)2 UnknownHostException (java.net.UnknownHostException)1 CacheException (org.infinispan.commons.CacheException)1 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)1