Skip to content

Commit

Permalink
Merge pull request #2785 from Cliftonz/standardLockService_More_Exten…
Browse files Browse the repository at this point in the history
…dable

Change value modifier to make StandardLockService extendable for future extension
  • Loading branch information
nvoxland committed May 25, 2022
2 parents 3a59bd8 + f2f2ef3 commit f0df141
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
import static java.util.ResourceBundle.getBundle;

public class StandardLockService implements LockService {
private static ResourceBundle coreBundle = getBundle("liquibase/i18n/liquibase-core");
protected static final ResourceBundle coreBundle = getBundle("liquibase/i18n/liquibase-core");

protected Database database;

protected boolean hasChangeLogLock;

private Long changeLogLockPollRate;
private Long changeLogLockRecheckTime;
protected Long changeLogLockPollRate;
protected Long changeLogLockRecheckTime;

private Boolean hasDatabaseChangeLogLockTable;
private boolean isDatabaseChangeLogLockTableInitialized;
private ObjectQuotingStrategy quotingStrategy;
private final SecureRandom random = new SecureRandom();
protected Boolean hasDatabaseChangeLogLockTable;
protected boolean isDatabaseChangeLogLockTableInitialized;
protected ObjectQuotingStrategy quotingStrategy;
protected final SecureRandom random = new SecureRandom();


public StandardLockService() {
Expand All @@ -70,7 +70,7 @@ public void setDatabase(Database database) {
this.database = database;
}

public Long getChangeLogLockWaitTime() {
protected Long getChangeLogLockWaitTime() {
if (changeLogLockPollRate != null) {
return changeLogLockPollRate;
}
Expand All @@ -82,7 +82,7 @@ public void setChangeLogLockWaitTime(long changeLogLockWaitTime) {
this.changeLogLockPollRate = changeLogLockWaitTime;
}

public Long getChangeLogLockRecheckTime() {
protected Long getChangeLogLockRecheckTime() {
if (changeLogLockRecheckTime != null) {
return changeLogLockRecheckTime;
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public boolean isDatabaseChangeLogLockTableInitialized(final boolean tableJustCr
* Determine whether the databasechangeloglock table has been initialized.
* @param forceRecheck if true, do not use any cached information, and recheck the actual database
*/
private boolean isDatabaseChangeLogLockTableInitialized(final boolean tableJustCreated, final boolean forceRecheck) {
protected boolean isDatabaseChangeLogLockTableInitialized(final boolean tableJustCreated, final boolean forceRecheck) {
if (!isDatabaseChangeLogLockTableInitialized || forceRecheck) {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);

Expand Down Expand Up @@ -222,7 +222,7 @@ public boolean hasChangeLogLock() {
* Check whether the databasechangeloglock table exists in the database.
* @param forceRecheck if true, do not use any cached information and check the actual database
*/
private boolean hasDatabaseChangeLogLockTable(boolean forceRecheck) {
protected boolean hasDatabaseChangeLogLockTable(boolean forceRecheck) {
if (forceRecheck || hasDatabaseChangeLogLockTable == null) {
try {
hasDatabaseChangeLogLockTable = SnapshotGeneratorFactory.getInstance()
Expand All @@ -234,7 +234,7 @@ private boolean hasDatabaseChangeLogLockTable(boolean forceRecheck) {
return hasDatabaseChangeLogLockTable;
}

public boolean hasDatabaseChangeLogLockTable() throws DatabaseException {
protected boolean hasDatabaseChangeLogLockTable() throws DatabaseException {
return hasDatabaseChangeLogLockTable(false);
}

Expand Down Expand Up @@ -331,6 +331,7 @@ public boolean acquireLock() throws LockException {
try {
database.rollback();
} catch (DatabaseException e) {

}
}

Expand Down

0 comments on commit f0df141

Please sign in to comment.