< prev index next >

src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java

Print this page




 138         }
 139     }
 140 
 141     /*
 142      * Create the export the object using the parameter
 143      * <code>uref</code>
 144      */
 145     private void setup(UnicastServerRef uref)
 146         throws RemoteException
 147     {
 148         /* Server ref must be created and assigned before remote
 149          * object 'this' can be exported.
 150          */
 151         ref = uref;
 152         uref.exportObject(this, null, true);
 153     }
 154 
 155     /**
 156      * Returns the remote object for specified name in the registry.
 157      * @exception RemoteException If remote operation failed.
 158      * @exception NotBound If name is not currently bound.
 159      */
 160     public Remote lookup(String name)
 161         throws RemoteException, NotBoundException
 162     {
 163         synchronized (bindings) {
 164             Remote obj = bindings.get(name);
 165             if (obj == null)
 166                 throw new NotBoundException(name);
 167             return obj;
 168         }
 169     }
 170 
 171     /**
 172      * Binds the name to the specified remote object.
 173      * @exception RemoteException If remote operation failed.
 174      * @exception AlreadyBoundException If name is already bound.
 175      */
 176     public void bind(String name, Remote obj)
 177         throws RemoteException, AlreadyBoundException, AccessException
 178     {
 179         checkAccess("Registry.bind");
 180         synchronized (bindings) {
 181             Remote curr = bindings.get(name);
 182             if (curr != null)
 183                 throw new AlreadyBoundException(name);
 184             bindings.put(name, obj);
 185         }
 186     }
 187 
 188     /**
 189      * Unbind the name.
 190      * @exception RemoteException If remote operation failed.
 191      * @exception NotBound If name is not currently bound.
 192      */
 193     public void unbind(String name)
 194         throws RemoteException, NotBoundException, AccessException
 195     {
 196         checkAccess("Registry.unbind");
 197         synchronized (bindings) {
 198             Remote obj = bindings.get(name);
 199             if (obj == null)
 200                 throw new NotBoundException(name);
 201             bindings.remove(name);
 202         }
 203     }
 204 
 205     /**
 206      * Rebind the name to a new object, replaces any existing binding.
 207      * @exception RemoteException If remote operation failed.
 208      */
 209     public void rebind(String name, Remote obj)
 210         throws RemoteException, AccessException
 211     {




 138         }
 139     }
 140 
 141     /*
 142      * Create the export the object using the parameter
 143      * <code>uref</code>
 144      */
 145     private void setup(UnicastServerRef uref)
 146         throws RemoteException
 147     {
 148         /* Server ref must be created and assigned before remote
 149          * object 'this' can be exported.
 150          */
 151         ref = uref;
 152         uref.exportObject(this, null, true);
 153     }
 154 
 155     /**
 156      * Returns the remote object for specified name in the registry.
 157      * @exception RemoteException If remote operation failed.
 158      * @exception NotBoundException If name is not currently bound.
 159      */
 160     public Remote lookup(String name)
 161         throws RemoteException, NotBoundException
 162     {
 163         synchronized (bindings) {
 164             Remote obj = bindings.get(name);
 165             if (obj == null)
 166                 throw new NotBoundException(name);
 167             return obj;
 168         }
 169     }
 170 
 171     /**
 172      * Binds the name to the specified remote object.
 173      * @exception RemoteException If remote operation failed.
 174      * @exception AlreadyBoundException If name is already bound.
 175      */
 176     public void bind(String name, Remote obj)
 177         throws RemoteException, AlreadyBoundException, AccessException
 178     {
 179         checkAccess("Registry.bind");
 180         synchronized (bindings) {
 181             Remote curr = bindings.get(name);
 182             if (curr != null)
 183                 throw new AlreadyBoundException(name);
 184             bindings.put(name, obj);
 185         }
 186     }
 187 
 188     /**
 189      * Unbind the name.
 190      * @exception RemoteException If remote operation failed.
 191      * @exception NotBoundException If name is not currently bound.
 192      */
 193     public void unbind(String name)
 194         throws RemoteException, NotBoundException, AccessException
 195     {
 196         checkAccess("Registry.unbind");
 197         synchronized (bindings) {
 198             Remote obj = bindings.get(name);
 199             if (obj == null)
 200                 throw new NotBoundException(name);
 201             bindings.remove(name);
 202         }
 203     }
 204 
 205     /**
 206      * Rebind the name to a new object, replaces any existing binding.
 207      * @exception RemoteException If remote operation failed.
 208      */
 209     public void rebind(String name, Remote obj)
 210         throws RemoteException, AccessException
 211     {


< prev index next >