Ejemplo n.º 1
0
        } // CreateServerChannelSinkChain

        // Check if the object has been disconnected or if it is
        // a well known object then we have to create it lazily.
        internal static ServerIdentity CheckDisconnectedOrCreateWellKnownObject(IMessage msg)
        {
            ServerIdentity ident = InternalSink.GetServerIdentity(msg);

            BCLDebug.Trace("REMOTE", "Identity found = " + (ident == null ? "null" : "ServerIdentity"));

            // If the identity is null, then we should check whether the
            // request if for a well known object. If yes, then we should
            // create the well known object lazily and marshal it.
            if ((ident == null) || ident.IsRemoteDisconnected())
            {
                String uri = InternalSink.GetURI(msg);
                BCLDebug.Trace("REMOTE", "URI " + uri);
                if (uri != null)
                {
                    ServerIdentity newIdent = RemotingConfigHandler.CreateWellKnownObject(uri);
                    if (newIdent != null)
                    {
                        // The uri was a registered wellknown object.
                        ident = newIdent;
                        BCLDebug.Trace("REMOTE", "Identity created = " + (ident == null ? "null" : "ServerIdentity"));
                    }
                }
            }


            if ((ident == null) || (ident.IsRemoteDisconnected()))
            {
                String uri = InternalSink.GetURI(msg);
                throw new RemotingException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Disconnected"), uri));
            }
            return(ident);
        }
Ejemplo n.º 2
0
        internal static ServerIdentity CheckDisconnectedOrCreateWellKnownObject(IMessage msg)
        {
            ServerIdentity serverIdentity = InternalSink.GetServerIdentity(msg);

            if (serverIdentity == null || serverIdentity.IsRemoteDisconnected())
            {
                string uri = InternalSink.GetURI(msg);
                if (uri != null)
                {
                    ServerIdentity serverIdentity2 = RemotingConfigHandler.CreateWellKnownObject(uri);
                    if (serverIdentity2 != null)
                    {
                        serverIdentity = serverIdentity2;
                    }
                }
            }
            if (serverIdentity == null || serverIdentity.IsRemoteDisconnected())
            {
                string uri2 = InternalSink.GetURI(msg);
                throw new RemotingException(Environment.GetResourceString("Remoting_Disconnected", new object[]
                {
                    uri2
                }));
            }
            return(serverIdentity);
        }