Moved pipeline RMI files into rmi package

This commit is contained in:
nathan 2018-01-17 21:26:07 +01:00
parent ed1fdf4085
commit c2d6f66030
5 changed files with 28 additions and 9 deletions

View File

@ -21,8 +21,8 @@ import dorkbox.network.connection.Connection;
import dorkbox.network.connection.RegistrationWrapper;
import dorkbox.network.connection.registration.MetaChannel;
import dorkbox.network.connection.registration.RegistrationHandler;
import dorkbox.network.pipeline.LocalRmiDecoder;
import dorkbox.network.pipeline.LocalRmiEncoder;
import dorkbox.network.pipeline.rmi.LocalRmiDecoder;
import dorkbox.network.pipeline.rmi.LocalRmiEncoder;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;

View File

@ -13,11 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dorkbox.network.pipeline;
package dorkbox.network.pipeline.rmi;
/**
* This is for a LOCAL connection (same-JVM)
*/
class LocalRmiClassEncoder {
public Object rmiObject;
// these are the "in order" rmi ID's for the fields of 'rmiObject'
public int[] rmiFieldIds;
public
LocalRmiClassEncoder() {
}
}

View File

@ -13,16 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dorkbox.network.pipeline;
package dorkbox.network.pipeline.rmi;
import java.lang.reflect.Field;
import java.util.List;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.rmi.RemoteObject;
import dorkbox.network.serialization.CryptoSerializationManager;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
/**
* This is for a LOCAL connection (same-JVM)
*/
public
class LocalRmiDecoder extends MessageToMessageDecoder<Object> {
@ -69,9 +73,11 @@ class LocalRmiDecoder extends MessageToMessageDecoder<Object> {
}
final Class<?> iface = connection.getEndPoint()
.getSerialization()
.getRmiIface(localRmiObject.getClass());
CryptoSerializationManager serialization = connection.getEndPoint()
.getSerialization();
// TODO: see what's up with this.
final Class<?> iface = serialization.getRmiIface(localRmiObject.getClass());
if (iface == null) {
throw new RuntimeException("Unable to get interface for RMI implementation");
}

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dorkbox.network.pipeline;
package dorkbox.network.pipeline.rmi;
import java.lang.reflect.Field;
import java.util.List;
@ -29,6 +29,9 @@ import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
/**
* This is for a LOCAL connection (same-JVM)
*/
@Sharable
public
class LocalRmiEncoder extends MessageToMessageEncoder<Object> {

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dorkbox.network.pipeline;
package dorkbox.network.pipeline.rmi;
import java.lang.reflect.Field;
import java.util.ArrayList;
@ -25,6 +25,9 @@ import dorkbox.network.rmi.Rmi;
/**
* Uses the "single writer principle" for fast access, but disregards 'single writer', because duplicates are OK
*
* This is for a LOCAL connection (same-JVM)
*
*/
class RmiFieldCache {
private volatile IdentityMap<Class<?>, Field[]> fieldCache = new IdentityMap<Class<?>, Field[]>();