code: @Override
      public boolean remove(Object o) {
  
          for (;;) {
              final long head = this.head.sum();
              // we are optimistically advancing the head by one
              // if the object does not exist we have to put it back
              if (headCursor.compareAndSet(head, head + 1)) {
                  for (;;) {
                      final long tail = this.tail.sum();
                      if (tailCursor.compareAndSet(tail, tail + 1)) {
                          // number removed
                          int n = 0;
  
                          // just blocked access to the entire queue - go for it
                          for (int i = 0; i < size(); i++) {
                              final int slot = (int) ((this.head.sum() + i) & mask);
                              if (buffer[slot] != null && buffer[slot].equals(o)) {
                                  n++;
  
                                  for (int j = i; j > 0; j--) {
                                      final int cSlot = (int) ((this.head.sum() + j - 1) & mask);
                                      final int nextSlot = (int) ((this.head.sum() + j) & mask);
                                      // overwrite ith element with previous
                                      buffer[nextSlot] = buffer[cSlot];
                                  }
                              }
                          }
  
                          if (n > 0) {
                              // head is advanced once for each
                              headCursor.set(head + n);
  
                              // undo the change to tail state - this was only
                              // done to block others from changing
                              tailCursor.set(tail);
                              // tail is unchanged
                              this.head.add(n);
  
  
                              // queue is not full now
                              queueNotFullCondition.signal();
                              return true;
  
  
                          } else {
                              // no change to the queue - unblock others
                              tailCursor.set(tail);
                              headCursor.set(head);
                              return false;
                          }
                      }
                  }
              }
          }
      }
docs: <p>
  Provided for compatibility with the BlockingQueue interface only.
  </p>
  This interface has been fixed to be properly concurrent, but will
  block the entire queue, it should not be used!