[Fix] Don't release locks a second time
This commit is contained in:
parent
81de2b94e4
commit
8e0c2e6412
|
@ -54,7 +54,7 @@ public interface LockHandler {
|
|||
* @throws StrolchLockException
|
||||
* if the lock could not be acquired
|
||||
*/
|
||||
public void lock(Locator locator) throws StrolchLockException;
|
||||
void lock(Locator locator) throws StrolchLockException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -73,7 +73,7 @@ public interface LockHandler {
|
|||
* @throws StrolchLockException
|
||||
* if the unlock failed
|
||||
*/
|
||||
public void unlock(Locator locator) throws StrolchLockException;
|
||||
void unlock(Locator locator) throws StrolchLockException;
|
||||
|
||||
/**
|
||||
* Releases the lock on the element with the given {@link Locator}, by unlocking all locks, i.e. after this method
|
||||
|
@ -85,5 +85,5 @@ public interface LockHandler {
|
|||
* @throws StrolchLockException
|
||||
* if the lock could not be released
|
||||
*/
|
||||
public void releaseLock(Locator locator) throws StrolchLockException;
|
||||
void releaseLock(Locator locator) throws StrolchLockException;
|
||||
}
|
||||
|
|
|
@ -48,17 +48,17 @@ public interface StrolchRealm {
|
|||
*
|
||||
* @return the name of the realm
|
||||
*/
|
||||
public String getRealm();
|
||||
String getRealm();
|
||||
|
||||
/**
|
||||
* Locks the element with the given {@link Locator}
|
||||
*
|
||||
* @param element
|
||||
* @param locator
|
||||
* the locator of the element to lock
|
||||
*
|
||||
* @see LockHandler#lock(Locator)
|
||||
*/
|
||||
public void lock(Locator locator);
|
||||
void lock(Locator locator);
|
||||
|
||||
/**
|
||||
* Unlocks the element with the given {@link Locator} (lock might still be held, if lock counter is used)
|
||||
|
@ -68,7 +68,7 @@ public interface StrolchRealm {
|
|||
*
|
||||
* @see LockHandler#unlock(Locator)
|
||||
*/
|
||||
public void unlock(Locator locator);
|
||||
void unlock(Locator locator);
|
||||
|
||||
/**
|
||||
* Releases the lock for the given element
|
||||
|
@ -78,14 +78,14 @@ public interface StrolchRealm {
|
|||
*
|
||||
* @see LockHandler#releaseLock(Locator)
|
||||
*/
|
||||
public void releaseLock(Locator locator);
|
||||
void releaseLock(Locator locator);
|
||||
|
||||
/**
|
||||
* Returns the {@link DataStoreMode}
|
||||
*
|
||||
* @return the {@link DataStoreMode}
|
||||
*/
|
||||
public DataStoreMode getMode();
|
||||
DataStoreMode getMode();
|
||||
|
||||
/**
|
||||
* Opens a {@link StrolchTransaction} for the given certificate
|
||||
|
@ -97,7 +97,7 @@ public interface StrolchRealm {
|
|||
*
|
||||
* @return the newly created transaction
|
||||
*/
|
||||
public StrolchTransaction openTx(Certificate certificate, Class<?> clazz);
|
||||
StrolchTransaction openTx(Certificate certificate, Class<?> clazz);
|
||||
|
||||
/**
|
||||
* Opens a {@link StrolchTransaction} for the given certificate
|
||||
|
@ -109,35 +109,35 @@ public interface StrolchRealm {
|
|||
*
|
||||
* @return the newly created transaction
|
||||
*/
|
||||
public StrolchTransaction openTx(Certificate certificate, String action);
|
||||
StrolchTransaction openTx(Certificate certificate, String action);
|
||||
|
||||
/**
|
||||
* Returns if the audit trail is enabled for reads
|
||||
*
|
||||
* @return if the audit trail is enabled for reads
|
||||
*/
|
||||
public boolean isAuditTrailEnabledForRead();
|
||||
boolean isAuditTrailEnabledForRead();
|
||||
|
||||
/**
|
||||
* Returns if the audit trail is enabled for modifications
|
||||
*
|
||||
* @return if the audit trail is enabled for modifications
|
||||
*/
|
||||
public boolean isAuditTrailEnabled();
|
||||
boolean isAuditTrailEnabled();
|
||||
|
||||
/**
|
||||
* Returns if observer updates is enabled
|
||||
*
|
||||
* @return if observer updates is enabled
|
||||
*/
|
||||
public boolean isUpdateObservers();
|
||||
boolean isUpdateObservers();
|
||||
|
||||
/**
|
||||
* Returns if versioning is enabled
|
||||
*
|
||||
* @return if versioning is enabled
|
||||
*/
|
||||
public boolean isVersioningEnabled();
|
||||
boolean isVersioningEnabled();
|
||||
|
||||
/**
|
||||
* Returns the {@link ObserverHandler} if observer updates are enabled
|
||||
|
@ -147,5 +147,5 @@ public interface StrolchRealm {
|
|||
* @throws IllegalArgumentException
|
||||
* if observer updates are not enabled
|
||||
*/
|
||||
public ObserverHandler getObserverHandler() throws IllegalArgumentException;
|
||||
ObserverHandler getObserverHandler() throws IllegalArgumentException;
|
||||
}
|
||||
|
|
|
@ -286,8 +286,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
|||
@Override
|
||||
public <T extends StrolchRootElement> void releaseLock(T element) throws StrolchLockException {
|
||||
Locator locator = element.getLocator();
|
||||
this.realm.releaseLock(locator);
|
||||
this.lockedElements.remove(locator);
|
||||
releaseLock(locator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -300,6 +299,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
|||
for (Locator locator : this.lockedElements) {
|
||||
this.realm.releaseLock(locator);
|
||||
}
|
||||
this.lockedElements.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue