code: public void destroyProxy(ClientProxy proxy) {
          ObjectNamespace objectNamespace = new DistributedObjectNamespace(proxy.getServiceName(),
                  proxy.getDistributedObjectName());
          ClientProxyFuture registeredProxyFuture = proxies.remove(objectNamespace);
          ClientProxy registeredProxy = registeredProxyFuture == null ? null : registeredProxyFuture.get();
  
          try {
              if (registeredProxy != null) {
                  try {
                      registeredProxy.destroyLocally();
                  } finally {
                      registeredProxy.destroyRemotely();
                  }
              }
          } finally {
              if (proxy != registeredProxy) {
                  // The given proxy is stale and was already destroyed, but the caller
                  // may have allocated local resources in the context of this stale proxy
                  // instance after it was destroyed, so we have to cleanup it locally one
                  // more time to make sure there are no leaking local resources.
                  proxy.destroyLocally();
              }
          }
      }
docs: Destroys the given proxy in a cluster-wide way.
  <p>
  Upon successful completion the proxy is unregistered in this proxy
  manager, all local resources associated with the proxy are released and
  a distributed object destruction operation is issued to the cluster.
  <p>
  If the given proxy instance is not registered in this proxy manager, the
  proxy instance is considered stale. In this case, this stale instance is
  a subject to a local-only destruction and its registered counterpart, if
  there is any, is a subject to a cluster-wide destruction.
  
  @param proxy the proxy to destroy.