KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > cmi > ClusterRegistryKiller


1 /*
2  * Copyright (C) 2002-2003, Simon Nieuviarts
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  */

19 package org.objectweb.carol.cmi;
20
21 import java.rmi.NoSuchObjectException JavaDoc;
22
23 import org.objectweb.carol.util.configuration.TraceCarol;
24
25 /**
26  * Handle returned when starting a registry. Use to kill it.
27  * @author Simon Nieuviarts
28  */

29 public final class ClusterRegistryKiller {
30     /**
31      * Stub, to unexport this registry
32      */

33     private ClusterRegistryImpl impl;
34
35     /**
36      * Port on which the registry has been exported.
37      */

38     private int port;
39
40     /**
41      * @param impl the registry that will be killed by this killer.
42      * @param port the port it is exported on.
43      */

44     ClusterRegistryKiller(
45         ClusterRegistryImpl impl,
46         int port) {
47         this.impl = impl;
48         this.port = port;
49     }
50
51     /**
52      * Stop the registry. After the call, this object is useless.
53      * @throws NoSuchObjectException if the registry has not been exported.
54      */

55     public synchronized void stop() throws NoSuchObjectException JavaDoc {
56         if (TraceCarol.isDebugCmiRegistry()) {
57             TraceCarol.debugCmiRegistry("killer is stopping registry on port " + port);
58         }
59         LowerOrb.unexportObject(impl);
60         impl = null;
61     }
62 }
63
Popular Tags