@Override public void startServer(InetSocketAddress socketAddress) { this.socketAddress = socketAddress; //TODO these should be set from spring serverBootstrap.setOption("broadcast", "false"); serverBootstrap.setOption("receiveBufferSizePredictorFactory", bufferSizePredictor); serverBootstrap.setOption("sendBufferSize", 65536); serverBootstrap.setOption("receiveBufferSize", 65536); configureServerBootStrap(args); try { channel = ((ConnectionlessBootstrap) serverBootstrap) .bind(socketAddress); } catch (ChannelException e) { LOG.error("Unable to start UDP server due to error {}",e); throw e; } }
@Override public void configureServerBootStrap(String[] optionsList) { // For clients who do not use spring. if(null == serverBootstrap){ createServerBootstrap(); } serverBootstrap.setPipelineFactory(pipelineFactory); if (null != optionsList && optionsList.length > 0) { for (String option : optionsList) { serverBootstrap.setOption(option, true); } } }
@Override protected Bootstrap getBootstrap() { final Bootstrap bootstrap = super.getBootstrap(); bootstrap.setOption("child.keepAlive", tcpKeepalive); return bootstrap; }
public void start() { ResteasyDeployment dp = new ResteasyDeployment(); Collection<Object> providers = ac.getBeansWithAnnotation(Provider.class).values(); Collection<Object> controllers = ac.getBeansWithAnnotation(Controller.class).values(); Assert.notEmpty(controllers); // extract providers if (providers != null) { dp.getProviders().addAll(providers); } // extract only controller annotated beans dp.getResources().addAll(controllers); netty = new ConfigurableNettyJaxrsServer(); netty.initBootstrap().setOption("reuseAddress", true); netty.setDeployment(dp); netty.setPort(port); netty.setRootResourcePath("/resteasy"); netty.setSecurityDomain(null); netty.start(); }