Giter Site home page Giter Site logo

concurrent-unique-queue's Introduction

concurrent-unique-queue

A Java concurrent unique queue backed by a Set (LinkedHashSet), for when you need to have a Queue with unique elements. The ConcurrentSetBlockingQueue will behave the same way if the queue is full or if a duplicate entry already exists in the Queue.

Your element needs to have a proper hash and equals implementations !

<dependency>
  <groupId>com.hybhub</groupId>
  <artifactId>concurrent-util</artifactId>
  <version>0.3.0</version>
</dependency>

Usage

#ConcurrentSetBlockingQueue implements BlockingQueue
BlockingQueue<Integer> queue = new ConcurrentSetBlockingQueue<>();

queue.offer(1); # True
queue.offer(2); # True
queue.offer(2); # False

concurrent-unique-queue's People

Contributors

bvanalderweireldt avatar schieck0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

concurrent-unique-queue's Issues

poll() calls spliterator()

ConcurrentSetQueue#poll() contains a call to set.spliterator() whose results is not used, so I suspect it can be removed.

ConcurrentModifications exceptions

Hi,

I'm getting ConcurrentModificationExceptions while attempting to use two threads to put/take from the queue. I do have a question around locking. There are takeLock's and putLock's... But I don't see how the locking preventing the LinkedHashSet from having these concurrent since they put doesn't check takeLock and viceVersa.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.