代码拉取完成,页面将自动刷新
同步操作将从 青木/eyer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
public class TestServer {
public static void main(String[] args) throws IOException {
NioConfig.registered(new KryoSerializer());
final ServerHandler handler = new ServerHandler();
NioConfig.registered(handler);
NioConfig.initSessionHandler();
//需要导出的服务接口 以及对应的实现类
handler.services.put(UserService.class, new RemoteUserService());
Server server = new Server(new InetSocketAddress("0.0.0.0",6161),new Acceptor("acceptor-1",new ReactorPool(1)));
}
}
public class ProxyClientTest {
public static void main(String[] args) throws Exception {
NioConfig.registered(new KryoSerializer());
final Handler invocationHandler = new ClientHandler();
NioConfig.registered(invocationHandler);
NioConfig.registered(new Connector("connector",new ReactorPool(1)));
NioConfig.initSessionHandler();
URL url = new URL();
url.setHost("localhost");
url.setPort(6161);
Invoker invoker = new SimpleInvoker(url,50);
ProxyClient proxyClient = new ProxyClient(invoker);
final AtomicLong counter = new AtomicLong(0);
UserService userService = proxyClient.refService(UserService.class);
userService.save(new User());
clientProxy.close();
}
}
public class ZookeeperServer {
public static void main(String[] args) throws IOException {
NioConfig.registered(new KryoSerializer());
final ServerHandler handler = new ServerHandler();
NioConfig.registered(handler);
NioConfig.initSessionHandler();
handler.services.put(UserService.class, new RemoteUserService());
Server server = new Server(new InetSocketAddress("0.0.0.0", 6161), new Acceptor("acceptor-1", new ReactorPool(1)));
ZooKeeperClient zooKeeperClient = new DefaultZookeeperClient("192.168.1.66:2181");
String format = "/eyer/" + URLEncoder.encode(String.format("rpc/%s:%s/Services", "localhost", 6161), "UTF-8");
zooKeeperClient.create(format, true);
}
}
public class ZookeeperClient {
public static void main(String[] args) throws Exception {
NioConfig.registered(new KryoSerializer());
final Handler invocationHandler = new ClientHandler();
NioConfig.registered(invocationHandler);
NioConfig.registered(new Connector("ZookeeperProxyServicePerf-connector-1",new ReactorPool(1)));
NioConfig.initSessionHandler();
Invoker invoker = new ZookeeperInvoker("192.168.1.66:2181",new PollingBalance(),50);
ProxyClient proxyClient = new ProxyClient(invoker);
UserService userService = proxyClient.refService(UserService.class);
System.out.println(save);
clientProxy.close();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。