public void Hide(CloseReason reason)
 {
     Dispose();
     OnClosingEvent(this, reason);
     Window.Current.Activated -= OnWindowActivated;//stop listening to app activation
     Canvas.SetLeft(flyoutPopup, Window.Current.Bounds.Width);//move it out of the screen
 }
Example #2
0
        void socketServer_SessionClosed(WebSocketSession session, CloseReason reason)
        {
            if (reason == CloseReason.ServerShutdown)
                return;

            SendToAll("System: " + session.Cookies["name"] + " disconnected");
        }
Example #3
0
 void secureSocketServer_SessionClosed(WebSocketSession session, CloseReason reason)
 {
     lock (m_SecureSessionSyncRoot)
     {
         m_SecureSessions.Remove(session);
     }
 }
Example #4
0
 protected void RiseOnCloseRequired(CloseReason reason)
 {
     if (OnCloseRequired != null)
     {
         OnCloseRequired(this, new CloseEventArgs(reason));
     }
 }
Example #5
0
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
 async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
 {
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
		public async Task CloseAsync(PartitionContext context, CloseReason reason)
		{
			_log.InfoEvent("Close",
				new Facet("reason", reason),
				new Facet("partitionId", context.Lease.PartitionId),
				new Facet("offset", context.Lease.Offset));
		}
Example #8
0
        static void appServer_SessionClosed(WebSocketSession session, CloseReason closeRs)
        {
            session.Close();
            Console.WriteLine("客户端" + session.RemoteEndPoint.Port + "断开了连接!");
            ClientNum -= 1;

            Console.WriteLine("客户端数目" + ClientNum.ToString());
        }
Example #9
0
 /// <summary>
 /// Called when [close].
 /// </summary>
 protected virtual void OnClose(CloseReason reason)
 {
     var closedHandler = Closed;
     if (closedHandler != null)
     {
         closedHandler(this, reason);
     }
 }
        /// <summary>
        /// Closes the event processor partition.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="reason">The reason.</param>
        public Task CloseAsync(PartitionContext context, CloseReason reason)
        {
            Logger.Information("Stopping partition {Partition} processing. Reason: {Reason}", context.Lease.PartitionId, reason);
            _targetBlock.Complete();
            _statLogger.Dispose();

            return Task.FromResult(true);
        }
Example #11
0
        //------------------------------------------------------------------------------------------------------------------------
        #endregion

        #region Functions
        //------------------------------------------------------------------------------------------------------------------------
        async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
        {
            DebugEx.TraceLog("Processor Shutting Down. Partition :" + context.Lease.PartitionId + ", Reason: " + reason);
            if (reason == CloseReason.Shutdown)
            {
                await context.CheckpointAsync();
            }
        }
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     if (reason == CloseReason.Shutdown)
     {
         Clients.All.showMessageOnClient("XClose");
         await context.CheckpointAsync();
     }
 }
 public Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     if (reason == CloseReason.Shutdown)
     {
         return context.CheckpointAsync();
     }
     return Task.FromResult(false);
 }
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine(string.Format("Processor Shuting Down.  Partition '{0}', Reason: '{1}'.", context.Lease.PartitionId, reason.ToString()));
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine("Shutting Down Event Processor");
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
 async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine("Processor Shutting Down. Partition '{0}', Reason: '{1}'.", context.Lease.PartitionId, reason);
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Trace.TraceInformation(string.Format("EventProcessor Shuting Down.  Partition '{0}', Reason: '{1}'.", this.partitionContext.Lease.PartitionId, reason.ToString()));
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
Example #18
0
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine($"Processor Shutting Down. Partition '{context.Lease.PartitionId}', Reason: '{reason}'.");
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
Example #19
0
 public PluginCloseInfo(CloseReason reason)
     : this()
 {
     if (reason == CloseReason.None)
     {
         throw new ArgumentException("None is not a valid CloseReason");
     }
     FormReason = reason;
 }
        public Task CloseAsync(PartitionContext context, CloseReason reason)
        {
            Trace.TraceInformation("Processor Shuting Down.  Partition '{0}', Reason: '{1}'.", this.Context.Lease.PartitionId, reason.ToString());

            this.IsClosed = true;
            this.OnProcessorClosed();

            return context.CheckpointAsync();
        }
Example #21
0
 public override void Close(CloseReason reason)
 {
     try
     {
         this.stream.Close();
         this.socket.Close();
     }
     catch { }
     CallOnClosed(reason);
 }
Example #22
0
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Trace.TraceWarning("SimpleEventProcessor CloseAsync.  Partition '{0}', Reason: '{1}'.",
         this.partitionContext.Lease.PartitionId, reason.ToString());
     _run = false;
     if (reason == CloseReason.Shutdown)
     {
         await context.CheckpointAsync();
     }
 }
Example #23
0
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     if (sqlConnection != null)
         sqlConnection.Close();
     if (!WebJobsHelper.RunAsWebJobs)
         Console.WriteLine(string.Format("Processor Shuting Down. Partition '{0}', Reason: '{1}'.",
             partitionContext.Lease.PartitionId, reason.ToString()));
     if (reason == CloseReason.Shutdown)
         await context.CheckpointAsync();
 }
