RemoveNotificationThread() private method

private RemoveNotificationThread ( ) : void
return void
示例#1
0
        /// <summary>
        /// Releases the connection to the database.  If the connection is pooled, it will be
        ///	made available for re-use.  If it is non-pooled, the actual connection will be shutdown.
        /// </summary>
        public override void Close()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");

            if (connector != null)
            {
                Promotable.Prepare();
                // clear the way for another promotable transaction
                promotable = null;

                connector.Notification -= NotificationDelegate;
                connector.Notice       -= NoticeDelegate;
                connector.StateChanged -= connector_StateChanged;

                if (SyncNotification)
                {
                    connector.RemoveNotificationThread();
                }

                if (Pooling)
                {
                    NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);
                }
                else
                {
                    Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                    Connector.CertificateSelectionCallback      -= CertificateSelectionCallbackDelegate;
                    Connector.CertificateValidationCallback     -= CertificateValidationCallbackDelegate;
                    Connector.PrivateKeySelectionCallback       -= PrivateKeySelectionCallbackDelegate;

                    if (Connector.Transaction != null)
                    {
                        Connector.Transaction.Cancel();
                    }

                    Connector.Close();
                }


                connector = null;

                this.OnStateChange(new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
            }
        }
示例#2
0
        private void ReallyClose()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "ReallyClose");
            _postponingClose = false;

            // clear the way for another promotable transaction
            promotable = null;

            connector.Notification -= NotificationDelegate;
            connector.Notice       -= NoticeDelegate;

            if (SyncNotification)
            {
                connector.RemoveNotificationThread();
            }

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);
            }
            else
            {
                Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                Connector.CertificateSelectionCallback      -= CertificateSelectionCallbackDelegate;
                Connector.CertificateValidationCallback     -= CertificateValidationCallbackDelegate;
                Connector.PrivateKeySelectionCallback       -= PrivateKeySelectionCallbackDelegate;

                if (Connector.Transaction != null)
                {
                    Connector.Transaction.Cancel();
                }

                Connector.Close();
            }

            connector = null;
        }
        /// <summary>
        /// Releases the connection to the database.  If the connection is pooled, it will be
        ///	made available for re-use.  If it is non-pooled, the actual connection will be shutdown.
        /// </summary>
        public override void Close()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");

            if (connector != null)
            {
                Promotable.Prepare();
                // clear the way for another promotable transaction
                promotable = null;

                connector.Notification -= NotificationDelegate;
                connector.Notice       -= NoticeDelegate;

                if (SyncNotification)
                {
                    connector.RemoveNotificationThread();
                }

                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);


                connector = null;
            }
        }
示例#4
0
        /// <summary>
        /// Releases the connection to the database.  If the connection is pooled, it will be
        ///	made available for re-use.  If it is non-pooled, the actual connection will be shutdown.
        /// </summary>
        public void Close()
        {
            if (!disposed)
            {
                NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");

                if (connector != null)
                {
                    connector.Notification -= NotificationDelegate;
                    connector.Notice       -= NoticeDelegate;

                    if (SyncNotification)
                    {
                        connector.RemoveNotificationThread();
                    }

                    NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);



                    connector = null;
                }
            }
        }