dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Runtime/Remoting/Cont


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Runtime/Remoting/Contexts SynchronizationAttribute.cs, 1.2, 1.3
Date: Thu, 11 Sep 2003 21:01:07 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Remoting/Contexts
In directory 
subversions:/tmp/cvs-serv15202/runtime/System/Runtime/Remoting/Contexts

Modified Files:
        SynchronizationAttribute.cs 
Log Message:


Missing functionality in "System.Runtime.Remoting".


Index: SynchronizationAttribute.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Remoting/Contexts/SynchronizationAttribute.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SynchronizationAttribute.cs 23 Apr 2003 05:39:49 -0000      1.2
--- SynchronizationAttribute.cs 12 Sep 2003 01:01:05 -0000      1.3
***************
*** 38,41 ****
--- 38,42 ----
        private bool reEntrant;
        private bool locked;
+       private Object savedProp;
  
        // Public flag values.
***************
*** 86,120 ****
  
        // Create a client context sink and prepend it to a given chain.
-       [TODO]
        public virtual IMessageSink GetClientContextSink(IMessageSink nextSink)
                        {
!                               // TODO
!                               return null;
                        }
  
        // Get the properties for a new construction context.
-       [TODO]
        public override void GetPropertiesForNewContext
                                (IConstructionCallMessage ctorMsg)
                        {
!                               // TODO
                        }
  
        // Get the server context sink.
-       [TODO]
        public virtual IMessageSink GetServerContextSink(IMessageSink nextSink)
                        {
!                               // TODO
!                               return null;
                        }
  
        // Determine if a context is OK with respect to this attribute.
-       [TODO]
        public override bool IsContextOK
                                (Context ctx, IConstructionCallMessage msg)
                        {
!                               // TODO
                                return false;
                        }
  
  }; // class SynchronizationAttribute
--- 87,194 ----
  
        // Create a client context sink and prepend it to a given chain.
        public virtual IMessageSink GetClientContextSink(IMessageSink nextSink)
                        {
!                               return new PassThroughSink(this, nextSink);
                        }
  
        // Get the properties for a new construction context.
        public override void GetPropertiesForNewContext
                                (IConstructionCallMessage ctorMsg)
                        {
!                               if(ctorMsg != null)
!                               {
!                                       if(flag == REQUIRED)
!                                       {
!                                               if(savedProp != null)
!                                               {
!                                                       
ctorMsg.ContextProperties.Add(savedProp);
!                                               }
!                                               else
!                                               {
!                                                       
ctorMsg.ContextProperties.Add(this);
!                                               }
!                                       }
!                                       else if(flag == REQUIRES_NEW)
!                                       {
!                                               
ctorMsg.ContextProperties.Add(this);
!                                       }
!                               }
                        }
  
        // Get the server context sink.
        public virtual IMessageSink GetServerContextSink(IMessageSink nextSink)
                        {
!                               return new PassThroughSink(this, nextSink);
                        }
  
        // Determine if a context is OK with respect to this attribute.
        public override bool IsContextOK
                                (Context ctx, IConstructionCallMessage msg)
                        {
!                               if(ctx == null)
!                               {
!                                       throw new ArgumentNullException("ctx");
!                               }
!                               if(msg == null)
!                               {
!                                       throw new ArgumentNullException("msg");
!                               }
!                               if(flag == NOT_SUPPORTED)
!                               {
!                                       if(ctx.GetProperty("Synchronization") 
!= null)
!                                       {
!                                               return false;
!                                       }
!                               }
!                               else if(flag == REQUIRED)
!                               {
!                                       Object prop = 
ctx.GetProperty("Synchronization");
!                                       if(prop == null)
!                                       {
!                                               return false;
!                                       }
!                                       savedProp = prop;
!                               }
!                               else if(flag != REQUIRES_NEW)
!                               {
!                                       return true;
!                               }
                                return false;
                        }
+ 
+       // Pass-through sink.
+       private class PassThroughSink : IMessageSink
+       {
+               // Internal state.
+               private SynchronizationAttribute attr;
+               private IMessageSink nextSink;
+ 
+               // Constructor.
+               public PassThroughSink
+                                       (SynchronizationAttribute attr, 
IMessageSink nextSink)
+                               {
+                                       this.attr = attr;
+                                       this.nextSink = nextSink;
+                               }
+ 
+               // Implement the IMessageSink interface.
+               public IMessageSink NextSink
+                               {
+                                       get
+                                       {
+                                               return nextSink;
+                                       }
+                               }
+               public IMessageCtrl AsyncProcessMessage
+                                               (IMessage msg, IMessageSink 
replySink)
+                               {
+                                       return 
nextSink.AsyncProcessMessage(msg, replySink);
+                               }
+               public IMessage SyncProcessMessage(IMessage msg)
+                               {
+                                       return nextSink.SyncProcessMessage(msg);
+                               }
+ 
+       }; // class PassThroughSink
  
  }; // class SynchronizationAttribute





reply via email to

[Prev in Thread] Current Thread [Next in Thread]