Class RmiServerHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress>>
org.drasyl.handler.rmi.RmiServerHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class RmiServerHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress>>
A ChannelHandler that can serve local object whose methods then can be invoked by remote nodes using RmiClientHandler.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    RmiServerHandler(Map<Integer,Object> bindings, Map<Integer,Map<Integer,Method>> bindingsMethods, Map<Pair<SocketAddress,UUID>,io.netty.util.concurrent.Future<?>> invocations)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    bind(String name, Object object)
    Binds a object to the specified name and makes it therefore available for remote method invocation.
    protected void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress> msg)
     
    void
    rebind(String name, Object object)
    Replaces the binding (if any) for the specified name and makes object available for remote method invocation.
    void
    unbind(String name)
    Removes the binding (if any) for the specified name.

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

  • Method Details

    • acceptInboundMessage

      public boolean acceptInboundMessage(Object msg) throws Exception
      Overrides:
      acceptInboundMessage in class io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress>>
      Throws:
      Exception
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress> msg)
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress>>
    • bind

      public void bind(String name, Object object)
      Binds a object to the specified name and makes it therefore available for remote method invocation.
      Parameters:
      name - name to bind the given object to
      object - an object to be made available for remote invocations
      Throws:
      IllegalArgumentException - if name is already bound or object does not implement any interfaces
      NullPointerException - if name or object is null
    • unbind

      public void unbind(String name)
      Removes the binding (if any) for the specified name.
      Parameters:
      name - name of the binding to delete
      Throws:
      NullPointerException - if name is null
    • rebind

      public void rebind(String name, Object object)
      Replaces the binding (if any) for the specified name and makes object available for remote method invocation.
      Parameters:
      name - name of the binding to replace
      object - (new) object to be made available for remote invocations
      Throws:
      NullPointerException - if name or object is null