1 21 package org.jacorb.imr; 22 23 import org.jacorb.imr.RegistrationPackage.*; 24 import org.jacorb.imr.AdminPackage.*; 25 26 import org.jacorb.util.*; 27 28 36 37 public class ImRPOAInfo 38 implements java.io.Serializable 39 { 40 protected int port; 41 protected ImRServerInfo server; 42 protected String host; 43 protected String name; 44 protected boolean active; 45 protected long timeout; 47 57 58 public ImRPOAInfo(String name, 59 String host, 60 int port, 61 ImRServerInfo server, 62 long timeout) 63 throws IllegalPOAName 64 { 65 if (name == null || name.length() == 0) 66 throw new IllegalPOAName(name); 67 68 this.name = name; 69 this.host = host; 70 this.port = port; 71 this.server = server; 72 this.active = true; 73 this.timeout = timeout; 74 } 75 76 81 82 public POAInfo toPOAInfo() 83 { 84 return new POAInfo(name, host, port,server.name, active); 85 } 86 87 94 95 public synchronized void reactivate(String host, int port) 96 { 97 this.host = host; 98 this.port = port; 99 active = true; 100 server.active = true; 101 server.restarting = false; 102 notifyAll(); 103 } 104 105 111 112 public synchronized boolean awaitActivation() 113 { 114 while(!active) 115 { 116 try 117 { 118 long _sleep_begin = System.currentTimeMillis(); 119 wait(timeout); 120 if (!active && 121 (System.currentTimeMillis() - _sleep_begin) > timeout) 122 { 123 return false; 124 } 125 } 126 catch (java.lang.Exception e) 127 { 128 e.printStackTrace(); 131 } 132 } 133 134 return true; 135 } 136 } 138 | Popular Tags |