/// <summary> Abandon the request associated with MsgId /// /// </summary> /// <param name="msgId">the message id to abandon /// /// </param> /// <param name="cons">constraints associated with this request /// </param> /* package */ internal void Abandon(int msgId, LdapConstraints cons) //, boolean informUser) { Message info = null; try { // Send abandon request and remove from connection list info = messages.findMessageById(msgId); SupportClass.VectorRemoveElement(messages, info); // This message is now dead info.Abandon(cons, null); } catch (FieldAccessException ex) { } }
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(); } }