本文整理了Java中org.apache.avro.ipc.HttpServer.<init>()
方法的一些代码示例,展示了HttpServer.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServer.<init>()
方法的具体详情如下:
包路径:org.apache.avro.ipc.HttpServer
类名称:HttpServer
方法名:<init>
[英]Constructs a server to run on the named port.
[中]构造要在命名端口上运行的服务器。
代码示例来源:origin: apache/avro
/** Create a {@link Server} listening at the named URI using the provided
* responder. */
public static Server createServer(Responder responder,
URI uri) throws IOException {
if ("http".equals(uri.getScheme()))
return new HttpServer(responder, uri.getPort());
else if ("avro".equals(uri.getScheme()))
return new SaslSocketServer
(responder, new InetSocketAddress(uri.getHost(), uri.getPort()));
else
throw new IOException("unknown uri scheme: "+uri);
}
代码示例来源:origin: apache/avro
@Override
public Server createServer(Responder testResponder) throws Exception {
return new HttpServer(testResponder, 0);
}
代码示例来源:origin: apache/flume
@Override
public void start() {
// setup http server to receive OG events
res = new SpecificResponder(FlumeOGEventAvroServer.class, this);
try {
http = new HttpServer(res, host, port);
} catch (IOException eI) {
LOG.warn("Failed to start server", eI);
return;
}
http.start();
super.start();
}
代码示例来源:origin: apache/avro
@Override
public Server createServer(Responder testResponder) throws Exception {
System.setProperty("javax.net.ssl.keyStore", "src/test/keystore");
System.setProperty("javax.net.ssl.keyStorePassword", "avrotest");
System.setProperty("javax.net.ssl.password", "avrotest");
System.setProperty("javax.net.ssl.trustStore", "src/test/truststore");
System.setProperty("javax.net.ssl.trustStorePassword", "avrotest");
SslConnectionFactory connectionFactory = new SslConnectionFactory("HTTP/1.1");
SslContextFactory sslContextFactory = connectionFactory.getSslContextFactory();
sslContextFactory.setKeyStorePath(System.getProperty("javax.net.ssl.keyStore"));
sslContextFactory.setKeyManagerPassword(System.getProperty("javax.net.ssl.password"));
sslContextFactory.setKeyStorePassword(System.getProperty("javax.net.ssl.keyStorePassword"));
sslContextFactory.setNeedClientAuth(false);
return new HttpServer(testResponder, connectionFactory, "localhost", 18443);
}
代码示例来源:origin: apache/avro
iaddress=new InetSocketAddress(0);
this.outputServer= new HttpServer
(new SpecificResponder(OutputProtocol.class, outputService),
iaddress.getPort());
代码示例来源:origin: apache/avro
this.inputServer=new HttpServer
(new SpecificResponder(InputProtocol.class, this),
iaddress.getPort());
代码示例来源:origin: apache/avro
/** Starts an Avro server. */
private static HttpServer createServer(boolean withPlugin)
throws IOException {
Responder r = new IdentityResponder(NULL_PROTOCOL);
if (withPlugin) {
r.addRPCPlugin(new StatsPlugin());
}
// Start Avro server
HttpServer server = new HttpServer(r, 0);
server.start();
return server;
}
代码示例来源:origin: apache/avro
HttpServer avroServer = new HttpServer(r, Integer.parseInt(args[0]));
avroServer.start();
代码示例来源:origin: apache/avro
@Before
public void startServer() throws Exception {
if (server != null) return;
server =
new HttpServer(new SpecificResponder(BulkData.class, new BulkDataImpl()),
0);
server.start();
client =
new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
proxy = SpecificRequestor.getClient(BulkData.class, client);
}
代码示例来源:origin: org.apache.avro/avro-ipc
/** Create a {@link Server} listening at the named URI using the provided
* responder. */
public static Server createServer(Responder responder,
URI uri) throws IOException {
if ("http".equals(uri.getScheme()))
return new HttpServer(responder, uri.getPort());
else if ("avro".equals(uri.getScheme()))
return new SaslSocketServer
(responder, new InetSocketAddress(uri.getHost(), uri.getPort()));
else
throw new IOException("unknown uri scheme: "+uri);
}
代码示例来源:origin: jingwei/krati
public static void main(String[] args) throws Exception {
File storeDir = new File(System.getProperty("java.io.tmpdir"), SingleAvroStoreHttpServer.class.getSimpleName());
StoreResponder storeResponder = new BasicDataStoreResponder(createDataStore(storeDir, 10000));
storeResponder.setProperty(StoreKeys.KRATI_STORE_VALUE_SCHEMA, createSchema().toString());
HttpServer server = new HttpServer(storeResponder, 8080);
server.start();
server.join();
}
}
代码示例来源:origin: org.apache.flume.flume-ng-legacy-sources/flume-avro-source
@Override
public void start() {
// setup http server to receive OG events
res = new SpecificResponder(FlumeOGEventAvroServer.class, this);
try {
http = new HttpServer(res, host, port);
} catch (IOException eI) {
LOG.warn("Failed to start server", eI);
return;
}
http.start();
super.start();
}
代码示例来源:origin: apache/oodt
server = new HttpServer(new SpecificResponder(
org.apache.oodt.cas.workflow.struct.avrotypes.WorkflowManager.class,this), port);
} catch (IOException e) {
代码示例来源:origin: co.cask.hbase/hbase
protected static void doMain(final String[] args) throws Exception {
if (args.length < 1) {
printUsageAndExit();
}
int port = 9090;
final String portArgKey = "--port=";
for (String cmd: args) {
if (cmd.startsWith(portArgKey)) {
port = Integer.parseInt(cmd.substring(portArgKey.length()));
continue;
} else if (cmd.equals("--help") || cmd.equals("-h")) {
printUsageAndExit();
} else if (cmd.equals("start")) {
continue;
} else if (cmd.equals("stop")) {
printUsageAndExit("To shutdown the Avro server run " +
"bin/hbase-daemon.sh stop avro or send a kill signal to " +
"the Avro server pid");
}
// Print out usage if we get to here.
printUsageAndExit();
}
Log LOG = LogFactory.getLog("AvroServer");
LOG.info("starting HBase Avro server on port " + Integer.toString(port));
SpecificResponder r = new SpecificResponder(HBase.class, new HBaseImpl());
HttpServer server = new HttpServer(r, port);
server.start();
server.join();
}
代码示例来源:origin: org.apache.avro/avro-mapred
iaddress=new InetSocketAddress(0);
this.outputServer= new HttpServer
(new SpecificResponder(OutputProtocol.class, outputService),
iaddress.getPort());
代码示例来源:origin: org.apache.hadoop/avro
server = new HttpServer(new SinkResponder(protocol), uri.getPort());
out.println("Port: " + server.getPort());
return 0;
代码示例来源:origin: org.apache.cassandra.deps/avro
server = new HttpServer(new SinkResponder(protocol), uri.getPort());
server.start();
out.println("Port: " + server.getPort());
代码示例来源:origin: jingwei/krati
public static void main(String[] args) throws Exception {
File homeDir = new File(System.getProperty("java.io.tmpdir"), MultiTenantStoreHttpServer.class.getSimpleName());
// Change initialCapacity accordingly for different data sets
int initialCapacity = 10000;
// Create store configuration template
StoreConfig configTemplate = new StoreConfig(homeDir, initialCapacity);
configTemplate.setSegmentCompactFactor(0.68);
configTemplate.setSegmentFactory(new MappedSegmentFactory());
configTemplate.setSegmentFileSizeMB(32);
configTemplate.setNumSyncBatches(2);
configTemplate.setBatchSize(100);
// Create store responder and server
DataStoreFactory storeFactory = new IndexedDataStoreFactory();
MultiTenantStoreResponder storeResponder = new MultiTenantStoreResponder(homeDir, configTemplate, new BasicDataStoreResponderFactory(storeFactory));
HttpServer server = new HttpServer(storeResponder, 8080);
server.start();
server.join();
}
}
代码示例来源:origin: org.apache.cassandra.deps/avro
httpServer = new HttpServer(responder, this.port);
httpServer.start();
bound = true;
代码示例来源:origin: jingwei/krati
HttpServer server = new HttpServer(new AvroStoreResponder<String>(joiner), 8080);
server.start();
server.join();
内容来源于网络,如有侵权,请联系作者删除!