Skip to content

Commit

Permalink
easy access factory methods from Java
Browse files Browse the repository at this point in the history
  • Loading branch information
himadieievsv committed Jan 6, 2024
1 parent 8f44130 commit 9805771
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface LockFactory {
* @param retryCount [Int] the number of retries.
* @return [SimpleLock] the lock instance.
*/
@JvmStatic
fun createSimpleLock(
client: UnifiedJedis,
retryDelay: Duration = 100.milliseconds,
Expand All @@ -41,6 +42,7 @@ interface LockFactory {
* @param scope [CoroutineScope] the coroutine scope to use for lock.
* @return [RedLock] the lock instance.
*/
@JvmStatic
fun createRedLock(
clients: List<UnifiedJedis>,
retryDelay: Duration = 100.milliseconds,
Expand All @@ -60,6 +62,7 @@ interface LockFactory {
* @param scope [CoroutineScope] the coroutine scope to use for lock.
* @return [Semaphore] the lock instance.
*/
@JvmStatic
fun createSemaphore(
clients: List<UnifiedJedis>,
maxLeases: Int,
Expand All @@ -81,6 +84,7 @@ interface LockFactory {
* @param retryDelay [Duration] the delay between retries.
* @return [ListeningCountDownLatch] the latch instance.
*/
@JvmStatic
fun createCountDownLatch(
clients: List<UnifiedJedis>,
name: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface LockFactory {
* @param retryCount [Int] the number of retries.
* @return [SimpleLock] the lock instance.
*/
@JvmStatic
fun createSimpleLock(
client: LettucePooled<String, String>,
retryDelay: Duration = 100.milliseconds,
Expand All @@ -42,6 +43,7 @@ interface LockFactory {
* @param scope [CoroutineScope] the coroutine scope to use for lock.
* @return [RedLock] the lock instance.
*/
@JvmStatic
fun createRedLock(
clients: List<LettucePooled<String, String>>,
retryDelay: Duration = 100.milliseconds,
Expand All @@ -61,6 +63,7 @@ interface LockFactory {
* @param scope [CoroutineScope] the coroutine scope to use for lock.
* @return [Semaphore] the lock instance.
*/
@JvmStatic
fun createSemaphore(
clients: List<LettucePooled<String, String>>,
maxLeases: Int,
Expand All @@ -82,6 +85,7 @@ interface LockFactory {
* @param retryDelay [Duration] the delay between retries.
* @return [ListeningCountDownLatch] the latch instance.
*/
@JvmStatic
fun createCountDownLatch(
clients: List<LettucePubSubPooled<String, String>>,
name: String,
Expand Down

0 comments on commit 9805771

Please sign in to comment.