示例#1
0
        internal static NativeTypes.FABRIC_CONTAINER_EVENT_TYPE ToNativeContainerEventType(
            ContainerEventType eventType)
        {
            switch (eventType)
            {
            case ContainerEventType.None:
                return(NativeTypes.FABRIC_CONTAINER_EVENT_TYPE.FABRIC_CONTAINER_EVENT_TYPE_NONE);

            case ContainerEventType.Stop:
                return(NativeTypes.FABRIC_CONTAINER_EVENT_TYPE.FABRIC_CONTAINER_EVENT_TYPE_STOP);

            case ContainerEventType.Die:
                return(NativeTypes.FABRIC_CONTAINER_EVENT_TYPE.FABRIC_CONTAINER_EVENT_TYPE_DIE);

            case ContainerEventType.Health:
                return(NativeTypes.FABRIC_CONTAINER_EVENT_TYPE.FABRIC_CONTAINER_EVENT_TYPE_HEALTH);

            default:
                var errorMessage = string.Format(
                    CultureInfo.CurrentCulture,
                    StringResources.Error_EnumInvalid_Formatted,
                    eventType,
                    "ContainerEventType");

                AppTrace.TraceSource.WriteError(
                    TraceComponent,
                    "InteropHelpers.ToNativeContainerEventType(): " + errorMessage,
                    eventType);

                throw new ArgumentException(errorMessage);
            }
        }
示例#2
0
 public ContainerExitEvent(ContainerId cID, ContainerEventType eventType, int exitCode
                           , string diagnosticInfo)
     : base(cID, eventType)
 {
     this.exitCode       = exitCode;
     this.diagnosticInfo = diagnosticInfo;
 }
示例#3
0
 public void OnContainerEventRaised(ContainerEventType eType, Effect cEffect)
 {
     if (null != ContainerEventRaised)
     {
         (new Logger()).WriteDebug4("shared:container:event:" + eType.ToString() + ":before [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
         try
         {
             ContainerEventRaised(eType, cEffect);
         }
         catch (System.Net.Sockets.SocketException)
         {
             (new Logger()).WriteDebug4("shared:container:client:lost:dispose:before [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
             Stop();
             Dispose();
             (new Logger()).WriteDebug4("shared:container:client:lost:dispose:after [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
         }
         catch (Exception ex)
         {
             (new Logger()).WriteError(ex);
         }
         (new Logger()).WriteDebug4("shared:container:event:" + eType.ToString() + ":after [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
     }
     else
     {
         (new Logger()).WriteDebug4("shared:container:event:" + eType.ToString() + ":empty [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
     }
 }
示例#4
0
        private void InvokeContainerEvents(ContainerEventType containerEventType)
        {
            SharedList <ContainerEventListener> list = ((NaiveLockingList <ContainerEventListener>)DotNetNukeContext.Current.ContainerEventListeners).SharedList;

            using (list.GetReadLock())
            {
                foreach (var listener in list.Where(x => x.EventType == containerEventType))
                {
                    listener.ContainerEvent.Invoke(this, new ContainerEventArgs(this));
                }
            }
        }
示例#5
0
 public ContainerEventListener(ContainerEventType type, ContainerEventHandler e)
 {
     _Type           = type;
     _ContainerEvent = e;
 }
示例#6
0
        private void InvokeContainerEvents(ContainerEventType containerEventType)
        {
            SharedList<ContainerEventListener> list = ((NaiveLockingList<ContainerEventListener>)DotNetNukeContext.Current.ContainerEventListeners).SharedList;

            using (list.GetReadLock())
            {
                foreach (var listener in list.Where(x => x.EventType == containerEventType))
                {
                    listener.ContainerEvent.Invoke(this, new ContainerEventArgs(this));
                }
            }
        }
示例#7
0
		public void OnContainerEventRaised(ContainerEventType eType, Effect cEffect)
		{
			if (null != ContainerEventRaised)
			{
				(new Logger()).WriteDebug4("shared:container:event:" + eType.ToString() + ":before [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
				try
				{
					ContainerEventRaised(eType, cEffect);
				}
				catch (System.Net.Sockets.SocketException)
				{
					(new Logger()).WriteDebug4("shared:container:client:lost:dispose:before [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
					Stop();
					Dispose();
					(new Logger()).WriteDebug4("shared:container:client:lost:dispose:after [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
				}
				catch (Exception ex)
				{
					(new Logger()).WriteError(ex);
				}
                (new Logger()).WriteDebug4("shared:container:event:" + eType.ToString() + ":after [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
			}
			else
				(new Logger()).WriteDebug4("shared:container:event:" + eType.ToString() + ":empty [effect hc:" + cEffect.GetHashCode() + "][container hc:" + GetHashCode() + "]");
		}
示例#8
0
		protected abstract void ContainerCallbackTransport(ContainerEventType eType, shared.Effect cEffect);
示例#9
0
		public void ContainerCallback(ContainerEventType eType, shared.Effect cEffect)
		{
			ContainerCallbackTransport(eType, cEffect);
		}
 public ContainerEventMatcher(ContainerId idRef, ContainerEventType type)
 {
     this.idRef = idRef;
     this.type  = type;
 }
示例#11
0
 protected abstract void ContainerCallbackTransport(ContainerEventType eType, shared.Effect cEffect);
示例#12
0
 public void ContainerCallback(ContainerEventType eType, shared.Effect cEffect)
 {
     ContainerCallbackTransport(eType, cEffect);
 }
 public ContainerEventListener(ContainerEventType type, ContainerEventHandler e)
 {
     _Type = type;
     _ContainerEvent = e;
 }
示例#14
0
 public ContainerResourceEvent(ContainerId container, ContainerEventType type, LocalResourceRequest
                               rsrc)
     : base(container, type)
 {
     this.rsrc = rsrc;
 }