<commit_before>package com.xxl.rpc.sample.client;

import com.xxl.rpc.remoting.invoker.XxlRpcInvokerFactory;
import com.xxl.rpc.remoting.invoker.call.CallType;
import com.xxl.rpc.remoting.invoker.call.XxlRpcInvokeCallback;
import com.xxl.rpc.remoting.invoker.call.XxlRpcInvokeFuture;
import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
import com.xxl.rpc.remoting.invoker.route.LoadBalance;
import com.xxl.rpc.remoting.net.impl.netty.client.NettyClient;
import com.xxl.rpc.sample.api.DemoService;
import com.xxl.rpc.sample.api.dto.UserDTO;
import com.xxl.rpc.serialize.impl.HessianSerializer;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * @author xuxueli 2018-10-21 20:48:40
 */
public class XxlRpcClientAplication {

	public static void main(String[] args) throws Exception {

		// test
		testSYNC();
		testFUTURE();
		testCALLBACK();
		testONEWAY();

		TimeUnit.SECONDS.sleep(2);

		// stop client invoker factory (default by getInstance, exist inner thread, need destory)
		XxlRpcInvokerFactory.getInstance().stop();



		// init invoker factory
		/*XxlRpcInvokerFactory invokerFactory = new XxlRpcInvokerFactory();
		invokerFactory.start();*/

		/*String serviceKey = XxlRpcProviderFactory.makeServiceKey(DemoService.class.getName(), null);		// registry local
		invokerFactory.getServiceRegistry().registry(new HashSet<String>(Arrays.asList(serviceKey)), "127.0.0.1:7080");*/

		// test

		// stop invoker factory
		/*invokerFactory.stop();*/

	}



	/**
	 * CallType.SYNC
	 */
	public static void testSYNC() throws Exception {
		// init client
		XxlRpcReferenceBean referenceBean = new XxlRpcReferenceBean();
		referenceBean.setClient(NettyClient.class);
		referenceBean.setSerializer(HessianSerializer.class);
		referenceBean.setCallType(CallType.SYNC);
		referenceBean.setLoadBalance(LoadBalance.ROUND);
		referenceBean.setIface(DemoService.class);
		referenceBean.setVersion(null);
		referenceBean.setTimeout(500);<commit_msg>update document<commit_after>package com.xxl.rpc.sample.client;

import com.xxl.rpc.remoting.invoker.XxlRpcInvokerFactory;
import com.xxl.rpc.remoting.invoker.call.CallType;
import com.xxl.rpc.remoting.invoker.call.XxlRpcInvokeCallback;
import com.xxl.rpc.remoting.invoker.call.XxlRpcInvokeFuture;
import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
import com.xxl.rpc.remoting.invoker.route.LoadBalance;
import com.xxl.rpc.remoting.net.impl.netty.client.NettyClient;
import com.xxl.rpc.sample.api.DemoService;
import com.xxl.rpc.sample.api.dto.UserDTO;
import com.xxl.rpc.serialize.impl.HessianSerializer;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * @author xuxueli 2018-10-21 20:48:40
 */
public class XxlRpcClientAplication {

	public static void main(String[] args) throws Exception {

		/*String serviceKey = XxlRpcProviderFactory.makeServiceKey(DemoService.class.getName(), null);
		XxlRpcInvokerFactory.getInstance().getServiceRegistry().registry(new HashSet<String>(Arrays.asList(serviceKey)), "127.0.0.1:7080");*/

		// test
		testSYNC();
		testFUTURE();
		testCALLBACK();
		testONEWAY();

		TimeUnit.SECONDS.sleep(2);

		// stop client invoker factory (default by getInstance, exist inner thread, need destory)
		XxlRpcInvokerFactory.getInstance().stop();

	}



	/**
	 * CallType.SYNC
	 */
	public static void testSYNC() throws Exception {
		// init client
		XxlRpcReferenceBean referenceBean = new XxlRpcReferenceBean();
		referenceBean.setClient(NettyClient.class);
		referenceBean.setSerializer(HessianSerializer.class);
		referenceBean.setCallType(CallType.SYNC);
		referenceBean.setLoadBalance(LoadBalance.ROUND);
		referenceBean.setIface(DemoService.class);
		referenceBean.setVersion(null);
		referenceBean.setTimeout(500);
{'fraction_non_alphanumeric': 0.12404125892621, 'fraction_numerical': 0.014810896588204179, 'mean_word_length': 5.377740303541315, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4270357', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1269, 'n_words': 187}