Example #24
0
        public void socketServer_SessionClosed(WebSocketSession session, CloseReason reason)
        {
            lock (m_SessionSyncRoot)
                m_Sessions.Remove(session);

            if (reason == CloseReason.ServerShutdown)
                return;
            Console.WriteLine(session.ToString()+"connect disposed");
            //SendToAll("System: " + session.Cookies["name"] + " disconnected");
        }
Example #25
0
 public PluginCloseInfo(CloseReason reason)
 {
     if (reason == CloseReason.None)
     {
         throw new ArgumentException("None is not a valid CloseReason");
     }
     FormReason = reason;
     ToolBoxReason = ToolBoxCloseReason.None;
     Cancel = false;
 }
        void socketServer_SessionClosed(WebSocketSession session, CloseReason reason)
        {
            lock (m_SessionSyncRoot)
                m_Sessions.Remove(session);

            Kinesis.gKinesis.StopSkeletonTracker();

            if (reason == CloseReason.ServerShutdown)
                return;
        }
Example #27
0
 public override void Close(CloseReason reason)
 {
     try
     {
         this.connected = false;
         this.tcpClient.Close();
     }
     catch { }
     CallOnClosed(reason);
 }
        async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
        {
            _logger.EventProcessorStopped(reason.ToString(), context.EventHubPath, context.ConsumerGroupName, context.Lease.PartitionId, context.Lease.Offset, context.Lease.Epoch);

            if (reason == CloseReason.Shutdown)
            {
                await context.CheckpointAsync();
                _logger.EventProcessorCheckpointed(context.EventHubPath, context.ConsumerGroupName, context.Lease.PartitionId, context.Lease.Offset, context.Lease.Epoch);
            }
        }
        protected internal override void ConnectionLost(CloseReason reason)
        {
            if (_dataConnectorHandle != null)
            {
                _dataConnectorHandle.Close();

                _dataConnectorHandle = null;
            }

            base.ConnectionLost(reason);
        }
 public Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     WriteLog("{0} > Close called for processor with PartitionId '{1}' and Owner: {2} with reason '{3}'.", DateTime.Now.ToString(), context.Lease.PartitionId, context.Lease.Owner ?? string.Empty, reason);
     if (_checkpointingOn)
     {
         return context.CheckpointAsync();
     }
     else
     {
         return Task.FromResult<object>(null);
     }
 }
Example #31
0
 public CloseArgs(CloseReason reason)
 {
     this.reason = reason;
 }
Example #32
0
 public Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine($"LoggingEventProcessor closing, partition: '{context.PartitionId}', reason: '{reason}'");
     return(Task.CompletedTask);
 }
Example #33
0
 protected override void OnSessionClosed(CloseReason reason)
 {
     base.OnSessionClosed(reason);
 }
Example #34
0
 void NcsServer_UserClosed(T user, CloseReason reason)
 {
     NcsModule <T> .SessionClosed.Invoke(user, reason);
 }
Example #35
0
 public ClusterSessionEncoder CloseReason(CloseReason value)
 {
     _buffer.PutInt(_offset + 32, (int)value, ByteOrder.LittleEndian);
     return(this);
 }
Example #36
0
 protected override void OnSessionClosed(CloseReason reason)
 {
     // 会话关闭后的逻辑代码
     base.OnSessionClosed(reason);
 }
        Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
        {
            Console.WriteLine("Processor Shutting Down. Partition '{0}', Reason: '{1}'.", context.Lease.PartitionId, reason);

            return(Task.FromResult <object>(null));
        }
Example #38
0
 public Task <bool> IsSafeToClose(string elementId, CloseReason closeReason)
 {
     return(Task.FromResult(closeReason == CloseReason.EscapeClosing || elementId != ElementId));
 }
Example #39
0
        public Task Close(CloseReason closeReason)
        {
            ParentBarDropdown?.Hide();

            return(Task.CompletedTask);
        }
Example #40
0
 void SessionClosed(ISocketSession session, CloseReason reason)
 {
     Interlocked.Decrement(ref m_TotalConnections);
 }
Example #41
0
 /// <summary>
 /// Closes the session by the specified reason.
 /// </summary>
 /// <param name="reason">The close reason.</param>
 public virtual void Close(CloseReason reason)
 {
     this.SocketSession.Close(reason);
 }
Example #42
0
 /// <summary>
 /// Called when [session closed].
 /// </summary>
 /// <param name="reason">The reason.</param>
 internal protected virtual void OnSessionClosed(CloseReason reason)
 {
 }
Example #43
0
 /// <summary>
 /// Closes the specified channel.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="reason">The reason.</param>
 public abstract void Close(ICommunicationChannel channel, CloseReason reason);
Example #44
0
 public Task CloseAsync(PartitionContext context, CloseReason reason) => Task.CompletedTask;
