⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multithread.java

📁 this an example showing how the threading policy work ! It is the topic of the middleware. This prog
💻 JAVA
字号:
import org.omg.PortableServer.*;import java.io.*;public class MultiThread {  public static void main(String[] args) {    try {      File file1 = new File("ior1");      PrintWriter out1 = new PrintWriter(new FileWriter(file1));      org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);      POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));      org.omg.CORBA.Policy[] policies = {          rootPOA.create_thread_policy(ThreadPolicyValue.ORB_CTRL_MODEL),          rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID)      };      POA childPOA = rootPOA.create_POA("childPOA",rootPOA.the_POAManager(),policies);      rootPOA.the_POAManager().activate();      // Create the servant      Counter.CountImpl countImpl = new Counter.CountImpl();      // Create and activate the object      byte[] oid1 = "hello1".getBytes();      childPOA.activate_object_with_id(oid1,countImpl);      org.omg.CORBA.Object obj1 = childPOA.id_to_reference(oid1);      out1.println(orb.object_to_string(obj1));      out1.close();      orb.run();    } catch (Exception e) { e.printStackTrace(); }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -