com.alipay.remoting.rpc
Class RpcRemoting

java.lang.Object
  extended by com.alipay.remoting.BaseRemoting
      extended by com.alipay.remoting.rpc.RpcRemoting
Direct Known Subclasses:
RpcClientRemoting, RpcServerRemoting

public abstract class RpcRemoting
extends BaseRemoting

Rpc remoting capability.


Field Summary
protected  RemotingAddressParser addressParser
          address parser to get custom args
protected  DefaultConnectionManager connectionManager
          connection manager
 
Constructor Summary
RpcRemoting(CommandFactory commandFactory)
          default constructor
RpcRemoting(CommandFactory commandFactory, RemotingAddressParser addressParser, DefaultConnectionManager connectionManager)
           
 
Method Summary
protected  InvokeFuture createInvokeFuture(Connection conn, RemotingCommand request, InvokeContext invokeContext, InvokeCallback invokeCallback)
          Create invoke future with InvokeContext.
protected  InvokeFuture createInvokeFuture(RemotingCommand request, InvokeContext invokeContext)
          Create invoke future with InvokeContext.
 Object invokeSync(Connection conn, Object request, InvokeContext invokeContext, int timeoutMillis)
          Synchronous rpc invocation.
 Object invokeSync(String addr, Object request, InvokeContext invokeContext, int timeoutMillis)
          Synchronous rpc invocation.
abstract  Object invokeSync(Url url, Object request, InvokeContext invokeContext, int timeoutMillis)
          Synchronous rpc invocation.
 void invokeWithCallback(Connection conn, Object request, InvokeContext invokeContext, InvokeCallback invokeCallback, int timeoutMillis)
          Rpc invocation with callback.
 void invokeWithCallback(String addr, Object request, InvokeContext invokeContext, InvokeCallback invokeCallback, int timeoutMillis)
          Rpc invocation with callback.
abstract  void invokeWithCallback(Url url, Object request, InvokeContext invokeContext, InvokeCallback invokeCallback, int timeoutMillis)
          Rpc invocation with callback.
 RpcResponseFuture invokeWithFuture(Connection conn, Object request, InvokeContext invokeContext, int timeoutMillis)
          Rpc invocation with future returned.
 RpcResponseFuture invokeWithFuture(String addr, Object request, InvokeContext invokeContext, int timeoutMillis)
          Rpc invocation with future returned.
abstract  RpcResponseFuture invokeWithFuture(Url url, Object request, InvokeContext invokeContext, int timeoutMillis)
          Rpc invocation with future returned.
 void oneway(Connection conn, Object request, InvokeContext invokeContext)
          Oneway rpc invocation.
 void oneway(String addr, Object request, InvokeContext invokeContext)
          Oneway rpc invocation.
abstract  void oneway(Url url, Object request, InvokeContext invokeContext)
          Oneway rpc invocation.
protected abstract  void preProcessInvokeContext(InvokeContext invokeContext, RemotingCommand cmd, Connection connection)
           
protected  RemotingCommand toRemotingCommand(Object request, Connection conn, InvokeContext invokeContext, int timeoutMillis)
          Convert application request object to remoting request command.
 
Methods inherited from class com.alipay.remoting.BaseRemoting
getCommandFactory, invokeSync, invokeWithCallback, invokeWithFuture, oneway
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addressParser

protected RemotingAddressParser addressParser
address parser to get custom args


connectionManager

protected DefaultConnectionManager connectionManager
connection manager

Constructor Detail

RpcRemoting

public RpcRemoting(CommandFactory commandFactory)
default constructor


RpcRemoting

public RpcRemoting(CommandFactory commandFactory,
                   RemotingAddressParser addressParser,
                   DefaultConnectionManager connectionManager)
Parameters:
addressParser -
connectionManager -
Method Detail

oneway

public void oneway(String addr,
                   Object request,
                   InvokeContext invokeContext)
            throws RemotingException,
                   InterruptedException
Oneway rpc invocation.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
addr -
request -
invokeContext -
Throws:
RemotingException
InterruptedException

oneway

public abstract void oneway(Url url,
                            Object request,
                            InvokeContext invokeContext)
                     throws RemotingException,
                            InterruptedException
Oneway rpc invocation.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
url -
request -
invokeContext -
Throws:
RemotingException
InterruptedException

oneway

public void oneway(Connection conn,
                   Object request,
                   InvokeContext invokeContext)
            throws RemotingException
Oneway rpc invocation.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
conn -
request -
invokeContext -
Throws:
RemotingException

invokeSync

public Object invokeSync(String addr,
                         Object request,
                         InvokeContext invokeContext,
                         int timeoutMillis)
                  throws RemotingException,
                         InterruptedException
