예제 #1
0
  @Override
  public synchronized Ice.Object findByProxy(ObjectPrx proxy) {
    checkForDeactivation();

    IceInternal.Reference ref = ((ObjectPrxHelperBase) proxy).__reference();
    return findFacet(ref.getIdentity(), ref.getFacet());
  }
예제 #2
0
  public boolean isLocal(ObjectPrx proxy) {
    //
    // NOTE: it's important that isLocal() doesn't perform any blocking operations as
    // it can be called for AMI invocations if the proxy has no delegate set yet.
    //

    IceInternal.Reference ref = ((ObjectPrxHelperBase) proxy).__reference();
    if (ref.isWellKnown()) {
      //
      // Check the active servant map to see if the well-known
      // proxy is for a local object.
      //
      return _servantManager.hasServant(ref.getIdentity());
    } else if (ref.isIndirect()) {
      //
      // Proxy is local if the reference adapter id matches this
      // adapter id or replica group id.
      //
      return ref.getAdapterId().equals(_id) || ref.getAdapterId().equals(_replicaGroupId);
    } else {
      IceInternal.EndpointI[] endpoints = ref.getEndpoints();

      synchronized (this) {
        checkForDeactivation();

        //
        // Proxies which have at least one endpoint in common with the
        // endpoints used by this object adapter's incoming connection
        // factories are considered local.
        //
        for (IceInternal.EndpointI endpoint : endpoints) {
          for (IceInternal.EndpointI p : _publishedEndpoints) {
            if (endpoint.equivalent(p)) {
              return true;
            }
          }
          for (IncomingConnectionFactory p : _incomingConnectionFactories) {
            if (endpoint.equivalent(p.endpoint())) {
              return true;
            }
          }
        }

        //
        // Proxies which have at least one endpoint in common with the
        // router's server proxy endpoints (if any), are also considered
        // local.
        //
        if (_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter())) {
          for (IceInternal.EndpointI endpoint : endpoints) {
            for (IceInternal.EndpointI p : _routerEndpoints) {
              if (endpoint.equivalent(p)) {
                return true;
              }
            }
          }
        }
      }
    }

    return false;
  }