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

JdbcTemplateLockProvider cannot be instantiated when useDbTime=true and database is not accessible #258

Closed
zholub opened this issue May 31, 2020 · 2 comments

Comments

@zholub
Copy link

zholub commented May 31, 2020

Sometimes database is not accessible when application starts. In a Spring Boot app, HikariCP can handle this and can postpone it's initialization until the database come up.
This behavior is very useful in dynamic environments (eg Kubernetes) or when the application has specific functions which does not depend on database.

ShedLock selects SQL dialect on the basis of DB connection metadata at startup. With 'useDbTime' is set to true, this prevents application startup as LockProvider cannot be instantiated.
If 'useDbTime' is set to false and product name couldn't be determined, it falls back to generic SqlStatementsSource. This could cause different behavior with PostgreSQL as it has specific SqlStatementSource also for dbtime-less mode.

One solution can be to allow explict set of databaseProductName to JdbcTemplateLockProvider.Configuration.Builder
Another is to make SqlStatementsSource selection lazy.

@lukas-krecan
Copy link
Owner

Hi, thanks for feedback. Will make SqlStatementsSource lazy.

@lukas-krecan
Copy link
Owner

Released as 4.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants