KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > runtime > jini > JiniRuntimeImpl


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.core.runtime.jini;
32
33 import net.jini.core.entry.Entry;
34 import net.jini.core.lease.Lease;
35 import net.jini.core.lookup.ServiceID;
36 import net.jini.core.lookup.ServiceItem;
37 import net.jini.core.lookup.ServiceRegistrar;
38 import net.jini.core.lookup.ServiceRegistration;
39
40 import net.jini.discovery.DiscoveryEvent;
41
42 import net.jini.lease.LeaseRenewalEvent;
43
44 import net.jini.lookup.entry.Name;
45
46 import org.objectweb.proactive.Body;
47 import org.objectweb.proactive.core.body.UniversalBody;
48 import org.objectweb.proactive.core.descriptor.data.VirtualNode;
49 import org.objectweb.proactive.core.mop.ConstructorCall;
50 import org.objectweb.proactive.core.mop.ConstructorCallExecutionFailedException;
51 import org.objectweb.proactive.core.node.NodeException;
52 import org.objectweb.proactive.core.process.UniversalProcess;
53 import org.objectweb.proactive.core.runtime.ProActiveRuntime;
54 import org.objectweb.proactive.core.runtime.ProActiveRuntimeImpl;
55 import org.objectweb.proactive.core.runtime.VMInformation;
56 import org.objectweb.proactive.core.util.UrlBuilder;
57 import org.objectweb.proactive.ext.security.PolicyServer;
58 import org.objectweb.proactive.ext.security.ProActiveSecurityManager;
59
60 import java.io.IOException JavaDoc;
61
62 import java.lang.reflect.InvocationTargetException JavaDoc;
63
64 import java.rmi.RemoteException JavaDoc;
65
66 import java.security.SecureRandom JavaDoc;
67 import java.security.cert.X509Certificate JavaDoc;
68
69 import java.util.ArrayList JavaDoc;
70 import java.util.Hashtable JavaDoc;
71 import java.util.Vector JavaDoc;
72
73
74 /**
75  * An adapter for a ProActiveRuntime to be able to receive remote calls. This helps isolate JINI-specific
76  * code into a small set of specific classes, thus enabling reuse if we one day decide to switch
77  * to anothe remote objects library.
78  * @see <a HREF="http://www.javaworld.com/javaworld/jw-05-1999/jw-05-networked_p.html">Adapter Pattern</a>
79  */

