Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import org.opendaylight.mdsal.dom.api.DOMRpcService;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.netconf.transport.http.HttpServerStackConfiguration;
import org.opendaylight.netconf.transport.tcp.BootstrapFactory;
import org.opendaylight.restconf.api.query.PrettyPrintParam;
import org.opendaylight.restconf.server.AAAShiroPrincipalService;
import org.opendaylight.restconf.server.MessageEncoding;
import org.opendaylight.restconf.server.NettyEndpointConfiguration;
import org.opendaylight.restconf.server.OSGiNettyEndpoint;
import org.opendaylight.restconf.server.PrincipalService;
import org.opendaylight.restconf.server.SimpleNettyEndpoint;
import org.opendaylight.restconf.server.jaxrs.JaxRsLocationProvider;
Expand Down Expand Up @@ -88,17 +88,21 @@ protected boolean initProcedure() {

final PrincipalService service = new AAAShiroPrincipalService((AAAShiroWebEnvironment) webEnvironment);
final var serverStackGrouping = new HttpServerStackConfiguration(new TcpBuilder().setTcp(tcpConfig).build());
final BootstrapFactory factory = new BootstrapFactory("lighty-restconf-nb-worker", 1);
final NettyEndpointConfiguration configuration = new NettyEndpointConfiguration(ErrorTagMapping.RFC8040,
PrettyPrintParam.FALSE, Uint16.valueOf(0), Uint32.valueOf(10000), restconfServletContextPath,
MessageEncoding.JSON, serverStackGrouping);
this.mdsalRestconfStreamRegistry = new MdsalRestconfStreamRegistry(domDataBroker, domNotificationService,
domSchemaService, new JaxRsLocationProvider(), databindProvider);

nettyEndpoint =
new SimpleNettyEndpoint(server, service, mdsalRestconfStreamRegistry, factory,
configuration);

/**
* FIXME make number of work threads configurable
*
* 1. use new RestconfBootstrapFactory(bootstrapFactoryConfig)
* 2. create lighty.io config
* 2. hardcode 0 which is ODL netconf default allowing to use Netty default

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a small typo in the numbering of this list; the second item 2. should probably be 3..

Suggested change
* 2. hardcode 0 which is ODL netconf default allowing to use Netty default
* 3. hardcode 0 which is ODL netconf default allowing to use Netty default

*/
final var pros = OSGiNettyEndpoint.props(bootstrapFactory, configuration);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line will not compile because the bootstrapFactory variable is not defined. You've removed the BootstrapFactory instantiation, but it's still required by OSGiNettyEndpoint.props().

To fix this, you need to create a BootstrapFactory instance before this line. Based on the FIXME comment, you likely want to use 0 threads to use Netty's default. You could add the following line before this one:

final var bootstrapFactory = new org.opendaylight.netconf.transport.tcp.BootstrapFactory("lighty-restconf-nb-worker", 0);

Note that you'll need to use the fully qualified name or re-add the import for BootstrapFactory.

nettyEndpoint = new OSGiNettyEndpoint(server, service, mdsalRestconfStreamRegistry, pros);
return true;
}

Expand Down
Loading