Skip to content

Commit

Permalink
re-add expiration check
Browse files Browse the repository at this point in the history
  • Loading branch information
firestar committed Jan 28, 2024
1 parent 9a4f92f commit fef3c30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = 'com.nucleodb'
version = '1.15.10'
version = '1.15.11'

repositories {
mavenCentral()
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/com/nucleodb/library/database/lock/LockManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ public void run() {
@Override
public Object put(@NotNull Object key, @NotNull Object value) {
executorPool.schedule(()->{
// LockReference lockReference = (LockReference)this.get(key);
// if(lockReference!=null && value instanceof LockReference && lockReference.getRequest().equals(((LockReference)value).getRequest())) {
// logger.info( "EXPIRED");
// logger.info((String) key);
// try {
// LockReference activeLock = Serializer.getObjectMapper().getOm().readValue(Serializer.getObjectMapper().getOm().writeValueAsString(value), LockReference.class);
// activeLock.setLock(false);
// lockAction(activeLock);
// } catch (JsonProcessingException e) {
// e.printStackTrace();
// }
// }
}, 10000, TimeUnit.MILLISECONDS);
LockReference lockReference = (LockReference)this.get(key);
if(lockReference!=null && value instanceof LockReference && lockReference.getRequest().equals(((LockReference)value).getRequest())) {
logger.info( "EXPIRED");
logger.info((String) key);
try {
LockReference activeLock = Serializer.getObjectMapper().getOm().readValue(Serializer.getObjectMapper().getOm().writeValueAsString(value), LockReference.class);
activeLock.setLock(false);
lockAction(activeLock);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
}, 1000, TimeUnit.MILLISECONDS);
return super.put(key, value);
}
};
Expand Down

0 comments on commit fef3c30

Please sign in to comment.