本文整理了Java中com.linkedin.r2.transport.http.server.HttpServer.start()
方法的一些代码示例,展示了HttpServer.start()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServer.start()
方法的具体详情如下:
包路径:com.linkedin.r2.transport.http.server.HttpServer
类名称:HttpServer
方法名:start
暂无
代码示例来源:origin: apache/incubator-gobblin
@Override
protected void startUp() throws Exception {
RestLiConfig config = new RestLiConfig();
Set<String> resourceClassNames = Sets.newHashSet();
for (Class<? extends BaseResource> resClass : this.resources) {
resourceClassNames.add(resClass.getName());
}
config.addResourceClassNames(resourceClassNames);
config.setServerNodeUri(this.serverUri);
config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
config.addFilter(new RestLiValidationFilter());
ResourceFactory factory = new GuiceInjectResourceFactory(this.injector);
TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName();
FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters));
this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(this.port, dispatcher));
this.log.info("Starting the {} embedded server at port {}.", this.name, this.port);
this.httpServer.get().start();
}
代码示例来源:origin: apache/incubator-gobblin
@Override
protected void startUp()
throws Exception {
// Server configuration
RestLiConfig config = new RestLiConfig();
config.addResourcePackageNames(JobExecutionInfoResource.class.getPackage().getName());
config.setServerNodeUri(serverUri);
config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
// Handle dependency injection
Injector injector = Guice.createInjector(new MetaStoreModule(properties));
JobHistoryStore jobHistoryStore = injector.getInstance(JobHistoryStore.class);
SimpleBeanProvider beanProvider = new SimpleBeanProvider();
beanProvider.add("jobHistoryStore", jobHistoryStore);
// Use InjectMockResourceFactory to keep this Spring free
ResourceFactory factory = new InjectMockResourceFactory(beanProvider);
// Create and start the HTTP server
TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName();
FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters));
this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(port, dispatcher));
LOGGER.info("Starting the job execution information server");
this.httpServer.get().start();
}
代码示例来源:origin: linkedin/parseq
@BeforeClass
public void init() throws Exception {
_serverScheduler = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors() + 1);
EngineBuilder serverEngineBuilder = new EngineBuilder();
serverEngineBuilder.setTaskExecutor(_serverScheduler).setTimerScheduler(_serverScheduler)
.setPlanDeactivationListener(_batchingSupport);
_serverEngine = serverEngineBuilder.build();
_server = RestLiIntTestServer.createServer(_serverEngine, _port,
true, 5000, null, FilterChains.empty(), true, false, false);
_server.start();
_clientFactory = new HttpClientFactory();
_transportClients = new ArrayList<>();
_restClient = createRestClient();
}
代码示例来源:origin: com.linkedin.pegasus/restli-server-testutils
@Override
public void start()
throws IOException
{
server.start();
}
代码示例来源:origin: com.linkedin.pegasus/restli-server-standalone
/**
* Start the server
*
* @throws IOException server startup fails
*/
public void start() throws IOException
{
_server.start();
}
代码示例来源:origin: com.linkedin.pegasus/restli-int-test-server
public static void main(String[] args) throws IOException
{
final int numCores = Runtime.getRuntime().availableProcessors();
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(numCores + 1);
final Engine engine = new EngineBuilder()
.setTaskExecutor(scheduler)
.setTimerScheduler(scheduler)
.build();
HttpServer server = createServer(engine, DEFAULT_PORT, supportedCompression);
server.start();
System.out.println("HttpServer running on port " + DEFAULT_PORT + ". Press any key to stop server");
System.in.read();
server.stop();
engine.shutdown();
}
代码示例来源:origin: org.apache.gobblin/gobblin-restli-utils
@Override
protected void startUp() throws Exception {
RestLiConfig config = new RestLiConfig();
Set<String> resourceClassNames = Sets.newHashSet();
for (Class<? extends BaseResource> resClass : this.resources) {
resourceClassNames.add(resClass.getName());
}
config.addResourceClassNames(resourceClassNames);
config.setServerNodeUri(this.serverUri);
config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
config.addFilter(new RestLiValidationFilter());
ResourceFactory factory = new GuiceInjectResourceFactory(this.injector);
TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName();
FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters));
this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(this.port, dispatcher));
this.log.info("Starting the {} embedded server at port {}.", this.name, this.port);
this.httpServer.get().start();
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-rest-server
@Override
protected void startUp()
throws Exception {
// Server configuration
RestLiConfig config = new RestLiConfig();
config.addResourcePackageNames(JobExecutionInfoResource.class.getPackage().getName());
config.setServerNodeUri(serverUri);
config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
// Handle dependency injection
Injector injector = Guice.createInjector(new MetaStoreModule(properties));
JobHistoryStore jobHistoryStore = injector.getInstance(JobHistoryStore.class);
SimpleBeanProvider beanProvider = new SimpleBeanProvider();
beanProvider.add("jobHistoryStore", jobHistoryStore);
// Use InjectMockResourceFactory to keep this Spring free
ResourceFactory factory = new InjectMockResourceFactory(beanProvider);
// Create and start the HTTP server
TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName();
FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters));
this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(port, dispatcher));
LOGGER.info("Starting the job execution information server");
this.httpServer.get().start();
}
代码示例来源:origin: org.apache.gobblin/gobblin-rest-server
@Override
protected void startUp()
throws Exception {
// Server configuration
RestLiConfig config = new RestLiConfig();
config.addResourcePackageNames(JobExecutionInfoResource.class.getPackage().getName());
config.setServerNodeUri(serverUri);
config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
// Handle dependency injection
Injector injector = Guice.createInjector(new MetaStoreModule(properties));
JobHistoryStore jobHistoryStore = injector.getInstance(JobHistoryStore.class);
SimpleBeanProvider beanProvider = new SimpleBeanProvider();
beanProvider.add("jobHistoryStore", jobHistoryStore);
// Use InjectMockResourceFactory to keep this Spring free
ResourceFactory factory = new InjectMockResourceFactory(beanProvider);
// Create and start the HTTP server
TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName();
FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters));
this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(port, dispatcher));
LOGGER.info("Starting the job execution information server");
this.httpServer.get().start();
}
内容来源于网络,如有侵权,请联系作者删除!