From 32425748061151989ba37049e5a070de3dc52ec0 Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 23 Sep 2017 21:17:19 +0200 Subject: [PATCH] Updated deprecated methods --- src/dorkbox/network/Client.java | 36 ++++++++++++++++----------------- src/dorkbox/network/Server.java | 13 +++++------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/dorkbox/network/Client.java b/src/dorkbox/network/Client.java index 0c840370..95d82519 100644 --- a/src/dorkbox/network/Client.java +++ b/src/dorkbox/network/Client.java @@ -42,6 +42,7 @@ import io.netty.buffer.PooledByteBufAllocator; import io.netty.channel.ChannelOption; import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.EventLoopGroup; +import io.netty.channel.WriteBufferWaterMark; import io.netty.channel.epoll.EpollDatagramChannel; import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollSocketChannel; @@ -173,8 +174,7 @@ class Client extends EndPointClient implements Connecti tcpBootstrap.group(boss) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) - .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) .remoteAddress(options.host, options.tcpPort) .handler(new RegistrationRemoteHandlerClientTCP(threadName, registrationWrapper, @@ -204,8 +204,7 @@ class Client extends EndPointClient implements Connecti udpBootstrap.group(boss) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) - .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) .localAddress(new InetSocketAddress(0)) // bind to wildcard .remoteAddress(new InetSocketAddress(options.host, options.udpPort)) .handler(new RegistrationRemoteHandlerClientUDP(threadName, @@ -245,8 +244,7 @@ class Client extends EndPointClient implements Connecti udtBootstrap.group(udtBoss) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) - .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) .remoteAddress(options.host, options.udtPort) .handler(new RegistrationRemoteHandlerClientUDT(threadName, registrationWrapper, @@ -425,28 +423,28 @@ class Client extends EndPointClient implements Connecti } /** - * Returns a new proxy object implements the specified interface. Methods invoked on the proxy object will be invoked remotely on the - * object with the specified ID in the ObjectSpace for the current connection. + * Returns a new proxy object that implements the specified interface. Methods invoked on the proxy object will be + * invoked remotely on the object with the specified ID in the ObjectSpace for the current connection. *

* This will request a registration ID from the remote endpoint, and will block until the object has been returned. *

- * Methods that return a value will throw {@link TimeoutException} if the response is not received with the {@link - * RemoteObject#setResponseTimeout(int) response timeout}. + * Methods that return a value will throw {@link TimeoutException} if the response is not received with the + * {@link RemoteObject#setResponseTimeout(int) response timeout}. *

- * If {@link RemoteObject#setAsync(boolean) non-blocking} is false (the default), then methods that return a value must not be - * called from the update thread for the connection. An exception will be thrown if this occurs. Methods with a void return value can be - * called on the update thread. + * If {@link RemoteObject#setAsync(boolean) non-blocking} is false (the default), then methods that return a value must + * not be called from the update thread for the connection. An exception will be thrown if this occurs. Methods with a + * void return value can be called on the update thread. *

- * 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 - * have the proxy object replaced with the registered (non-proxy) object. + * 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 have the proxy object replaced with the registered (non-proxy) object. * * @see RemoteObject */ @Override public - Iface createProxyObject(final Class remoteImplementationClass) throws IOException { + Iface getRemoteObject(final Class interfaceClass) throws IOException { return this.connectionManager.getConnection0() - .createProxyObject(remoteImplementationClass); + .getRemoteObject(interfaceClass); } /** @@ -469,9 +467,9 @@ class Client extends EndPointClient implements Connecti */ @Override public - Iface getProxyObject(final int objectId) throws IOException { + Iface getRemoteObject(final int objectId) throws IOException { return this.connectionManager.getConnection0() - .getProxyObject(objectId); + .getRemoteObject(objectId); } /** diff --git a/src/dorkbox/network/Server.java b/src/dorkbox/network/Server.java index 5844871d..dbb2c312 100644 --- a/src/dorkbox/network/Server.java +++ b/src/dorkbox/network/Server.java @@ -38,6 +38,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelOption; import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.EventLoopGroup; +import io.netty.channel.WriteBufferWaterMark; import io.netty.channel.epoll.EpollChannelOption; import io.netty.channel.epoll.EpollDatagramChannel; import io.netty.channel.epoll.EpollEventLoopGroup; @@ -198,8 +199,7 @@ class Server extends EndPointServer { localBootstrap.group(localBoss, localWorker) .channel(LocalServerChannel.class) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) - .childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) .localAddress(new LocalAddress(localChannelName)) .childHandler(new RegistrationLocalHandlerServer(threadName, registrationWrapper)); @@ -229,8 +229,7 @@ class Server extends EndPointServer { .option(ChannelOption.SO_REUSEADDR, true) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childOption(ChannelOption.SO_KEEPALIVE, true) - .childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) .childHandler(new RegistrationRemoteHandlerServerTCP(threadName, registrationWrapper, serializationManager)); @@ -266,8 +265,7 @@ class Server extends EndPointServer { udpBootstrap.group(worker) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) - .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) // 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! @@ -301,8 +299,7 @@ class Server extends EndPointServer { udtBootstrap.group(udtBoss, udtWorker) .option(ChannelOption.SO_BACKLOG, backlogConnectionCount) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) - .childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, WRITE_BUFF_HIGH) - .childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, WRITE_BUFF_LOW) + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(WRITE_BUFF_LOW, WRITE_BUFF_HIGH)) // not binding to specific address, since it's driven by TCP, and that can be bound to a specific address .localAddress(udtPort) .childHandler(new RegistrationRemoteHandlerServerUDT(threadName,