|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.alipay.remoting.RemotingServer
com.alipay.remoting.rpc.RpcServer
public class RpcServer
Server for Rpc.
| Field Summary | |
|---|---|
protected RpcRemoting |
rpcRemoting
rpc remoting |
| Fields inherited from class com.alipay.remoting.RemotingServer |
|---|
port |
| Constructor Summary | |
|---|---|
RpcServer(int port)
Construct a rpc server. |
|
RpcServer(int port,
boolean manageConnection)
Construct a rpc server. |
|
RpcServer(int port,
boolean manageConnection,
boolean syncStop)
Construct a rpc server. |
|
| Method Summary | |
|---|---|
void |
addConnectionEventProcessor(ConnectionEventType type,
ConnectionEventProcessor processor)
Add processor to process connection event. |
protected void |
doInit()
Inject initialize logic here. |
protected boolean |
doStart()
Inject start logic here. |
protected boolean |
doStart(String ip)
Inject start logic here. |
protected void |
doStop()
Notice: only GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH switch on, will close all connections. |
RemotingAddressParser |
getAddressParser()
Getter method for property addressParser. |
DefaultConnectionManager |
getConnectionManager()
Getter method for property connectionManager. |
protected void |
initRpcRemoting(RpcRemoting rpcRemoting)
init rpc remoting |
Object |
invokeSync(Connection conn,
Object request,
int timeoutMillis)
Synchronous invocation using a Connection Notice: DO NOT modify the request object concurrently when this method is called. |
Object |
invokeSync(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a InvokeContext, common api notice please see invokeSync(Connection, Object, int) |
Object |
invokeSync(String addr,
Object request,
int timeoutMillis)
Synchronous invocation using a string address, address format example - 127.0.0.1:12200? |
Object |
invokeSync(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a InvokeContext, common api notice please see invokeSync(String, Object, int) |
Object |
invokeSync(Url url,
Object request,
int timeoutMillis)
Synchronous invocation using a parsed Url Notice: DO NOT modify the request object concurrently when this method is called. |
Object |
invokeSync(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a InvokeContext, common api notice please see invokeSync(Url, Object, int) |
void |
invokeWithCallback(Connection conn,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a Connection You can specify an implementation of InvokeCallback to get the result. |
void |
invokeWithCallback(Connection conn,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a InvokeContext, common api notice please see invokeWithCallback(Connection, Object, InvokeCallback, int) |
void |
invokeWithCallback(String addr,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a string address, address format example - 127.0.0.1:12200? |
void |
invokeWithCallback(String addr,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a InvokeContext, common api notice please see invokeWithCallback(String, Object, InvokeCallback, int) |
void |
invokeWithCallback(Url url,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a parsed Url You can specify an implementation of InvokeCallback to get the result. |
void |
invokeWithCallback(Url url,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a InvokeContext, common api notice please see invokeWithCallback(Url, Object, InvokeCallback, int) |
RpcResponseFuture |
invokeWithFuture(Connection conn,
Object request,
int timeoutMillis)
Future invocation using a Connection You can get result use the returned RpcResponseFuture. |
RpcResponseFuture |
invokeWithFuture(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a InvokeContext, common api notice please see invokeWithFuture(Connection, Object, int) |
RpcResponseFuture |
invokeWithFuture(String addr,
Object request,
int timeoutMillis)
Future invocation using a string address, address format example - 127.0.0.1:12200? |
RpcResponseFuture |
invokeWithFuture(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a InvokeContext, common api notice please see invokeWithFuture(String, Object, int) |
RpcResponseFuture |
invokeWithFuture(Url url,
Object request,
int timeoutMillis)
Future invocation using a parsed Url You can get result use the returned RpcResponseFuture. |
RpcResponseFuture |
invokeWithFuture(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a InvokeContext, common api notice please see invokeWithFuture(Url, Object, int) |
boolean |
isConnected(String remoteAddr)
check whether a client address connected |
boolean |
isConnected(Url url)
check whether a Url connected |
void |
oneway(Connection conn,
Object request)
One way invocation using a Connection Notice: DO NOT modify the request object concurrently when this method is called. |
void |
oneway(Connection conn,
Object request,
InvokeContext invokeContext)
One way invocation with a InvokeContext, common api notice please see oneway(Connection, Object) |
void |
oneway(String addr,
Object request)
One way invocation using a string address, address format example - 127.0.0.1:12200? |
void |
oneway(String addr,
Object request,
InvokeContext invokeContext)
One way invocation with a InvokeContext, common api notice please see oneway(String, Object) |
void |
oneway(Url url,
Object request)
One way invocation using a parsed Url Notice: DO NOT modify the request object concurrently when this method is called. |
void |
oneway(Url url,
Object request,
InvokeContext invokeContext)
One way invocation with a InvokeContext, common api notice please see oneway(Url, Object) |
void |
registerDefaultExecutor(byte protocolCode,
ExecutorService executor)
Register default executor service for server. |
void |
registerProcessor(byte protocolCode,
CommandCode cmd,
RemotingProcessor<?> processor)
Register processor for command with the command code. |
void |
registerUserProcessor(UserProcessor<?> processor)
Register user processor. |
void |
setAddressParser(RemotingAddressParser addressParser)
Setter method for property addressParser. |
| Methods inherited from class com.alipay.remoting.RemotingServer |
|---|
getPort, init, start, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected RpcRemoting rpcRemoting
| Constructor Detail |
|---|
public RpcServer(int port)
Connection, for example invokeSync(Connection, Object, int) UnsupportedOperationException will be thrown.
port -
public RpcServer(int port,
boolean manageConnection)
String, Url, Connection methods.Connection, otherwise UnsupportedOperationException will be thrown.
port - manageConnection - true to enable connection management feature
public RpcServer(int port,
boolean manageConnection,
boolean syncStop)
port - manageConnection - syncStop - true to enable stop in synchronous way| Method Detail |
|---|
protected void doInit()
RemotingServer
doInit in class RemotingServer
protected boolean doStart()
throws InterruptedException
RemotingServer
doStart in class RemotingServerInterruptedExceptionRemotingServer.doStart()
protected boolean doStart(String ip)
throws InterruptedException
RemotingServer
doStart in class RemotingServerInterruptedExceptionRemotingServer.doStart(String)protected void doStop()
GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH switch on, will close all connections.
doStop in class RemotingServerRemotingServer.doStop()protected void initRpcRemoting(RpcRemoting rpcRemoting)
rpcRemoting -
public void registerProcessor(byte protocolCode,
CommandCode cmd,
RemotingProcessor<?> processor)
RemotingServer
registerProcessor in class RemotingServerRemotingServer.registerProcessor(byte, com.alipay.remoting.CommandCode, com.alipay.remoting.RemotingProcessor)
public void registerDefaultExecutor(byte protocolCode,
ExecutorService executor)
RemotingServer
registerDefaultExecutor in class RemotingServerRemotingServer.registerDefaultExecutor(byte, ExecutorService)
public void addConnectionEventProcessor(ConnectionEventType type,
ConnectionEventProcessor processor)
type - processor - public void registerUserProcessor(UserProcessor<?> processor)
RemotingServer
registerUserProcessor in class RemotingServerRemotingServer.registerUserProcessor(com.alipay.remoting.rpc.protocol.UserProcessor)
public void oneway(String addr,
Object request)
throws RemotingException,
InterruptedException
Notice:
addr - request -
RemotingException
InterruptedException
public void oneway(String addr,
Object request,
InvokeContext invokeContext)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see oneway(String, Object)
addr - request - invokeContext -
RemotingException
InterruptedException
public void oneway(Url url,
Object request)
throws RemotingException,
InterruptedException
Url
Notice:
Url to find a available client connection, if none then throw exception
url - request -
RemotingException
InterruptedException
public void oneway(Url url,
Object request,
InvokeContext invokeContext)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see oneway(Url, Object)
url - request - invokeContext -
RemotingException
InterruptedException
public void oneway(Connection conn,
Object request)
throws RemotingException
Connection
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request -
RemotingException
public void oneway(Connection conn,
Object request,
InvokeContext invokeContext)
throws RemotingException
InvokeContext, common api notice please see oneway(Connection, Object)
conn - request - invokeContext -
RemotingException
public Object invokeSync(String addr,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Notice:
addr - request - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeSync(String, Object, int)
addr - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Url url,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Url
Notice:
Url to find a available client connection, if none then throw exception
url - request - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeSync(Url, Object, int)
url - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Connection conn,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Connection
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeSync(Connection, Object, int)
conn - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(String addr,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
RpcResponseFuture.
Notice:
addr - request - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithFuture(String, Object, int)
addr - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(Url url,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Url RpcResponseFuture.
Notice:
Url to find a available client connection, if none then throw exception
url - request - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithFuture(Url, Object, int)
url - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(Connection conn,
Object request,
int timeoutMillis)
throws RemotingException
Connection RpcResponseFuture.
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request - timeoutMillis -
RemotingException
public RpcResponseFuture invokeWithFuture(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException
InvokeContext, common api notice please see invokeWithFuture(Connection, Object, int)
conn - request - invokeContext - timeoutMillis -
RemotingException
public void invokeWithCallback(String addr,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeCallback to get the result.
Notice:
addr - request - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(String addr,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithCallback(String, Object, InvokeCallback, int)
addr - request - invokeContext - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(Url url,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
Url InvokeCallback to get the result.
Notice:
Url to find a available client connection, if none then throw exception
url - request - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(Url url,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithCallback(Url, Object, InvokeCallback, int)
url - request - invokeContext - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(Connection conn,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException
Connection InvokeCallback to get the result.
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request - invokeCallback - timeoutMillis -
RemotingException
public void invokeWithCallback(Connection conn,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException
InvokeContext, common api notice please see invokeWithCallback(Connection, Object, InvokeCallback, int)
conn - request - invokeCallback - timeoutMillis -
RemotingExceptionpublic boolean isConnected(String remoteAddr)
remoteAddr -
public boolean isConnected(Url url)
Url connected
url -
public RemotingAddressParser getAddressParser()
public void setAddressParser(RemotingAddressParser addressParser)
addressParser - value to be assigned to property addressParserpublic DefaultConnectionManager getConnectionManager()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||