80 public class JiniRuntimeImpl extends java.rmi.server.UnicastRemoteObject JavaDoc
81     implements JiniRuntime, java.io.Serializable JavaDoc,
82         net.jini.discovery.DiscoveryListener, net.jini.lease.LeaseListener {
83     protected transient ProActiveRuntimeImpl proActiveRuntime;
84     protected String JavaDoc proActiveRuntimeURL;
85
86     //ServiceRegistar table used afterwards to register node service
87
//Vector is used because the size is unknown and this class is synchronized
88
protected java.util.Vector JavaDoc registrarsTable;
89
90     //table used to store references on runtime registration in order to be
91
//able to unregister it from all lookup services. There is no need for a Hashtable
92
//since there is only one key, but it is for coding purpose.
93
protected java.util.Hashtable JavaDoc jiniRuntimeMap;
94
95     //table used to handle node's registration when discovery event is received after the node's creation
96
protected java.util.Hashtable JavaDoc jiniNodeMap;
97
98     //table used to handle virtualnode's registration when discovery event is received after the virtualnode's registration
99
//this table contains a mapping virtualNode's name and an arrayList that contains all associated ServiceRegistrations
100
protected java.util.Hashtable JavaDoc jiniVirtualNodeMap;
101     private boolean isRuntimeRegistered = false;
102
103     // this object is not serializable
104
protected transient net.jini.lease.LeaseRenewalManager leaseManager = new net.jini.lease.LeaseRenewalManager();
105
106     //
107
// -- Constructors -----------------------------------------------
108
//
109
public JiniRuntimeImpl() throws java.rmi.RemoteException JavaDoc {
110         this.proActiveRuntime = (ProActiveRuntimeImpl) ProActiveRuntimeImpl.getProActiveRuntime();
111         this.proActiveRuntimeURL = buildRuntimeURL();
112         this.jiniRuntimeMap = new java.util.Hashtable JavaDoc();
113         jiniRuntimeMap.put(proActiveRuntimeURL, new java.util.Vector JavaDoc());
114         this.jiniNodeMap = new java.util.Hashtable JavaDoc();
115         this.jiniVirtualNodeMap = new java.util.Hashtable JavaDoc();
116         this.registrarsTable = new java.util.Vector JavaDoc();
117         net.jini.discovery.LookupDiscovery discover = null;
118         try {
119             discover = new net.jini.discovery.LookupDiscovery(net.jini.discovery.LookupDiscovery.ALL_GROUPS);
120             // stay around long enough to receice replies
121
//Thread.currentThread().sleep(10000L);
122
} catch (Exception JavaDoc e) {
123             logger.error(e.toString());
124         }
125
126         discover.addDiscoveryListener(this);
127     }
128
129     //
130
// -- PUBLIC METHODS -----------------------------------------------
131
//
132
//
133
// -- Implements JiniRuntime -----------------------------------------------
134
//
135
public String JavaDoc createLocalNode(String JavaDoc nodeName,
136         boolean replacePreviousBinding, PolicyServer ps, String JavaDoc vnname, String JavaDoc jobId)
137         throws java.rmi.RemoteException JavaDoc, NodeException {
138         //counter used to check that the node has been registered at
139
//least once as jini service
140
//int counter = 0;
141
//wait until the discovered method is called
142
//otherwise registars could be null, because it is
143
//another thread that fulfill this table
144
while (!isRuntimeRegistered) {
145         }
146         String JavaDoc nodeURL = null;
147
148         //first we build a well-formed url
149
try {
150             nodeURL = buildNodeURL(nodeName);
151             //then take the name of the node
152
String JavaDoc name = UrlBuilder.getNameFromUrl(nodeURL);
153
154             //System.out.println("name is : "+ name);
155
//System.out.println("url is : "+ nodeURL);
156
//create the node with the name
157
proActiveRuntime.createLocalNode(name, replacePreviousBinding, ps,
158                 vnname, jobId);
159         } catch (java.net.UnknownHostException JavaDoc e) {
160             throw new java.rmi.RemoteException JavaDoc("Host unknown in " + nodeURL, e);
161         }
162
163         jiniNodeMap.put(nodeURL, registerService(nodeURL));
164
165         return nodeURL;
166     }
167
168     public void killAllNodes() throws java.rmi.RemoteException JavaDoc {
169         for (java.util.Enumeration JavaDoc e = jiniNodeMap.keys(); e.hasMoreElements();) {
170             String JavaDoc nodeURL = (String JavaDoc) e.nextElement();
171             killNode(nodeURL);
172         }
173     }
174
175     public void killNode(String JavaDoc nodeName) throws java.rmi.RemoteException JavaDoc {
176         String JavaDoc nodeUrl = null;
177         try {
178             nodeUrl = buildNodeURL(nodeName);
179             unregisterService(nodeUrl, jiniNodeMap);
180         } catch (java.net.UnknownHostException JavaDoc e) {
181             throw new java.rmi.RemoteException JavaDoc("Host unknown in " + nodeUrl, e);
182         }
183         proActiveRuntime.killNode(nodeName);
184     }
185
186     public void createVM(UniversalProcess remoteProcess)
187         throws IOException JavaDoc {
188         proActiveRuntime.createVM(remoteProcess);
189     }
190
191     public String JavaDoc[] getLocalNodeNames() {
192         return proActiveRuntime.getLocalNodeNames();
193     }
194
195     public VMInformation getVMInformation() {
196         return proActiveRuntime.getVMInformation();
197     }
198
199     public void register(ProActiveRuntime proActiveRuntimeDist,
200         String JavaDoc proActiveRuntimeName, String JavaDoc creatorID, String JavaDoc creationProtocol,
201         String JavaDoc vmName) {
202         proActiveRuntime.register(proActiveRuntimeDist, proActiveRuntimeName,
203             creatorID, creationProtocol, vmName);
204     }
205
206     public ProActiveRuntime[] getProActiveRuntimes() {
207         return proActiveRuntime.getProActiveRuntimes();
208     }
209
210     public ProActiveRuntime getProActiveRuntime(String JavaDoc proActiveRuntimeName) {
211         return proActiveRuntime.getProActiveRuntime(proActiveRuntimeName);
212     }
213
214     public void killRT(boolean softly) throws java.rmi.RemoteException JavaDoc {
215         killAllNodes();
216         unregisterAllVirtualNodes();
217         unregisterService(proActiveRuntimeURL, jiniRuntimeMap);
218         proActiveRuntime.killRT(false);
219     }
220
221     public String JavaDoc getURL() {
222         return proActiveRuntimeURL;
223     }
224
225     public ArrayList JavaDoc getActiveObjects(String JavaDoc nodeName) {
226         return proActiveRuntime.getActiveObjects(nodeName);
227     }
228
229     public ArrayList JavaDoc getActiveObjects(String JavaDoc nodeName, String JavaDoc objectName) {
230         return proActiveRuntime.getActiveObjects(nodeName, objectName);
231     }
232
233     public VirtualNode getVirtualNode(String JavaDoc virtualNodeName) {
234         return proActiveRuntime.getVirtualNode(virtualNodeName);
235     }
236
237     public void registerVirtualNode(String JavaDoc virtualNodeName,
238         boolean replacePreviousBinding) throws java.rmi.RemoteException JavaDoc {
239         String JavaDoc virtualNodeURL = null;
240
241         //first we build a well-formed url
242
try {
243             virtualNodeURL = buildNodeURL(virtualNodeName);
244         } catch (java.net.UnknownHostException JavaDoc e) {
245             throw new java.rmi.RemoteException JavaDoc("Host unknown in " +
246                 virtualNodeURL, e);
247         }
248
249         if (replacePreviousBinding) {
250             if (jiniVirtualNodeMap.get(virtualNodeURL) != null) {
251                 jiniVirtualNodeMap.remove(virtualNodeURL);
252             }
253         }
254         if (!replacePreviousBinding &&
255                 (jiniVirtualNodeMap.get(virtualNodeURL) != null)) {
256             throw new java.rmi.RemoteException JavaDoc("VirtualNode " + virtualNodeURL +
257                 " already registered as Jini service");
258         }
259
260         jiniVirtualNodeMap.put(virtualNodeURL, registerService(virtualNodeURL));
261     }
262
263     public void unregisterVirtualNode(String JavaDoc virtualNodeName)
264         throws java.rmi.RemoteException JavaDoc {
265         proActiveRuntime.unregisterVirtualNode(UrlBuilder.removeVnSuffix(
266                 virtualNodeName));
267         String JavaDoc virtualNodeURL = null;
268         proActiveRuntime.unregisterVirtualNode(UrlBuilder.removeVnSuffix(
269                 virtualNodeName));
270         //first we build a well-formed url
271
try {
272             virtualNodeURL = buildNodeURL(virtualNodeName);
273             unregisterService(virtualNodeURL, jiniVirtualNodeMap);
274         } catch (java.net.UnknownHostException JavaDoc e) {
275             throw new java.rmi.RemoteException JavaDoc("Host unknown in " +
276                 virtualNodeURL, e);
277         }
278     }
279
280     public void unregisterAllVirtualNodes() throws RemoteException JavaDoc {
281         for (java.util.Enumeration JavaDoc e = jiniVirtualNodeMap.keys();
282                 e.hasMoreElements();) {
283             String JavaDoc vnNodeURL = (String JavaDoc) e.nextElement();
284             unregisterVirtualNode(vnNodeURL);
285         }
286     }
287
288     public UniversalBody createBody(String JavaDoc nodeName,
289         ConstructorCall bodyConstructorCall, boolean isNodeLocal)
290         throws ConstructorCallExecutionFailedException,
291             InvocationTargetException JavaDoc {
292         return proActiveRuntime.createBody(nodeName, bodyConstructorCall,
293             isNodeLocal);
294     }
295
296     public UniversalBody receiveBody(String JavaDoc nodeName, Body body) {
297         return proActiveRuntime.receiveBody(nodeName, body);
298     }
299
300     //
301
// -- Implements DiscoveryListener,LeaseListener-----------------------------------------------
302
//
303
public void discovered(DiscoveryEvent evt) {
304         ServiceRegistrar[] registrars = evt.getRegistrars();
305
306         //System.out.println("NB registrar "+registrars.length);
307
// on cherche un registrar pour pouvoir s'enregistrer
308
for (int n = 0; n < registrars.length; n++) {
309             ServiceRegistrar registrar = registrars[n];
310
311             ServiceRegistration reg = null;
312             try {
313                 // construction du service
314
//ServiceItem item = new ServiceItem(null, this, new Entry[] { new Name(proActiveRuntimeURL)});
315
ServiceItem item = new ServiceItem(newServiceID(), this,
316                         new Entry[] { new Name(proActiveRuntimeURL) });
317                 reg = registrar.register(item, Lease.FOREVER);
318             } catch (Exception JavaDoc e) {
319                 //e.printStackTrace();
320
logger.error("register exception " + e.toString());
321                 continue;
322             }
323             ((Vector JavaDoc) jiniRuntimeMap.get(proActiveRuntimeURL)).add(reg);
324
325             //add the registrar in the table for future use(node registration)
326
registrarsTable.add(registrar);
327
328             registerServiceAfterDiscovery(jiniNodeMap, registrar);
329             registerServiceAfterDiscovery(jiniVirtualNodeMap, registrar);
330             // on lance le lease manager pour que l'objet puisse se reenregistrer
331
leaseManager.renewUntil(reg.getLease(), Lease.FOREVER, this);
332             isRuntimeRegistered = true;
333         }
334
335         //we put this line in order to avoid deadlock in createLocalNode
336
//Hence if a problem occurs when registering the runtime, we can still try to register
337
//it in the createLocalNode method and an exception will be thrown in this method
338
isRuntimeRegistered = true;
339     }
340
341     public void discarded(DiscoveryEvent evt) {
342     }
343
344     public void notify(LeaseRenewalEvent evt) {
345         logger.info("Lease expired " + evt.toString());
346         logger.info(evt.getException().getMessage());
347     }
348
349     //
350
// -- PROTECTED METHODS -----------------------------------------------
351
//
352
protected ServiceID newServiceID() {
353
354         /** random number generator for UUID generation */
355         SecureRandom JavaDoc secRand = new SecureRandom JavaDoc();
356
357         /** 128-bit buffer for use with secRand */
358         byte[] secRandBuf16 = new byte[16];
359
360         /** 64-bit buffer for use with secRand */
361         byte[] secRandBuf8 = new byte[8];
362
363         secRand.nextBytes(secRandBuf16);
364         secRandBuf16[6] &= 0x0f;
365         secRandBuf16[6] |= 0x40; /* version 4 */
366         secRandBuf16[8] &= 0x3f;
367         secRandBuf16[8] |= 0x80; /* IETF variant */
368         secRandBuf16[10] |= 0x80; /* multicast bit */
369         long mostSig = 0;
370         for (int i = 0; i < 8; i++) {
371             mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff);
372         }
373         long leastSig = 0;
374         for (int i = 8; i < 16; i++) {
375             leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff);
376         }
377         return new ServiceID(mostSig, leastSig);
378     }
379
380     // SECURITY
381

