01: /*
02: * JacORB - a free Java ORB
03: *
04: * Copyright (C) 1997-2004 Gerald Brose.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Library General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Library General Public License for more details.
15: *
16: * You should have received a copy of the GNU Library General Public
17: * License along with this library; if not, write to the Free
18: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19: */
20:
21: package org.jacorb.orb.iiop;
22:
23: import java.util.HashMap;
24: import java.util.Map;
25:
26: /**
27: * @author Kevin Conner (Kevin.Conner@arjuna.com)
28: * @version $Id: IIOPLoopbackRegistry.java,v 1.2 2005/09/27 20:52:18 phil.mesnier Exp $
29: */
30: public class IIOPLoopbackRegistry {
31: private static final IIOPLoopbackRegistry REGISTRY = new IIOPLoopbackRegistry();
32:
33: private final Map loopbackMap = new HashMap();
34:
35: private IIOPLoopbackRegistry() {
36: }
37:
38: public static IIOPLoopbackRegistry getRegistry() {
39: return REGISTRY;
40: }
41:
42: public synchronized void register(final IIOPAddress address,
43: final IIOPLoopback loopback) {
44: loopbackMap.put(address, loopback);
45: }
46:
47: public synchronized void unregister(final IIOPAddress address) {
48: loopbackMap.remove(address);
49: }
50:
51: public synchronized IIOPLoopback getLoopback(
52: final IIOPAddress address) {
53: return (IIOPLoopback) loopbackMap.get(address);
54: }
55: }
|