src/share/classes/com/sun/jndi/ldap/LdapRequest.java

Print this page
rev 10430 : imported patch typos


  45     LdapRequest(int msgId, boolean pause) {
  46         this(msgId, pause, -1);
  47     }
  48 
  49     LdapRequest(int msgId, boolean pause, int replyQueueCapacity) {
  50         this.msgId = msgId;
  51         this.pauseAfterReceipt = pause;
  52         if (replyQueueCapacity == -1) {
  53             this.replies = new LinkedBlockingQueue<BerDecoder>();
  54         } else {
  55             this.replies =
  56                 new LinkedBlockingQueue<BerDecoder>(replyQueueCapacity);
  57             highWatermark = (replyQueueCapacity * 80) / 100; // 80% capacity
  58         }
  59     }
  60 
  61     synchronized void cancel() {
  62         cancelled = true;
  63 
  64         // Unblock reader of pending request
  65         // Should only ever have atmost one waiter
  66         notify();
  67     }
  68 
  69     synchronized boolean addReplyBer(BerDecoder ber) {
  70         if (cancelled) {
  71             return false;
  72         }
  73 
  74         // Add a new reply to the queue of unprocessed replies.
  75         try {
  76             replies.put(ber);
  77         } catch (InterruptedException e) {
  78             // ignore
  79         }
  80 
  81         // peek at the BER buffer to check if it is a SearchResultDone PDU
  82         try {
  83             ber.parseSeq(null);
  84             ber.parseInt();
  85             completed = (ber.peekByte() == LdapClient.LDAP_REP_RESULT);




  45     LdapRequest(int msgId, boolean pause) {
  46         this(msgId, pause, -1);
  47     }
  48 
  49     LdapRequest(int msgId, boolean pause, int replyQueueCapacity) {
  50         this.msgId = msgId;
  51         this.pauseAfterReceipt = pause;
  52         if (replyQueueCapacity == -1) {
  53             this.replies = new LinkedBlockingQueue<BerDecoder>();
  54         } else {
  55             this.replies =
  56                 new LinkedBlockingQueue<BerDecoder>(replyQueueCapacity);
  57             highWatermark = (replyQueueCapacity * 80) / 100; // 80% capacity
  58         }
  59     }
  60 
  61     synchronized void cancel() {
  62         cancelled = true;
  63 
  64         // Unblock reader of pending request
  65         // Should only ever have at most one waiter
  66         notify();
  67     }
  68 
  69     synchronized boolean addReplyBer(BerDecoder ber) {
  70         if (cancelled) {
  71             return false;
  72         }
  73 
  74         // Add a new reply to the queue of unprocessed replies.
  75         try {
  76             replies.put(ber);
  77         } catch (InterruptedException e) {
  78             // ignore
  79         }
  80 
  81         // peek at the BER buffer to check if it is a SearchResultDone PDU
  82         try {
  83             ber.parseSeq(null);
  84             ber.parseInt();
  85             completed = (ber.peekByte() == LdapClient.LDAP_REP_RESULT);