382     /* (non-Javadoc)
383      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#getCreatorCertificate()
384      */

385     public X509Certificate JavaDoc getCreatorCertificate()
386         throws java.rmi.RemoteException JavaDoc {
387         return proActiveRuntime.getCreatorCertificate();
388     }
389
390     public PolicyServer getPolicyServer() throws java.rmi.RemoteException JavaDoc {
391         return proActiveRuntime.getPolicyServer();
392     }
393
394     public void setProActiveSecurityManager(ProActiveSecurityManager ps)
395         throws java.rmi.RemoteException JavaDoc {
396         proActiveRuntime.setProActiveSecurityManager(ps);
397     }
398
399     public String JavaDoc getVNName(String JavaDoc Nodename) throws java.rmi.RemoteException JavaDoc {
400         return proActiveRuntime.getVNName(Nodename);
401     }
402
403     /* (non-Javadoc)
404      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#setDefaultNodeVirtualNodeName(java.lang.String)
405      */

406     public void setDefaultNodeVirtualNodeName(String JavaDoc s)
407         throws RemoteException JavaDoc {
408         proActiveRuntime.setDefaultNodeVirtualNodeName(s);
409     }
410
411     /* (non-Javadoc)
412      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#updateLocalNodeVirtualName()
413      */

414     public void updateLocalNodeVirtualName() throws RemoteException JavaDoc {
415         //proActiveRuntime.updateLocalNodeVirtualName();
416
}
417
418     /* (non-Javadoc)
419      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#getNodePolicyServer(java.lang.String)
420      */

