@InterfaceAudience.Private public class HttpProxyExample extends Object
AsyncTable
to write a fully
asynchronous HTTP proxy server. The AsyncConnection
will share the same event loop with
the HTTP server.
The request URL is:
http://<host>:<port>/<table>/<rowgt;/<family>:<qualifier>Use HTTP GET to fetch data, and use HTTP PUT to put data. Encode the value as the request content when doing PUT.
Notice that, future class methods will all return a new Future, so you always have one future that will not been checked, so we need to suppress error-prone "FutureReturnValueIgnored" warnings on the methods such as join and stop. In your real production code, you should use your own convenient way to address the warning.
Modifier and Type | Class and Description |
---|---|
private static class |
HttpProxyExample.Params |
private static class |
HttpProxyExample.RequestHandler |
Modifier and Type | Field and Description |
---|---|
private org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup |
bossGroup |
private org.apache.hbase.thirdparty.io.netty.channel.group.ChannelGroup |
channelGroup |
private org.apache.hadoop.conf.Configuration |
conf |
private AsyncConnection |
conn |
private int |
port |
private org.apache.hbase.thirdparty.io.netty.channel.Channel |
serverChannel |
private org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup |
workerGroup |
Constructor and Description |
---|
HttpProxyExample(org.apache.hadoop.conf.Configuration conf,
int port) |
Modifier and Type | Method and Description |
---|---|
void |
join() |
static void |
main(String[] args) |
int |
port() |
void |
start() |
void |
stop() |
private final org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup bossGroup
private final org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup workerGroup
private final org.apache.hadoop.conf.Configuration conf
private final int port
private AsyncConnection conn
private org.apache.hbase.thirdparty.io.netty.channel.Channel serverChannel
private org.apache.hbase.thirdparty.io.netty.channel.group.ChannelGroup channelGroup
public HttpProxyExample(org.apache.hadoop.conf.Configuration conf, int port)
public void start() throws InterruptedException, ExecutionException
public void join()
public int port()
public void stop() throws IOException
IOException
public static void main(String[] args) throws InterruptedException, ExecutionException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.