multithread.java

来自「this an example showing how the threadin」· Java 代码 · 共 40 行

JAVA
40
字号
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 + =
减小字号Ctrl + -
显示快捷键?