Class RmiClientHandler

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.RmiClientHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class RmiClientHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress>>
A ChannelHandler that can invoke methods on remote objects that are served on other nodes by RmiServerHandler.
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
    Creates a new RmiClientHandler.
    RmiClientHandler(Map<UUID,org.drasyl.handler.rmi.RmiInvocationHandler> requests)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    protected void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<RmiMessage,SocketAddress> msg)
     
    void
    handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
     
    <T> T
    lookup(String name, Class<T> clazz, SocketAddress address)
    Returns a stub class that will pass all method invocation to the binding name served by address.

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

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

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RmiClientHandler

      public RmiClientHandler(Map<UUID,org.drasyl.handler.rmi.RmiInvocationHandler> requests)
    • RmiClientHandler

      public RmiClientHandler()
      Creates a new RmiClientHandler.
  • Method Details

    • handlerAdded

      public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      handlerAdded in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerAdded in class io.netty.channel.ChannelHandlerAdapter
    • handlerRemoved

      public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      handlerRemoved in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerRemoved in class io.netty.channel.ChannelHandlerAdapter
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
    • 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>>
    • lookup

      public <T> T lookup(String name, Class<T> clazz, SocketAddress address)
      Returns a stub class that will pass all method invocation to the binding name served by address.
      Parameters:
      name - the name of the binding at the remote node
      address - the address where the remote object is served
      Returns:
      a reference to a remote object
      Throws:
      NullPointerException - if name, clazz, or address is null
      IllegalArgumentException - if clazz is not an java interface