Novell.Directory.Ldap.Message.Abandon C# (CSharp) Méthode

Abandon() private méthode

private Abandon ( LdapConstraints cons, InterThreadException informUserEx ) : void
cons LdapConstraints
informUserEx InterThreadException
Résultat void
        internal virtual void Abandon(LdapConstraints cons, InterThreadException informUserEx)
        {
            if (!waitForReply_Renamed_Field)
            {
                return ;
            }
            acceptReplies = false; // don't listen to anyone
            waitForReply_Renamed_Field = false; // don't let sleeping threads lie
            if (!complete)
            {
                try
                {
                    // If a bind, release bind semaphore & wake up waiting threads
                    // Must do before writing abandon message, otherwise deadlock
                    if (bindprops != null)
                    {
                        int id;
                        if (conn.BindSemIdClear)
                        {
                            // Semaphore id for normal operations
                            id = msgId;
                        }
                        else
                        {
                            // Semaphore id for sasl bind
                            id = conn.BindSemId;
                            conn.clearBindSemId();
                        }
                        conn.freeWriteSemaphore(id);
                    }

                    // Create the abandon message, but don't track it.
                    LdapControl[] cont = null;
                    if (cons != null)
                    {
                        cont = cons.getControls();
                    }
                    LdapMessage msg = new LdapAbandonRequest(msgId, cont);
                    // Send abandon message to server
                    conn.writeMessage(msg);
                }
                catch (LdapException ex)
                {
                    ; // do nothing
                }
                // If not informing user, remove message from agent
                if (informUserEx == null)
                {
                    agent.Abandon(msgId, null);
                }
                conn.removeMessage(this);
            }
            // Get rid of all replies queued
            if (informUserEx != null)
            {
                replies.Add(new LdapResponse(informUserEx, conn.ActiveReferral));
                stopTimer();
                // wake up waiting threads to receive exception
                sleepersAwake();
                // Message will get cleaned up when last response removed from queue
            }
            else
            {
                // Wake up any waiting threads, so they can terminate.
                // If informing the user, we wake sleepers after
                // caller queues dummy response with error status
                sleepersAwake();
                cleanup();
            }
            return ;
        }

Usage Example

Exemple #1
0
 /// <summary> The timeout thread.  If it wakes from the sleep, future input
 /// is stopped and the request is timed out.
 /// </summary>
 override public void Run()
 {
     try
     {
         Thread.Sleep(new TimeSpan(10000 * timeToWait));
         message.acceptReplies = false;
         // Note: Abandon clears the bind semaphore after failed bind.
         message.Abandon(null, new InterThreadException("Client request timed out", null, LdapException.Ldap_TIMEOUT, null, message));
     }
     catch (ThreadInterruptedException)
     {
         // the timer was stopped, do nothing
     }
 }
All Usage Examples Of Novell.Directory.Ldap.Message::Abandon