GithubHelp home page GithubHelp logo

randomanderson / weak-lock-free Goto Github PK

View Code? Open in Web Editor NEW

This project forked from raphw/weak-lock-free

0.0 0.0 0.0 67 KB

Implementation of a concurrent map with weak keys and a detached thread local storage.

License: Apache License 2.0

Java 100.00%

weak-lock-free's Introduction

This is a miniature implementation of a concurrent, lock-free (as in lock-less) hash map with weak keys where keys respect reference equality. Such a hash map removes entries containing collected keys by either:

  1. Inline removal (entries that contain to collected keys are removed as a result of interaction with the map).
  2. Implicit concurrent removal (entries that contain collected keys are removed by an external thread).
  3. Explicit concurrent removal (explicit interaction with the map's reference queue).

As a wrapper around this WeakConcurrentMap, this package also contains a DetachedThreadLocal which describes a weak concurrent map where the current thread serves as a key of the map. Also, this package delivers a WeakConcurrentSet as a wrapper around a weak concurrent map.

This map does not implement the java.util.Map interface to simplify the implementation. Writes to the map might cause blocking if many threads write to the map concurrently (this is implied by the maps backing by a ConcurrentHashMap and a ReferenceQueue), the performance of the map is however significantly better than using a synchronized wrapper around a concurrent hash map.

The library is hosted on Maven Central and JCenter:

<dependency>
  <groupId>com.blogspot.mydailyjava</groupId>
  <artifactId>weak-lock-free</artifactId>
  <version>LATEST</version>
</dependency>

weak-lock-free's People

Contributors

codingfabian avatar felixbarny avatar funcguy avatar randomanderson avatar raphw avatar

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.