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
This commit is contained in:
nathan 2018-01-19 00:19:10 +01:00
parent add5b96263
commit 328825d60e
2 changed files with 17 additions and 9 deletions

View File

@ -417,8 +417,13 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
*/ */
@Override @Override
public public
<Iface> void getRemoteObject(final Class<Iface> interfaceClass, final RemoteObjectCallback<Iface> callback) throws IOException { <Iface> void createRemoteObject(final Class<Iface> interfaceClass, final RemoteObjectCallback<Iface> callback) {
connectionManager.getConnection0().getRemoteObject(interfaceClass, 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<C extends Connection> extends EndPointClient<C> implements Connecti
*/ */
@Override @Override
public public
<Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback) throws IOException { <Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback) {
connectionManager.getConnection0().getRemoteObject(objectId, callback); try {
C connection0 = connectionManager.getConnection0();
connection0.getRemoteObject(objectId, callback);
} catch (IOException e) {
logger.error("Error getting remote object!", e);
}
} }
/** /**

View File

@ -15,8 +15,6 @@
*/ */
package dorkbox.network.connection; package dorkbox.network.connection;
import java.io.IOException;
import dorkbox.network.connection.bridge.ConnectionBridge; import dorkbox.network.connection.bridge.ConnectionBridge;
import dorkbox.network.connection.idle.IdleBridge; import dorkbox.network.connection.idle.IdleBridge;
import dorkbox.network.connection.idle.IdleSender; import dorkbox.network.connection.idle.IdleSender;
@ -117,10 +115,10 @@ interface Connection {
* *
* @see RemoteObject * @see RemoteObject
*/ */
<Iface> void getRemoteObject(final Class<Iface> interfaceClass, final RemoteObjectCallback<Iface> callback) throws IOException; <Iface> void createRemoteObject(final Class<Iface> interfaceClass, final RemoteObjectCallback<Iface> 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. * to an object that is created remotely.
* <p> * <p>
* The callback will be notified when the remote object has been created. * The callback will be notified when the remote object has been created.
@ -141,5 +139,5 @@ interface Connection {
* *
* @see RemoteObject * @see RemoteObject
*/ */
<Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback) throws IOException; <Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback);
} }