forked from Ericsson/ecchronos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cassandra based distributed locking mechanism # 741
- Cassandra tables called lock and lock_priority, to manage task execution and synchronization across multiple nodes.
- Loading branch information
sajid riaz
committed
Nov 4, 2024
1 parent
1122325
commit eea5f4d
Showing
27 changed files
with
2,151 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ericsson/bss/cassandra/ecchronos/application/config/lockfactory/CasLockFactoryConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2024 Telefonaktiebolaget LM Ericsson | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.ericsson.bss.cassandra.ecchronos.application.config.lockfactory; | ||
|
||
import com.ericsson.bss.cassandra.ecchronos.core.impl.utils.ConsistencyType; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Locale; | ||
|
||
public class CasLockFactoryConfig | ||
{ | ||
private static final long DEFAULT_EXPIRY_TIME_IN_SECONDS = 30L; | ||
private static final String DEFAULT_KEYSPACE_NAME = "ecchronos"; | ||
private String myKeyspaceName = DEFAULT_KEYSPACE_NAME; | ||
private long myExpiryTimeInSeconds = DEFAULT_EXPIRY_TIME_IN_SECONDS; | ||
private ConsistencyType myConsistencySerial = ConsistencyType.DEFAULT; | ||
|
||
public final long getFailureCacheExpiryTimeInSeconds() | ||
{ | ||
return myExpiryTimeInSeconds; | ||
} | ||
|
||
@JsonProperty ("cache_expiry_time_in_seconds") | ||
public final void setFailureCacheExpiryTimeInSeconds(final long expiryTimeInSeconds) | ||
{ | ||
myExpiryTimeInSeconds = expiryTimeInSeconds; | ||
} | ||
|
||
public final String getKeyspaceName() | ||
{ | ||
return myKeyspaceName; | ||
} | ||
|
||
@JsonProperty ("keyspace") | ||
public final void setKeyspaceName(final String keyspaceName) | ||
{ | ||
myKeyspaceName = keyspaceName; | ||
} | ||
|
||
@JsonProperty ("consistencySerial") | ||
public final ConsistencyType getConsistencySerial() | ||
{ | ||
return myConsistencySerial; | ||
} | ||
|
||
@JsonProperty ("consistencySerial") | ||
public final void setConsistencySerial(final String consistencySerial) | ||
{ | ||
myConsistencySerial = ConsistencyType.valueOf(consistencySerial.toUpperCase(Locale.US)); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...om/ericsson/bss/cassandra/ecchronos/application/config/lockfactory/LockFactoryConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2024 Telefonaktiebolaget LM Ericsson | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.ericsson.bss.cassandra.ecchronos.application.config.lockfactory; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class LockFactoryConfig | ||
{ | ||
private CasLockFactoryConfig myCasLockFactoryConfig = new CasLockFactoryConfig(); | ||
|
||
@JsonProperty("cas") | ||
public final CasLockFactoryConfig getCasLockFactoryConfig() | ||
{ | ||
return myCasLockFactoryConfig; | ||
} | ||
|
||
@JsonProperty("cas") | ||
public final void setCasLockFactoryConfig(final CasLockFactoryConfig casLockFactoryConfig) | ||
{ | ||
myCasLockFactoryConfig = casLockFactoryConfig; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ava/com/ericsson/bss/cassandra/ecchronos/application/config/lockfactory/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright 2024 Telefonaktiebolaget LM Ericsson | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Contains configurations related to lock factory. | ||
*/ | ||
package com.ericsson.bss.cassandra.ecchronos.application.config.lockfactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.