1 | public void getDataBahnHandle() { |
2 | try { |
3 | _chatSession.createBahn(partyName, "Chat"); |
4 | System.out.println("New Party created"); |
5 | } catch (jdceBahnException e) { |
6 | System.out.println("Exception in creations" +e); |
7 | } catch (Exception e) { |
8 | e.printStackTrace(); |
9 | } |
10 | |
11 | long startTime = System.currentTimeMillis(); |
12 | try { |
13 | // Initialize the ORB. |
14 | org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(this, null); |
15 | |
16 | /* Get a reference to the Naming Service */ |
17 | org.omg.CORBA.Object nameServiceObj = |
18 | orb.resolve_initial_references("NameService"); |
19 | |
20 | if (nameServiceObj == null) { |
21 | System.out.println("Name Service Object = null"); |
22 | return; |
23 | } |
24 | |
25 | org.omg.CosNaming.NamingContext nameService = |
26 | org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj); |
27 | if (nameService == null) { |
28 | System.out.println("nameService = null"); |
29 | return; |
30 | } |
31 | |
32 | NameComponent[] collabName = |
33 | { new NameComponent("Collaboration", partyName+"Chat"+"Coordinator")}; |
34 | |
35 | _chatBahn= |
36 | jdce.byteways.dataBahnHelper.narrow(nameService.resolve(collabName)); |
37 | } catch(Exception e) { |
38 | System.out.println("Exception: " + e); |
39 | } |
40 | long stopTime = System.currentTimeMillis(); |
41 | System.out.println("Avg Ping to invoke = " |
42 | + ((stopTime - startTime)/1000f) + " msecs"); |
43 | } |