File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
pramen/core/src/main/scala/za/co/absa/pramen/core/lock Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,12 @@ abstract class TokenLockBase(override val token: String) extends TokenLock {
100100 if (wasAcquired) {
101101 watcherThreadOpt.foreach(_.interrupt())
102102 watcherThreadOpt = None
103- releaseGuardLock()
104- JvmUtils .safeRemoveShutdownHook(shutdownHook)
105- TokenLockRegistry .unregisterLock(this )
103+ try {
104+ releaseGuardLock()
105+ } finally {
106+ JvmUtils .safeRemoveShutdownHook(shutdownHook)
107+ TokenLockRegistry .unregisterLock(this )
108+ }
106109 log.info(s " Lock released: ' $escapedToken'. " )
107110 }
108111 }
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ object TokenLockRegistry {
5656 try {
5757 l.release()
5858 } catch {
59- case NonFatal (ex) => log.warn(s " Unable to release the lock: ${l.token}" )
59+ case NonFatal (ex) => log.warn(s " Unable to release the lock: ${l.token}" , ex )
6060 }
6161 }
6262 currentLocks.clear()
You can’t perform that action at this time.
0 commit comments