com.agimatec.dbmigrate.util
Class BusyLocker

java.lang.Object
  extended by com.agimatec.dbmigrate.util.BusyLocker

public class BusyLocker
extends Object

Description: Implements the behavior to prevent dbmigrate to execute more than once at the same time on the same database
It INSERTs a "busy" version into the database and DELETEs it afterwards.

Date: 14.10.14

Since:
2.5.19

Field Summary
protected  String BUSY_VERSION
           
protected static org.slf4j.Logger log
           
protected  boolean ownLock
           
 
Constructor Summary
BusyLocker()
           
 
Method Summary
 int getDelayBetweenAttempts()
           
 int getMaxAttempts()
           
 boolean isEnabled(DBVersionMeta dbVersionMeta)
           
 boolean isOwnLock()
           
 void lockBusy(DBVersionMeta dbVersionMeta, JdbcDatabase database)
           
 void setDelayBetweenAttempts(int delayBetweenAttempts)
           
 void setMaxAttempts(int maxAttempts)
           
 void setOwnLock(boolean ownLock)
           
 void unlockBusy(DBVersionMeta dbVersionMeta, JdbcDatabase database)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUSY_VERSION

protected final String BUSY_VERSION
See Also:
Constant Field Values

log

protected static final org.slf4j.Logger log

ownLock

protected boolean ownLock
Constructor Detail

BusyLocker

public BusyLocker()
Method Detail

getMaxAttempts

public int getMaxAttempts()

setMaxAttempts

public void setMaxAttempts(int maxAttempts)

getDelayBetweenAttempts

public int getDelayBetweenAttempts()

setDelayBetweenAttempts

public void setDelayBetweenAttempts(int delayBetweenAttempts)

isEnabled

public boolean isEnabled(DBVersionMeta dbVersionMeta)

lockBusy

public void lockBusy(DBVersionMeta dbVersionMeta,
                     JdbcDatabase database)

isOwnLock

public boolean isOwnLock()

setOwnLock

public void setOwnLock(boolean ownLock)

unlockBusy

public void unlockBusy(DBVersionMeta dbVersionMeta,
                       JdbcDatabase database)


Copyright © 2008-2014. All Rights Reserved.