Example #45
0
 public async Task CloseAsync(PartitionContext context, CloseReason reason)
 {
 }
 Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
 {
     this.OnClose?.Invoke(this, new Tuple <PartitionContext, CloseReason>(context, reason));
     return(Task.CompletedTask);
 }
 public FormClosedEventArgs(CloseReason closeReason)
 {
     CloseReason = closeReason;
 }
        public async Task CloseAsync(PartitionContext context, CloseReason reason)
        {
            logger.Info("Partition closed", () => new { processorId, context, reason });

            await Task.FromResult(0);
        }
Example #49
0
 public virtual void OnSessionClose(SyncSession session, CloseReason reason)
 {
 }
Example #50
0
 public Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine($"Processor Shutting Down. Partition '{context.PartitionId}', Reason: '{reason}'.");
     return(Task.CompletedTask);
 }
 public Task CloseAsync(PartitionContext context, CloseReason reason)
 {
     Console.WriteLine($"Shutting down processor for partition { context.PartitionId }. " +
                       $"Reason: { reason }");
     return(Task.CompletedTask);
 }
Example #52
0
 /// <summary>
 /// Handles a <see cref="Connection"/> closure, with the given <see cref="CloseReason"/>.
 /// </summary>
 /// <param name="closeReason">The reason for the <see cref="Connection"/> closing.</param>
 protected abstract void CloseHandler(CloseReason closeReason);
Example #53
0
 public NetEventData(SocketType type, NetWorkState state, CloseReason reason) : this(type, state)
 {
     Reason = reason;
 }
        async Task RemoveLeaseAsync(T lease, bool hasOwnership)
        {
            CloseReason reason = hasOwnership ? CloseReason.Shutdown : CloseReason.LeaseLost;

            if (lease != null && this.currentlyOwnedShards != null && this.currentlyOwnedShards.TryRemove(lease.PartitionId, out lease))
            {
                this.settings.Logger.PartitionRemoved(
                    this.accountName,
                    this.taskHub,
                    this.workerName,
                    lease.PartitionId,
                    lease.Token);

                try
                {
                    if (hasOwnership)
                    {
                        this.keepRenewingDuringClose.TryAdd(lease.PartitionId, lease);
                    }

                    // Notify the host that we lost shard so shutdown can be triggered on the host
                    await this.leaseObserverManager.NotifyShardReleasedAsync(lease, reason);
                }
                catch (Exception ex)
                {
                    // Eat any exceptions during notification of observers
                    this.settings.Logger.PartitionManagerError(
                        this.accountName,
                        this.taskHub,
                        this.workerName,
                        lease.PartitionId,
                        $"Encountered exception while notifying observers of {this.leaseType} lease release: {ex}");
                }
                finally
                {
                    if (hasOwnership)
                    {
                        this.keepRenewingDuringClose.TryRemove(lease.PartitionId, out lease);
                    }
                }

                if (hasOwnership)
                {
                    try
                    {
                        await this.leaseManager.ReleaseAsync(lease);

                        this.settings.Logger.LeaseRemoved(
                            this.accountName,
                            this.taskHub,
                            this.workerName,
                            lease.PartitionId,
                            lease.Token);
                    }
                    catch (LeaseLostException)
                    {
                        // We have already shutdown the processor so we can ignore any LeaseLost at this point
                        this.settings.Logger.LeaseRemovalFailed(
                            this.accountName,
                            this.taskHub,
                            this.workerName,
                            lease.PartitionId,
                            lease.Token);
                    }
                    catch (Exception ex)
                    {
                        this.settings.Logger.PartitionManagerError(
                            this.accountName,
                            this.taskHub,
                            this.workerName,
                            lease.PartitionId,
                            $"Encountered failure while releasing owned {this.leaseType}: {ex}");
                    }
                }
            }
        }
Example #55
0
 /// <summary>
 /// 有连接断开
 /// </summary>
 /// <param name="session"></param>
 /// <param name="reason"></param>
 public static void OnSessionClosed(LunarSession session, CloseReason reason)
 {
     loger.Debug("连接断开: " + session.SessionID);
     BaseServerInfo.AllSessions.TryRemove(session.SessionID, out var tt);
 }
Example #56
0
 protected override void OnSessionClosed(CloseReason reason)
 {
     // 会话关闭后的逻辑代码
     Console.WriteLine("close session!");
     base.OnSessionClosed(reason);
 }
Example #57
0
 void MyServer_SessionClosed(MySession session, CloseReason value)
 {
 }
Example #58
0
 public Task <bool> IsSafeToClose(string elementId, CloseReason closeReason)
 {
     return(Task.FromResult(Multiple
         ? closeReason == CloseReason.EscapeClosing || elementId == ElementId || elementId == SelectorElementId || elementId == InputElementId
         : true));
 }
 private static void appServer_SessionClosed(WebSocketSession session, CloseReason reason)
 {
     System.Diagnostics.EventLog appLog = new System.Diagnostics.EventLog();
     appLog.Source = "myService";
     appLog.WriteEntry("session closed. reason:: " + reason);
 }
Example #60
0
 public ClosedEventArgs(System.Net.IPEndPoint iPEndPoint, CloseReason closeReason)
 {
     IPEndPoint  = iPEndPoint;
     CloseReason = closeReason;
 }