EclipseStore 2.1 is Out: New Locking API Handles Concurrency

Markus Kett

EclipseStore 2.1. comes with a very significant improvement: The new version introduces a new Locking API we have added to the Eclipse Serializer project, which is the core of EclipseStore. The new API introduces locking functionality, enabling developers to manage concurrent access to the object graph. While EclipseStore excelled in speed, simplicity, and data storage cost efficiency, a long-standing challenge remained from the perspective of many developers: concurrency control, because EclipseStore, initially, relied solely on Java’s concurrency features. Java offers a wide range of concepts for concurrency control such as Synchronized Blocks, Reentrant Locks, and more but, managing concurrency effectively can be a complex and error-prone endeavor. With EclipseStores` new locking API, this is now easy.

Reentrant Locks as Basis

The new locking API is based on the robust and granular concept of Reentrant Locks to ensure thread safety and data consistency. Using Reentrant Locks avoid common concurrency pitfalls like deadlocks and race conditions. This simplifies managing concurrent access to the object graph, making it more accessible to a wider range of developers.

Simplified Concurrency Control

With the new locking API, developers can now handle concurrency in EclipseStore with a level of simplicity that rivals traditional database systems. The API provides intuitive mechanisms to define read and write operations, ensuring that concurrent access to shared data is managed efficiently. This makes it easier to build reliable and scalable applications using EclipseStore.

From Java Complexity to Database-like Transactions

The introduction of the locking API in Eclipse Serializer represents a major turning point for EclipseStore. Developers can now handle concurrency with a similar approach to writing transactions for database systems. This significantly simplifies development and reduces the risk of concurrency errors.

1. Using LockedExecutor

public class Customers { 
 private final transient LockedExecutor executor = LockedExecutor.New();
 private final List<Customer> customers = new ArrayList<>();

 public void addCustomer(Customer c) {
   executor.write(() -> {
     this.customers.add(c);
     Application.storageManager().store(this.customers); // Assuming storageManager is thread-safe
   });
 }

 public void traverseCustomers(Consumer<Customer> consumer) {
   executor.read(() -> this.customers.forEach(consumer));
 }
}
  • LockedExecutor provides a write lock for critical sections.
  • Keep Application.storageManager().store(…) calls in locked section as well.

2. LockedScope:

public class Customers extends LockScope {
  private final List<Customer> customers = new ArrayList<>();

  public void addCustomer(Customer c) {
    write(() -> {
      customers.add(c);
      Application.storageManager().store(customers); // Assuming storageManager is thread-safe
    });
  }

  public void traverseCustomers(Consumer<Customer> consumer) {
    read(() -> customers.forEach(consumer)); // Lock only for read operation if necessary
  }
}
  • LockScope holds a LockedExecutor internally and provides delegate methods for reads and writes.
  • Similar to the LockedExecutor approach, we can use write for adding customers and storing them.

EclipseStore: Unlocking ACID Compliance for Business-Critical Applications

EclipseStore is more and more a favorite among developers seeking high-performance data storage and retrieval solutions. Its reputation for raw speed and efficient data structures has made it a go-to choice for applications demanding rapid access and search capabilities.

With the introduction of the powerful new Locking API, EclipseStore offers full ACID compliance, ensuring data integrity and consistency. This significant advancement positions EclipseStore alongside traditional database systems in terms of transaction safety and reliability.

This milestone paves the way for EclipseStore to enter industries like banking, finance, and healthcare, where robust data security and performance are paramount. By simplifying concurrency control and guaranteeing ACID compliance, EclipseStore has gained the trust of developers and organizations worldwide.

Like EclipseStore, Eclipse Serializer is also an Eclipse open-source project that is available as a standalone library. By combining blazing-fast performance with robust ACID compliance, Eclipsestore offers the best of both worlds.

Are you already using EclipseStore?
What are you using EclipseStore for?

What is your experience with concurrency in Java?
Are you missing certain features?

Click “View Comments”
below and leave a comment.
Thank you!

Changelog:
https://docs.eclipsestore.io/manual/intro/changelog.html#_2_1_0

Code on GitHub:
https://github.com/eclipse-store/store/releases/tag/2.1.0

Get Started Today:
https://docs.eclipsestore.io/manual/storage/getting-started.html

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

MicroStream Enterprise Edition Open-Beta is Available

Related Posts
Secured By miniOrange