2

I'm trying to mplement custom LockService class like it said in this answer: https://stackoverflow.com/a/15567073/5182320

package liquibase.ext;

import liquibase.exception.DatabaseException;
import liquibase.lockservice.StandardLockService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class TimeoutLockService extends StandardLockService {
    @SneakyThrows
    @Override
    public void waitForLock() {
        forceReleaseLock();
    }

    @Override
    public int getPriority() {
        return super.getPriority() + 1;
    }

    @Override
    public void init() throws DatabaseException {
        super.init();
        log.info("Init called");
    }
}

Placed the class in the package liquibase.ext

But when I'm running my application it's ignoring this class and still trying to acquire the lock.

1 Answers1

2

I was trying to do something similar and I had a similar issue, where my changes were not pickup, even though it was in package liquibase.ext . I am using liquibase 4.3.5 and the following document helped me.

Starting with 4.0, we switched to the standard java.util.ServiceLoader system to find extension classes.

https://docs.liquibase.com/tools-integrations/extensions/extension-upgrade-guides/lb-4.0-upgrade-guide.html

I had to crate the liquibase.lockservice.LockService file in META-INF/services with my implementation and solve the issue.

enter image description here

A Sarkar
  • 181
  • 1
  • 5