-
Notifications
You must be signed in to change notification settings - Fork 0
Home
EasyLock is an implementation based on Netty, which aims to provide an easy approach to access the shared resources. EasyLock consists of a client and a server, where the client sends lock and unlock requests to server, and the server responds to the requests to achieve access control for shared resources.
The core of EasyLock is to resolve the lock and unlock requests at server on condition that key is recommended when clients are trying to acquire a lock resource, which indicates the name of lock resources. Different keys maps different lock resources even for the same client. Therefore, I strongly recommend that when acquiring a lock resource, a meaningful key should be offered, which can inspire people what you are going to do with that lock resource.
Server of EasyLock resolves the lock and unlock requests using ConcurrentHashMap<String, Request>, where the String maps the key and Request represents the lock request which is holding this lock resource, where there exists some useful informations, like application name of client, thread name representing the thread holding the lock resource and so on. When the server receives huge amount of lock and unlock requests, each request will be resolved be a thread in a thread pool, imitating the lock operation from clients at server. In other words, parallel operations process parallel, and there is no guarantee to lock as the same order in which requests arrive at server.
EasyLock consists of four modules, which are
- easylock-client is the client, sending lock and unlock requests to server and waiting corresponding responses.
- easylock-common is the common module for both easylock-client and easylock-server.
- easylock-server is the server to resolve lock and unlock requests and send corresponding responses to clients.
- easylock-spring-boot-starter is a starer for Spring Boot application, providing auto-configuration for clients.