Skip to content

Commit b30c57c

Browse files
committed
Rename CustomTtlLock to DistributedLock
Remove `CustomTtlLockRegistry`
1 parent ab861ba commit b30c57c

File tree

22 files changed

+61
-95
lines changed

22 files changed

+61
-95
lines changed

spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
130130

131131
private boolean sequenceAware;
132132

133-
private LockRegistry lockRegistry = new DefaultLockRegistry();
133+
private LockRegistry<?> lockRegistry = new DefaultLockRegistry();
134134

135135
private boolean lockRegistrySet = false;
136136

@@ -193,7 +193,7 @@ public AbstractCorrelatingMessageHandler(MessageGroupProcessor processor) {
193193
this(processor, new SimpleMessageStore(0), null, null);
194194
}
195195

196-
public void setLockRegistry(LockRegistry lockRegistry) {
196+
public void setLockRegistry(LockRegistry<?> lockRegistry) {
197197
Assert.isTrue(!this.lockRegistrySet, "'this.lockRegistry' can not be reset once its been set");
198198
Assert.notNull(lockRegistry, "'lockRegistry' must not be null");
199199
this.lockRegistry = lockRegistry;
@@ -499,7 +499,7 @@ protected boolean isSequenceAware() {
499499
return this.sequenceAware;
500500
}
501501

502-
protected LockRegistry getLockRegistry() {
502+
protected LockRegistry<?> getLockRegistry() {
503503
return this.lockRegistry;
504504
}
505505

spring-integration-core/src/main/java/org/springframework/integration/config/AggregatorFactoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class AggregatorFactoryBean extends AbstractSimpleMessageHandlerFactoryBe
6565

6666
private String outputChannelName;
6767

68-
private LockRegistry lockRegistry;
68+
private LockRegistry<?> lockRegistry;
6969

7070
private MessageGroupStore messageStore;
7171

@@ -122,7 +122,7 @@ public void setOutputChannelName(String outputChannelName) {
122122
this.outputChannelName = outputChannelName;
123123
}
124124

125-
public void setLockRegistry(LockRegistry lockRegistry) {
125+
public void setLockRegistry(LockRegistry<?> lockRegistry) {
126126
this.lockRegistry = lockRegistry;
127127
}
128128

spring-integration-core/src/main/java/org/springframework/integration/dsl/CorrelationHandlerSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2022 the original author or authors.
2+
* Copyright 2016-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -299,7 +299,7 @@ public S forceReleaseAdvice(Advice... advice) {
299299
* @param lockRegistry the {@link LockRegistry} to use.
300300
* @return the endpoint spec.
301301
*/
302-
public S lockRegistry(LockRegistry lockRegistry) {
302+
public S lockRegistry(LockRegistry<?> lockRegistry) {
303303
Assert.notNull(lockRegistry, "'lockRegistry' must not be null.");
304304
this.handler.setLockRegistry(lockRegistry);
305305
return _this();

spring-integration-core/src/main/java/org/springframework/integration/metadata/PropertiesPersistingMetadataStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ public class PropertiesPersistingMetadataStore implements ConcurrentMetadataStor
6565

6666
private final DefaultPropertiesPersister persister = new DefaultPropertiesPersister();
6767

68-
private final LockRegistry lockRegistry = new DefaultLockRegistry();
68+
private final LockRegistry<Lock> lockRegistry = new DefaultLockRegistry();
6969

7070
private String baseDirectory = System.getProperty("java.io.tmpdir") + "/spring-integration/";
7171

spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageStore.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class SimpleMessageStore extends AbstractMessageGroupStore
7171

7272
private final long upperBoundTimeout;
7373

74-
private LockRegistry lockRegistry;
74+
private LockRegistry<?> lockRegistry;
7575

7676
private boolean copyOnGet = false;
7777

@@ -111,7 +111,7 @@ public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperB
111111
* @param lockRegistry The lock registry.
112112
* @see #SimpleMessageStore(int, int, long, LockRegistry)
113113
*/
114-
public SimpleMessageStore(int individualCapacity, int groupCapacity, LockRegistry lockRegistry) {
114+
public SimpleMessageStore(int individualCapacity, int groupCapacity, LockRegistry<?> lockRegistry) {
115115
this(individualCapacity, groupCapacity, 0, lockRegistry);
116116
}
117117

@@ -126,7 +126,7 @@ public SimpleMessageStore(int individualCapacity, int groupCapacity, LockRegistr
126126
* @since 4.3
127127
*/
128128
public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperBoundTimeout,
129-
LockRegistry lockRegistry) {
129+
LockRegistry<?> lockRegistry) {
130130

131131
super(false);
132132
Assert.notNull(lockRegistry, "The LockRegistry cannot be null");
@@ -162,7 +162,7 @@ public void setCopyOnGet(boolean copyOnGet) {
162162
this.copyOnGet = copyOnGet;
163163
}
164164

165-
public void setLockRegistry(LockRegistry lockRegistry) {
165+
public void setLockRegistry(LockRegistry<?> lockRegistry) {
166166
Assert.notNull(lockRegistry, "The LockRegistry cannot be null");
167167
Assert.isTrue(!(this.isUsed), "Cannot change the lock registry after the store has been used");
168168
this.lockRegistry = lockRegistry;

spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class LockRegistryLeaderInitiator implements SmartLifecycle, DisposableBe
7474
* A lock registry. The locks it manages should be global (whatever that means for the
7575
* system) and expiring, in case the holder dies without notifying anyone.
7676
*/
77-
private final LockRegistry locks;
77+
private final LockRegistry<?> locks;
7878

7979
/**
8080
* Candidate for leader election. User injects this to receive callbacks on leadership
@@ -162,7 +162,7 @@ public String getRole() {
162162
* candidate (which just logs the leadership events).
163163
* @param locks lock registry
164164
*/
165-
public LockRegistryLeaderInitiator(LockRegistry locks) {
165+
public LockRegistryLeaderInitiator(LockRegistry<?> locks) {
166166
this(locks, new DefaultCandidate());
167167
}
168168

@@ -172,7 +172,7 @@ public LockRegistryLeaderInitiator(LockRegistry locks) {
172172
* @param locks lock registry
173173
* @param candidate leadership election candidate
174174
*/
175-
public LockRegistryLeaderInitiator(LockRegistry locks, Candidate candidate) {
175+
public LockRegistryLeaderInitiator(LockRegistry<?> locks, Candidate candidate) {
176176
Assert.notNull(locks, "'locks' must not be null");
177177
Assert.notNull(candidate, "'candidate' must not be null");
178178
this.locks = locks;

spring-integration-core/src/main/java/org/springframework/integration/support/locks/CustomTtlLockRegistry.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

spring-integration-core/src/main/java/org/springframework/integration/support/locks/DefaultLockRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @since 2.1.1
3535
*
3636
*/
37-
public final class DefaultLockRegistry implements LockRegistry {
37+
public final class DefaultLockRegistry implements LockRegistry<Lock> {
3838

3939
private final Lock[] lockTable;
4040

spring-integration-core/src/main/java/org/springframework/integration/support/locks/CustomTtlLock.java renamed to spring-integration-core/src/main/java/org/springframework/integration/support/locks/DistributedLock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
import java.util.concurrent.locks.Lock;
2121

2222
/**
23-
* A {@link Lock} implementing this interface supports the spring distributed locks with custom time-to-live value per lock
23+
* A {@link Lock} implementing for spring distributed locks
2424
*
2525
* @author Eddie Cho
2626
*
2727
* @since 6.3
2828
*/
29-
public interface CustomTtlLock extends Lock {
29+
public interface DistributedLock extends Lock {
3030

3131
/**
3232
* Attempt to acquire a lock with a specific time-to-live

spring-integration-core/src/main/java/org/springframework/integration/support/locks/ExpirableLockRegistry.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2019 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,15 +16,18 @@
1616

1717
package org.springframework.integration.support.locks;
1818

19+
import java.util.concurrent.locks.Lock;
20+
1921
/**
2022
* A {@link LockRegistry} implementing this interface supports the removal of aged locks
2123
* that are not currently locked.
24+
* @param <L> The expected class of the lock implementation
2225
*
2326
* @author Gary Russell
2427
* @since 4.2
2528
*
2629
*/
27-
public interface ExpirableLockRegistry extends LockRegistry {
30+
public interface ExpirableLockRegistry<L extends Lock> extends LockRegistry<L> {
2831

2932
/**
3033
* Remove locks last acquired more than 'age' ago that are not currently locked.

0 commit comments

Comments
 (0)