19d39a02c3beb12b685591ccdd4dc10353e30be8
[mono.git] / mcs / class / corlib / System.Runtime.Remoting / ObjectHandle.cs
1 //
2 // System.Runtime.Remoting.ObjectHandle.cs
3 //
4 // Authors:
5 //   Dietmar Maurer (dietmar@ximian.com)
6 //   Gonzalo Paniagua (gonzalo@ximian.com)
7 //   Jaime Anguiano Olarra (jaime@gnome.org)
8 //
9 // (C) Ximian, Inc.  http://www.ximian.com
10 //
11 //
12
13 using System;
14 using System.Runtime.Serialization;
15 using System.Runtime.Remoting.Lifetime;
16
17 namespace System.Runtime.Remoting {
18
19         public class ObjectHandle : MarshalByRefObject, IObjectHandle {
20                 private object _wrapped;
21                 private object life_ctrl;
22                 
23                 public ObjectHandle (object o)
24                 {
25                         _wrapped = o;
26                 }
27
28                 [MonoTODO]
29                 public override object InitializeLifetimeService ()
30                 {
31                         life_ctrl = base.InitializeLifetimeService ();
32                         ILease ilife_ctrl = life_ctrl as ILease;
33                         
34                         if (ilife_ctrl != null)
35
36                                 // I can't see in the .NET docs if the lifetime counter
37                                 // must be initialized to the time the object is created
38                                 // or if a relativistic time is enough (as both differ in
39                                 // fact just in a constant. In the meantime I'll use 0.
40                         
41                                 ilife_ctrl.InitialLeaseTime = new TimeSpan ((long) 0);
42                         
43                         return ilife_ctrl;
44                 }
45
46                 public object Unwrap ()
47                 {
48                         return _wrapped;
49                 }
50
51         }
52 }