421     public PolicyServer getNodePolicyServer(String JavaDoc nodeName)
422         throws RemoteException JavaDoc {
423         return proActiveRuntime.getNodePolicyServer(nodeName);
424     }
425
426     /* (non-Javadoc)
427      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#enableSecurityIfNeeded()
428      */

429     public void enableSecurityIfNeeded() throws RemoteException JavaDoc {
430         proActiveRuntime.enableSecurityIfNeeded();
431     }
432
433     /* (non-Javadoc)
434      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#getNodeCertificate(java.lang.String)
435      */

436     public X509Certificate JavaDoc getNodeCertificate(String JavaDoc nodeName)
437         throws RemoteException JavaDoc {
438         return proActiveRuntime.getNodeCertificate(nodeName);
439     }
440
441     /**
442      * @param nodeName
443      * @return returns all entities associated to the node
444      */

445     public ArrayList JavaDoc getEntities(String JavaDoc nodeName) throws RemoteException JavaDoc {
446         return proActiveRuntime.getEntities(nodeName);
447     }
448
449     /**
450      * @param nodeName
451      * @return returns all entities associated to the node
452      */

453     public ArrayList JavaDoc getEntities(UniversalBody uBody) throws RemoteException JavaDoc {
454         return proActiveRuntime.getEntities(uBody);
455     }
456
457     /**
458      * @return returns all entities associated to this runtime
459      */