Synchronous rpc invocation.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
addr -
request -
invokeContext -
timeoutMillis -
Returns:
Throws:
RemotingException
InterruptedException

invokeSync

public abstract Object invokeSync(Url url,
                                  Object request,
                                  InvokeContext invokeContext,
                                  int timeoutMillis)
                           throws RemotingException,
                                  InterruptedException
Synchronous rpc invocation.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
url -
request -
invokeContext -
timeoutMillis -
Returns:
Throws:
RemotingException
InterruptedException

invokeSync

public Object invokeSync(Connection conn,
                         Object request,
                         InvokeContext invokeContext,
                         int timeoutMillis)
                  throws RemotingException,
                         InterruptedException
Synchronous rpc invocation.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
conn -
request -
invokeContext -
timeoutMillis -
Returns:
Throws:
RemotingException
InterruptedException

invokeWithFuture

public RpcResponseFuture invokeWithFuture(String addr,
                                          Object request,
                                          InvokeContext invokeContext,
                                          int timeoutMillis)
                                   throws RemotingException,
                                          InterruptedException
Rpc invocation with future returned.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
addr -
request -
invokeContext -
timeoutMillis -
Returns:
Throws:
RemotingException
InterruptedException

invokeWithFuture

public abstract RpcResponseFuture invokeWithFuture(Url url,
                                                   Object request,
                                                   InvokeContext invokeContext,
                                                   int timeoutMillis)
                                            throws RemotingException,
                                                   InterruptedException
Rpc invocation with future returned.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
url -
request -
invokeContext -
timeoutMillis -
Returns:
Throws:
RemotingException
InterruptedException

invokeWithFuture

public RpcResponseFuture invokeWithFuture(Connection conn,
                                          Object request,
                                          InvokeContext invokeContext,
                                          int timeoutMillis)
                                   throws RemotingException
Rpc invocation with future returned.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
conn -
request -
invokeContext -
timeoutMillis -
Returns:
Throws:
RemotingException

invokeWithCallback

public void invokeWithCallback(String addr,
                               Object request,
                               InvokeContext invokeContext,
                               InvokeCallback invokeCallback,
                               int timeoutMillis)
                        throws RemotingException,
                               InterruptedException
Rpc invocation with callback.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
addr -
request -
invokeContext -
invokeCallback -
timeoutMillis -
Throws:
RemotingException
InterruptedException

invokeWithCallback

public abstract void invokeWithCallback(Url url,
                                        Object request,
                                        InvokeContext invokeContext,
                                        InvokeCallback invokeCallback,
                                        int timeoutMillis)
                                 throws RemotingException,
                                        InterruptedException
Rpc invocation with callback.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
url -
request -
invokeContext -
invokeCallback -
timeoutMillis -
Throws:
RemotingException
InterruptedException

invokeWithCallback

public void invokeWithCallback(Connection conn,
                               Object request,
                               InvokeContext invokeContext,
                               InvokeCallback invokeCallback,
                               int timeoutMillis)
                        throws RemotingException
Rpc invocation with callback.
Notice! DO NOT modify the request object concurrently when this method is called.

Parameters:
conn -
request -
invokeContext -
invokeCallback -
timeoutMillis -
Throws:
RemotingException

toRemotingCommand

protected RemotingCommand toRemotingCommand(Object request,
                                            Connection conn,
                                            InvokeContext invokeContext,
                                            int timeoutMillis)
                                     throws SerializationException
Convert application request object to remoting request command.

Parameters:
request -
conn -
timeoutMillis -
Returns:
Throws:
CodecException
SerializationException

preProcessInvokeContext

protected abstract void preProcessInvokeContext(InvokeContext invokeContext,
                                                RemotingCommand cmd,
                                                Connection connection)

createInvokeFuture

protected InvokeFuture createInvokeFuture(RemotingCommand request,
                                          InvokeContext invokeContext)
Description copied from class: BaseRemoting
Create invoke future with InvokeContext.

Specified by:
createInvokeFuture in class BaseRemoting
Returns:
See Also:
BaseRemoting.createInvokeFuture(com.alipay.remoting.RemotingCommand, com.alipay.remoting.InvokeContext)

createInvokeFuture

protected InvokeFuture createInvokeFuture(Connection conn,
                                          RemotingCommand request,
                                          InvokeContext invokeContext,
                                          InvokeCallback invokeCallback)
Description copied from class: BaseRemoting
Create invoke future with InvokeContext.

Specified by:
createInvokeFuture in class BaseRemoting
Returns:
See Also:
BaseRemoting.createInvokeFuture(Connection, RemotingCommand, InvokeContext, InvokeCallback)


Copyright © 2018. All rights reserved.