From 328825d60ec92b357524a78975cc55cdbea2fdf3 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 19 Jan 2018 00:19:10 +0100 Subject: [PATCH] Changed getRemoteObject(class...) to createRemoteObject(class...), so to make it more clear, are we creating a NEW remote object, or getting an already existing one? Removed unnecessary IOException throws --- src/dorkbox/network/Client.java | 18 ++++++++++++++---- src/dorkbox/network/connection/Connection.java | 8 +++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/dorkbox/network/Client.java b/src/dorkbox/network/Client.java index 7ce8b906..f7f07fce 100644 --- a/src/dorkbox/network/Client.java +++ b/src/dorkbox/network/Client.java @@ -417,8 +417,13 @@ class Client extends EndPointClient implements Connecti */ @Override public - void getRemoteObject(final Class interfaceClass, final RemoteObjectCallback callback) throws IOException { - connectionManager.getConnection0().getRemoteObject(interfaceClass, callback); + void createRemoteObject(final Class interfaceClass, final RemoteObjectCallback callback) { + try { + C connection0 = connectionManager.getConnection0(); + connection0.createRemoteObject(interfaceClass, callback); + } catch (IOException e) { + logger.error("Error creating remote object!", e); + } } /** @@ -445,8 +450,13 @@ class Client extends EndPointClient implements Connecti */ @Override public - void getRemoteObject(final int objectId, final RemoteObjectCallback callback) throws IOException { - connectionManager.getConnection0().getRemoteObject(objectId, callback); + void getRemoteObject(final int objectId, final RemoteObjectCallback callback) { + try { + C connection0 = connectionManager.getConnection0(); + connection0.getRemoteObject(objectId, callback); + } catch (IOException e) { + logger.error("Error getting remote object!", e); + } } /** diff --git a/src/dorkbox/network/connection/Connection.java b/src/dorkbox/network/connection/Connection.java index e866d6bd..5f59eb67 100644 --- a/src/dorkbox/network/connection/Connection.java +++ b/src/dorkbox/network/connection/Connection.java @@ -15,8 +15,6 @@ */ package dorkbox.network.connection; -import java.io.IOException; - import dorkbox.network.connection.bridge.ConnectionBridge; import dorkbox.network.connection.idle.IdleBridge; import dorkbox.network.connection.idle.IdleSender; @@ -117,10 +115,10 @@ interface Connection { * * @see RemoteObject */ - void getRemoteObject(final Class interfaceClass, final RemoteObjectCallback callback) throws IOException; + void createRemoteObject(final Class interfaceClass, final RemoteObjectCallback callback); /** - * Tells the remote connection to create a new proxy object that implements the specified interface. The methods on this object "map" + * Tells the remote connection to access an already created proxy object that implements the specified interface. The methods on this object "map" * to an object that is created remotely. *

* The callback will be notified when the remote object has been created. @@ -141,5 +139,5 @@ interface Connection { * * @see RemoteObject */ - void getRemoteObject(final int objectId, final RemoteObjectCallback callback) throws IOException; + void getRemoteObject(final int objectId, final RemoteObjectCallback callback); }