460     public ArrayList JavaDoc getEntities() throws RemoteException JavaDoc {
461         return proActiveRuntime.getEntities();
462     }
463
464     /**
465      * @see org.objectweb.proactive.core.runtime.jini.JiniRuntime#getJobID(java.lang.String)
466      */

467     public String JavaDoc getJobID(String JavaDoc nodeUrl) throws RemoteException JavaDoc {
468         return proActiveRuntime.getJobID(nodeUrl);
469     }
470
471     //
472
// ---PRIVATE METHODS--------------------------------------
473
//
474
//This method is very useful when the JiniRuntime receives event about a new Lookup service
475
//that was discovered.In such case, the runtime registers all nodes and virtualnodes previously registered
476
//as Jini service with the registrar given as parameter and the corresponding hashtable
477
private void registerServiceAfterDiscovery(Hashtable JavaDoc jiniObjectTable,
478         ServiceRegistrar registrar) {
479         ServiceRegistration reg = null;
480         ServiceID serviceID = null;
481         if (!jiniObjectTable.isEmpty()) {
482             synchronized (jiniObjectTable) {
483                 for (java.util.Enumeration JavaDoc e = jiniObjectTable.keys();
484                         e.hasMoreElements();) {
485                     String JavaDoc objectURL = (String JavaDoc) e.nextElement();
486                     Vector JavaDoc serviceRegistrationTable = (Vector JavaDoc) jiniObjectTable.get(objectURL);
487                     if (!serviceRegistrationTable.isEmpty()) {
488                         serviceID = ((ServiceRegistration) serviceRegistrationTable.get(0)).getServiceID();
489                     } else {
490                         serviceID = newServiceID();
491                     }
492                     ServiceItem item = new ServiceItem(serviceID, this,
493                             new Entry[] { new Name(objectURL) });
494                     try {
495                         reg = registrar.register(item, Lease.FOREVER);
496                     } catch (Exception JavaDoc ex) {
497                         logger.info("register exception " + ex.toString());
498                         continue;
499                     }
500                     logger.info(" Service Registered " + objectURL);
501
502                     // on lance le lease manager pour que l'objet puisse se reenregistrer
503
leaseManager.renewUntil(reg.getLease(), Lease.FOREVER, this);
504                     ((Vector JavaDoc) jiniObjectTable.get(objectURL)).add(reg);
505                 }
506             }
507         }
508     }
509
510     private String JavaDoc buildRuntimeURL() {
511         String JavaDoc host = getVMInformation().getInetAddress().getCanonicalHostName();
512         String JavaDoc name = getVMInformation().getName();
513         return UrlBuilder.buildUrl(host, name, "jini:");
514     }
515
516     private String JavaDoc buildNodeURL(String JavaDoc url)
517         throws java.net.UnknownHostException JavaDoc {
518         int i = url.indexOf('/');
519         if (i == -1) {
520             //it is an url given by a descriptor
521
String JavaDoc host = getVMInformation().getInetAddress().getCanonicalHostName();
522             return UrlBuilder.buildUrl(host, url, "jini:");
523         } else {
524             return UrlBuilder.checkUrl(url);
525         }
526     }
527
528     private Vector JavaDoc registerService(String JavaDoc objectUrl)
529         throws java.rmi.RemoteException JavaDoc {
530         //counter used to check that the object has been registered at
531
//least once as jini service
532
int counter = 0;
533         ServiceID serviceID = newServiceID();
534         Vector JavaDoc serviceRegistrationTable = new Vector JavaDoc();
535
536         //register it as a jini service with the url
537
for (int n = 0; n < registrarsTable.size(); n++) {
538             ServiceRegistrar registrar = (ServiceRegistrar) registrarsTable.get(n);
539             ServiceRegistration reg = null;
540             try {
541                 ServiceItem item = new ServiceItem(serviceID, this,
542                         new Entry[] { new Name(objectUrl) });
543                 reg = registrar.register(item, Lease.FOREVER);
544                 counter++;
545             } catch (Exception JavaDoc e) {
546                 logger.info("register exception " + e.toString());
547                 continue;
548             }
549
550             // if counter=0 no node or vn are registered as jini Service
551
if (counter == 0) {
552                 throw new java.rmi.RemoteException JavaDoc("register exception ");
553             }
554             logger.info("Service registered " + objectUrl);
555             //System.out.println("Registrar "+registrar.getLocator().getHost());
556
// on lance le lease manager pour que l'objet puisse se reenregistrer
557
leaseManager.renewUntil(reg.getLease(), Lease.FOREVER, this);
558             serviceRegistrationTable.add(reg);
559         }
560         return serviceRegistrationTable;
561     }
562
563     private void unregisterService(String JavaDoc objectUrl, Hashtable JavaDoc jiniObjectTable)
564         throws java.rmi.RemoteException JavaDoc {
565         if (!jiniObjectTable.isEmpty()) {
566             synchronized (jiniObjectTable) {
567                 try {
568                     Vector JavaDoc serviceRegistrationTable = (Vector JavaDoc) jiniObjectTable.get(objectUrl);
569                     if (!serviceRegistrationTable.isEmpty()) {
570                         for (int i = 0; i < serviceRegistrationTable.size();
571                                 i++) {
572                             ServiceRegistration reg = (ServiceRegistration) serviceRegistrationTable.get(i);
573                             reg.getLease().cancel();
574                         }
575                         if (objectUrl.indexOf("PA_RT") < 0) {
576                             logger.info("Lease cancelled for " + objectUrl);
577                         }
578                     }
579                 } catch (net.jini.core.lease.UnknownLeaseException e) {
580                     throw new java.rmi.RemoteException JavaDoc(
581                         "Unable to get the Lease for virtualNode " + objectUrl,
582                         e);
583                 } finally {
584                     jiniObjectTable.remove(objectUrl);
585                 }
586             }
587         }
588     }
589 }
590
Popular Tags