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
public
<Iface> void getRemoteObject(final Class<Iface> interfaceClass, final RemoteObjectCallback<Iface> callback) throws IOException {
connectionManager.getConnection0().getRemoteObject(interfaceClass, callback);
<Iface> void createRemoteObject(final Class<Iface> interfaceClass, final RemoteObjectCallback<Iface> 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
public
<Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback) throws IOException {
connectionManager.getConnection0().getRemoteObject(objectId, callback);
<Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> 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;
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
*/
<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.
* <p>
* The callback will be notified when the remote object has been created.
@ -141,5 +139,5 @@ interface Connection {
*
* @see RemoteObject
*/
<Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback) throws IOException;
<Iface> void getRemoteObject(final int objectId, final RemoteObjectCallback<Iface> callback);
}