Updated deprecated methods

This commit is contained in:
nathan 2017-09-23 21:17:19 +02:00
parent 9d8f381427
commit 3242574806
2 changed files with 22 additions and 27 deletions

View File

@ -42,6 +42,7 @@ import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.WriteBufferWaterMark;
import io.netty.channel.epoll.EpollDatagramChannel; import io.netty.channel.epoll.EpollDatagramChannel;
import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollSocketChannel; import io.netty.channel.epoll.EpollSocketChannel;
@ -173,8 +174,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
tcpBootstrap.group(boss) tcpBootstrap.group(boss)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
.remoteAddress(options.host, options.tcpPort) .remoteAddress(options.host, options.tcpPort)
.handler(new RegistrationRemoteHandlerClientTCP<C>(threadName, .handler(new RegistrationRemoteHandlerClientTCP<C>(threadName,
registrationWrapper, registrationWrapper,
@ -204,8 +204,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
udpBootstrap.group(boss) udpBootstrap.group(boss)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
.localAddress(new InetSocketAddress(0)) // bind to wildcard .localAddress(new InetSocketAddress(0)) // bind to wildcard
.remoteAddress(new InetSocketAddress(options.host, options.udpPort)) .remoteAddress(new InetSocketAddress(options.host, options.udpPort))
.handler(new RegistrationRemoteHandlerClientUDP<C>(threadName, .handler(new RegistrationRemoteHandlerClientUDP<C>(threadName,
@ -245,8 +244,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
udtBootstrap.group(udtBoss) udtBootstrap.group(udtBoss)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
.remoteAddress(options.host, options.udtPort) .remoteAddress(options.host, options.udtPort)
.handler(new RegistrationRemoteHandlerClientUDT<C>(threadName, .handler(new RegistrationRemoteHandlerClientUDT<C>(threadName,
registrationWrapper, registrationWrapper,
@ -425,28 +423,28 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
} }
/** /**
* Returns a new proxy object implements the specified interface. Methods invoked on the proxy object will be invoked remotely on the * Returns a new proxy object that implements the specified interface. Methods invoked on the proxy object will be
* object with the specified ID in the ObjectSpace for the current connection. * invoked remotely on the object with the specified ID in the ObjectSpace for the current connection.
* <p/> * <p/>
* This will request a registration ID from the remote endpoint, <b>and will block</b> until the object has been returned. * This will request a registration ID from the remote endpoint, <b>and will block</b> until the object has been returned.
* <p/> * <p/>
* Methods that return a value will throw {@link TimeoutException} if the response is not received with the {@link * Methods that return a value will throw {@link TimeoutException} if the response is not received with the
* RemoteObject#setResponseTimeout(int) response timeout}. * {@link RemoteObject#setResponseTimeout(int) response timeout}.
* <p/> * <p/>
* If {@link RemoteObject#setAsync(boolean) non-blocking} is false (the default), then methods that return a value must not be * If {@link RemoteObject#setAsync(boolean) non-blocking} is false (the default), then methods that return a value must
* called from the update thread for the connection. An exception will be thrown if this occurs. Methods with a void return value can be * not be called from the update thread for the connection. An exception will be thrown if this occurs. Methods with a
* called on the update thread. * void return value can be called on the update thread.
* <p/> * <p/>
* If a proxy returned from this method is part of an object graph sent over the network, the object graph on the receiving side will * If a proxy returned from this method is part of an object graph sent over the network, the object graph on the receiving side
* have the proxy object replaced with the registered (non-proxy) object. * will have the proxy object replaced with the registered (non-proxy) object.
* *
* @see RemoteObject * @see RemoteObject
*/ */
@Override @Override
public public
<Iface, Impl extends Iface> Iface createProxyObject(final Class<Impl> remoteImplementationClass) throws IOException { <Iface> Iface getRemoteObject(final Class<Iface> interfaceClass) throws IOException {
return this.connectionManager.getConnection0() return this.connectionManager.getConnection0()
.createProxyObject(remoteImplementationClass); .getRemoteObject(interfaceClass);
} }
/** /**
@ -469,9 +467,9 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
*/ */
@Override @Override
public public
<Iface, Impl extends Iface> Iface getProxyObject(final int objectId) throws IOException { <Iface> Iface getRemoteObject(final int objectId) throws IOException {
return this.connectionManager.getConnection0() return this.connectionManager.getConnection0()
.getProxyObject(objectId); .getRemoteObject(objectId);
} }
/** /**

View File

@ -38,6 +38,7 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.WriteBufferWaterMark;
import io.netty.channel.epoll.EpollChannelOption; import io.netty.channel.epoll.EpollChannelOption;
import io.netty.channel.epoll.EpollDatagramChannel; import io.netty.channel.epoll.EpollDatagramChannel;
import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollEventLoopGroup;
@ -198,8 +199,7 @@ class Server<C extends Connection> extends EndPointServer<C> {
localBootstrap.group(localBoss, localWorker) localBootstrap.group(localBoss, localWorker)
.channel(LocalServerChannel.class) .channel(LocalServerChannel.class)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
.localAddress(new LocalAddress(localChannelName)) .localAddress(new LocalAddress(localChannelName))
.childHandler(new RegistrationLocalHandlerServer<C>(threadName, registrationWrapper)); .childHandler(new RegistrationLocalHandlerServer<C>(threadName, registrationWrapper));
@ -229,8 +229,7 @@ class Server<C extends Connection> extends EndPointServer<C> {
.option(ChannelOption.SO_REUSEADDR, true) .option(ChannelOption.SO_REUSEADDR, true)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.childOption(ChannelOption.SO_KEEPALIVE, true) .childOption(ChannelOption.SO_KEEPALIVE, true)
.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
.childHandler(new RegistrationRemoteHandlerServerTCP<C>(threadName, .childHandler(new RegistrationRemoteHandlerServerTCP<C>(threadName,
registrationWrapper, registrationWrapper,
serializationManager)); serializationManager));
@ -266,8 +265,7 @@ class Server<C extends Connection> extends EndPointServer<C> {
udpBootstrap.group(worker) udpBootstrap.group(worker)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
// not binding to specific address, since it's driven by TCP, and that can be bound to a specific address // not binding to specific address, since it's driven by TCP, and that can be bound to a specific address
.localAddress(udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets! .localAddress(udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets!
@ -301,8 +299,7 @@ class Server<C extends Connection> extends EndPointServer<C> {
udtBootstrap.group(udtBoss, udtWorker) udtBootstrap.group(udtBoss, udtWorker)
.option(ChannelOption.SO_BACKLOG, backlogConnectionCount) .option(ChannelOption.SO_BACKLOG, backlogConnectionCount)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH))
.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW)
// not binding to specific address, since it's driven by TCP, and that can be bound to a specific address // not binding to specific address, since it's driven by TCP, and that can be bound to a specific address
.localAddress(udtPort) .localAddress(udtPort)
.childHandler(new RegistrationRemoteHandlerServerUDT<C>(threadName, .childHandler(new RegistrationRemoteHandlerServerUDT<C>(threadName,