Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ClusterLockContext #34118

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,25 @@

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.lock.LockContext;
import org.apache.shardingsphere.infra.lock.LockDefinition;
import org.apache.shardingsphere.mode.lock.LockPersistService;
import org.apache.shardingsphere.mode.lock.global.GlobalLockDefinition;

/**
* Cluster global lock context.
* Cluster lock context.
*/
@RequiredArgsConstructor
public final class ClusterLockContext implements LockContext<GlobalLockDefinition> {
public final class ClusterLockContext implements LockContext<LockDefinition> {

private final LockPersistService<GlobalLockDefinition> globalLockPersistService;

@Override
public boolean tryLock(final GlobalLockDefinition lockDefinition, final long timeoutMillis) {
return globalLockPersistService.tryLock(lockDefinition, timeoutMillis);
public boolean tryLock(final LockDefinition lockDefinition, final long timeoutMillis) {
return globalLockPersistService.tryLock((GlobalLockDefinition) lockDefinition, timeoutMillis);
}

@Override
public void unlock(final GlobalLockDefinition lockDefinition) {
globalLockPersistService.unlock(lockDefinition);
public void unlock(final LockDefinition lockDefinition) {
globalLockPersistService.unlock((GlobalLockDefinition) lockDefinition);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.shardingsphere.infra.lock.LockDefinition;

/**
* Standalone global lock context.
* Standalone lock context.
*/
public final class StandaloneLockContext implements LockContext<LockDefinition> {

Expand Down
Loading