// (C) 2002, Lluis Sanchez Gual
//
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting.Contexts;
// and also to store server side information (information
// about how to dispatch messages to the object in the server).
- protected Type _objectType;
-
// URI of the object
protected string _objectUri;
// The ObjRef
protected ObjRef _objRef;
+
+ // This flag is set when the identity is removed from the uri table.
+ // It is needed because in some scenarios the runtime may try to
+ // dispose the identity twice.
+ bool _disposed = false;
- public Identity(string objectUri, Type objectType)
+ public Identity(string objectUri)
{
_objectUri = objectUri;
- _objectType = objectType;
}
public abstract ObjRef CreateObjRef (Type requestedType);
get { return _envoySink; }
}
- public Type ObjectType
- {
- get { return _objectType; }
- }
-
public string ObjectUri
{
get { return _objectUri; }
{
get { return _objectUri != null; }
}
+
+ public bool Disposed
+ {
+ get { return _disposed; }
+ set { _disposed = value; }
+ }
public DynamicPropertyCollection ClientDynamicProperties
{
internal class ClientIdentity : Identity
{
- MarshalByRefObject _proxyObject;
+ WeakReference _proxyReference;
- public ClientIdentity (string objectUri, ObjRef objRef): base (objectUri, Type.GetType (objRef.TypeInfo.TypeName,true))
+ public ClientIdentity (string objectUri, ObjRef objRef): base (objectUri)
{
_objRef = objRef;
_envoySink = (_objRef.EnvoyInfo != null) ? _objRef.EnvoyInfo.EnvoySinks : null;
public MarshalByRefObject ClientProxy
{
- get { return _proxyObject; }
- set { _proxyObject = value; }
- }
+ get { return (MarshalByRefObject) _proxyReference.Target; }
+ set { _proxyReference = new WeakReference (value); }
+ }
public override ObjRef CreateObjRef (Type requestedType)
{