IceBox divergent
来源:互联网 发布:邦家博士骗局揭秘 知乎 编辑:程序博客网 时间:2024/04/28 02:34
ice box 以配置文件为主,所以首先得先会配置,有什么不懂的就往官方网站上拾到拾到
https://doc.zeroc.com/display/Doc/Home
run cmd:
java IceBox.Server --Ice.Config=configjava -classpath example.jar IceBox.Server --Ice.Config=example.properties
example.properties:
IceBox.Service.ExampleService=/classes:PrinterServiceI --Ice.Trace.Network=1IceBox.UseSharedCommunicator.ExampleService=1ExampleServer.Endpoints=tcp -p 10001#you can define servel services#thread pool propertiesIce.ThreadPool.Server.Size=8Ice.ThreadPool.Server.SizeMax=100Ice.ThreadPool.Server.SizeWarn=40Ice.ThreadPool.Client.Size=8Ice.ThreadPool.Client.SizeMax=100Ice.ThreadPool.Client.SizeWarn=40 Ice.ACM.Close=0IceBox.InheritProperties=1#if exist define serval services, assign the startup order, and print when startupIceBox.LoadOrder=ExampleService,order 2, order 3IceBox.PrintServicesReady=ExampleService 1, order 2, order 3
Define your demo slice:
module Demo{ interface Printer { void printString(string s); };};Genarated your code of slice:
$ mkdir generated$ slice2java --output-dir generated demo.ice
so you can found a class name Demo._PrinterDisp, and imply this class, but i do not suggest this method in the paper, the principle of slice:
IceBox Interface:
module IceBox {local interface Service { void start(string name, Ice::Communicator communicator, Ice::StringSeq args); void stop();};};Define your Ice Box Service:
public class PrinterI extends Demo._PrinterDisp implements IceBox.Service { public void printString(String s, Ice.Current current) { System.out.println(s); } @Override public void start(String name, Communicator communicator, String[] args) { adapter = communicator.createObjectAdapter(name); Ice.Object obj = this; adapter.add(obj, communicator.stringToIdentity(name)); adapter.activate(); } @Override public void stop() { adapter.destroy(); }}
so a service in ice box like this,
Ofcouse, you can define servral services:
at last, the client invoke:
public class Client { public static void main(String[] args) { int status = 0; Ice.Communicator ic = null; try { ic = Ice.Util.initialize(args); Ice.ObjectPrx base = ic.stringToProxy("ExampleService:default -p 10001"); Demo.PrinterPrx printer = Demo.PrinterPrxHelper.checkedCast(base); if (printer == null) throw new Error("Invalid proxy"); printer.printString("Hello World!"); } catch (Ice.LocalException e) { e.printStackTrace(); status = 1; } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } if (ic != null) { // Clean up // try { ic.destroy(); } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } } System.exit(status); }}
0 0
- IceBox divergent
- IceBox
- IceRegistry divergent
- IceBox实践
- IceBox java 入门例子
- ZeroC Ice IceBox使用
- IceDemos:使用IceBox
- 11.2 icebox 常用配置
- ZeroC Ice IceBox使用
- Ice系列--IceBox(1)
- Ice系列--IceBox(2)
- ICE通信之IceBox服务器
- IceBox官网的demo
- 3.5 divergent change(发散式变化)
- CUDA之Branch/Divergent branches详解
- IceGrid搭建--继承IceBox.Service版
- 11: 动态服务管理(IceBox)
- Divergent Change & shotgun Surgery & Inline Class & Feature Envy
- 仿带噪点和横线的验证码自定义View
- Merge k Sorted Lists ---LeetCode
- 取值函数与赋值函数--类
- 【Codeforces 738F】 Financiers Game【记忆化DP】
- leetcode_436. Find Right Interval 找距离最近的右间隔,对结构体对象的列表排序
- IceBox divergent
- Presents
- 计算器
- 扩展方法的使用
- 排序
- XCode8导航栏反色异常简单解决
- WiFi 网络也可以这么玩
- Java中的异常大集合
- java类集 map-使用