예제 #1
0
 public static RPC createXmppRPC(XmppAccount account, Executor workerExecutor)
     throws IOException, RpcException, XMPPException {
   Config config = Config.getInstance();
   DefaultCompressPreference.init(
       CompressorFactory.getRegistCompressor(config.getCompressor()).compressor);
   Properties initProps = new Properties();
   initProps.setProperty(
       RpcConstants.SESSIN_TIMEOUT, Integer.toString(config.getRpcTimeOut() * 1000));
   initProps.setProperty(RpcConstants.COMPRESS_PREFER, DefaultCompressPreference.class.getName());
   XmppRpcChannel xmppRpcchannle = new XmppRpcChannel(workerExecutor, account);
   return new RPC(xmppRpcchannle, initProps);
 }
예제 #2
0
 public static RPC createHttpRPC(Executor workerExecutor) throws IOException, RpcException {
   Config config = Config.getInstance();
   DefaultCompressPreference.init(
       CompressorFactory.getRegistCompressor(config.getCompressor()).compressor);
   Properties initProps = new Properties();
   initProps.setProperty(
       RpcConstants.SESSIN_TIMEOUT, Integer.toString(config.getRpcTimeOut() * 1000));
   initProps.setProperty(RpcConstants.COMPRESS_PREFER, DefaultCompressPreference.class.getName());
   // HttpServerAddress remoteAddress = new HttpServerAddress(appid +
   // ".appspot.com", Constants.HTTP_INVOKE_PATH);
   // HttpServerAddress remoteAddress = new HttpServerAddress("localhost",
   // 8888, Constants.HTTP_INVOKE_PATH);
   HttpClientRpcChannel httpCleintRpcchannle = new HttpClientRpcChannel(workerExecutor);
   return new RPC(httpCleintRpcchannle, initProps);
 }