示例#1
0
 public override void Unregister(object registrationId, TimeSpan timeout)
 {
     if (this.opened)
     {
         UnregisterInfo unregisterInfo = new UnregisterInfo(this.meshId, this.registrationId);
         try
         {
             IPeerResolverClient proxy = this.GetProxy();
             try
             {
                 proxy.OperationTimeout = timeout;
                 proxy.Unregister(unregisterInfo);
                 proxy.Close();
             }
             finally
             {
                 proxy.Abort();
             }
         }
         catch (CommunicationException exception)
         {
             DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
         }
         finally
         {
             this.opened = false;
             this.timer.Cancel();
         }
     }
 }
        public virtual void Unregister(UnregisterInfo unregisterInfo)
        {
            if (unregisterInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo"));
            }
            this.ThrowIfClosed("Unregister");
            if ((!unregisterInfo.HasBody() || string.IsNullOrEmpty(unregisterInfo.MeshId)) || (unregisterInfo.RegistrationId == Guid.Empty))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo }));
            }
            RegistrationEntry entry     = null;
            MeshEntry         meshEntry = this.GetMeshEntry(unregisterInfo.MeshId, false);
            LiteLock          liteLock  = null;

            try
            {
                LiteLock.Acquire(out liteLock, meshEntry.Gate, true);
                if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out entry))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo }));
                }
                meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId);
                meshEntry.EntryList.Remove(entry);
                meshEntry.Service2EntryTable.Remove(entry.Address.ServicePath);
                entry.State = RegistrationState.Deleted;
            }
            finally
            {
                LiteLock.Release(liteLock);
            }
        }
        public void Unregister(UnregisterInfo unregisterInfo)
        {
            var u = unregisterInfo;

            log.WriteLine("REQUEST: Unregister (Mesh: {0}, Registration: {1})", u.MeshId, u.RegistrationId);
            Mesh mesh = GetExistingMesh(u.MeshId);

            lock (mesh) {
                var node = mesh.GetRegisteredNode(u.RegistrationId);
                mesh.Remove(node);
            }
        }
        public virtual void Unregister(UnregisterInfo unregisterInfo)
        {
            if (unregisterInfo == null)
            {
                throw new ArgumentException("Unregister info cannot be null.");
            }

            if (!opened)
            {
                throw new InvalidOperationException("The service has never been opened or it was closed previously.");
            }

            client.Unregister(unregisterInfo);
        }
        public virtual void Unregister(UnregisterInfo unregisterInfo)
        {
            if (unregisterInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", SR.GetString(SR.PeerNullRegistrationInfo));
            }

            ThrowIfClosed("Unregister");

            if (!unregisterInfo.HasBody() || String.IsNullOrEmpty(unregisterInfo.MeshId) || unregisterInfo.RegistrationId == Guid.Empty)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", SR.GetString(SR.PeerInvalidMessageBody, unregisterInfo));
            }

            RegistrationEntry registration = null;
            MeshEntry         meshEntry    = GetMeshEntry(unregisterInfo.MeshId, false);
            //there could be a ---- that two different threads could be working on the same entry
            //we wont optimize for that case.
            LiteLock ll = null;

            try
            {
                LiteLock.Acquire(out ll, meshEntry.Gate, true);
                if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out registration))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", SR.GetString(SR.PeerInvalidMessageBody, unregisterInfo));
                }
                meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId);
                meshEntry.EntryList.Remove(registration);
                meshEntry.Service2EntryTable.Remove(registration.Address.ServicePath);
                registration.State = RegistrationState.Deleted;
            }
            finally
            {
                LiteLock.Release(ll);
            }
        }
 // Unregister address for a node from the resolver service
 public override void Unregister(object registrationId, TimeSpan timeout)
 {
     if (opened)
     {
         UnregisterInfo info = new UnregisterInfo(this.meshId, this.registrationId);
         try
         {
             IPeerResolverClient proxy = GetProxy();
             try
             {
                 proxy.OperationTimeout = timeout;
                 proxy.Unregister(info);
                 proxy.Close();
             }
             finally
             {
                 proxy.Abort();
             }
         }
         catch (CommunicationException e)
         {
             DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
         }
         finally
         {
             opened = false;
             timer.Cancel();
         }
     }
 }
 public virtual new void Unregister(UnregisterInfo unregisterInfo)
 {
 }
示例#8
0
		public override void Unregister (UnregisterInfo unregisterInfo)
		{
			if (ControlShape)
			{
				lock (mesh_lock) {
					if (nodes_count == 1) {
						unique_node = null;
						nodes_count --;
					}
					
					Console.WriteLine ("Unregister");
				}
			}
			else
				base.Unregister (unregisterInfo);
		}
 public virtual new void Unregister(UnregisterInfo unregisterInfo)
 {
 }
        public virtual void Unregister(UnregisterInfo unregisterInfo)
        {
            if (unregisterInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", SR.GetString(SR.PeerNullRegistrationInfo));
            }

            ThrowIfClosed("Unregister");

            if (!unregisterInfo.HasBody() || String.IsNullOrEmpty(unregisterInfo.MeshId) || unregisterInfo.RegistrationId == Guid.Empty)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", SR.GetString(SR.PeerInvalidMessageBody, unregisterInfo));
            }

            RegistrationEntry registration = null;
            MeshEntry meshEntry = GetMeshEntry(unregisterInfo.MeshId, false);
            //there could be a ---- that two different threads could be working on the same entry
            //we wont optimize for that case.
            LiteLock ll = null;
            try
            {
                LiteLock.Acquire(out ll, meshEntry.Gate, true);
                if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out registration))
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", SR.GetString(SR.PeerInvalidMessageBody, unregisterInfo));
                meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId);
                meshEntry.EntryList.Remove(registration);
                meshEntry.Service2EntryTable.Remove(registration.Address.ServicePath);
                registration.State = RegistrationState.Deleted;
            }
            finally
            {
                LiteLock.Release(ll);
            }
        }
 public virtual void Unregister(UnregisterInfo unregisterInfo)
 {
     if (unregisterInfo == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo"));
     }
     this.ThrowIfClosed("Unregister");
     if ((!unregisterInfo.HasBody() || string.IsNullOrEmpty(unregisterInfo.MeshId)) || (unregisterInfo.RegistrationId == Guid.Empty))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo }));
     }
     RegistrationEntry entry = null;
     MeshEntry meshEntry = this.GetMeshEntry(unregisterInfo.MeshId, false);
     LiteLock liteLock = null;
     try
     {
         LiteLock.Acquire(out liteLock, meshEntry.Gate, true);
         if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out entry))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo }));
         }
         meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId);
         meshEntry.EntryList.Remove(entry);
         meshEntry.Service2EntryTable.Remove(entry.Address.ServicePath);
         entry.State = RegistrationState.Deleted;
     }
     finally
     {
         LiteLock.Release(liteLock);
     }
 }
示例#12
0
		public virtual void Unregister (UnregisterInfo unregisterInfo)
		{
			if (unregisterInfo == null)
				throw new ArgumentException ("Unregister info cannot be null.");
			
			if (! opened)
				throw new InvalidOperationException ("The service has never been opened or it was closed previously.");

			client.Unregister (unregisterInfo);
		}