Skip to content

Commit 9f43ef5

Browse files
committed
DML operation auto timeout in 60 seconds
1 parent 8a48790 commit 9f43ef5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

bean-manager/src/main/java/com/blobcity/lib/query/QueryType.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ public enum QueryType {
118118
DROP_NODE("DROP-NODE"),
119119

120120
// INTERNAL QUERIES
121-
ROLLBACK("ROLLBACK"),
122-
COMMIT("COMMIT"), //this is a confirmation to commit the soft commit
123-
SOFT_COMMIT_SUCCESS("SOFT_COMMIT_SUCCESS"),
124-
COMMIT_SUCCESS("COMMIT_SUCCESS"),
125-
ROLLBACK_SUCCESS("ROLLBACK_SUCCESS"),
126-
QUERY_RESPONSE("QUERY_RESPONSE"), //response for select / read queries
121+
ROLLBACK("R"),
122+
COMMIT("C"), //this is a confirmation to commit the soft commit
123+
SOFT_COMMIT_SUCCESS("SCS"),
124+
COMMIT_SUCCESS("CS"),
125+
ROLLBACK_SUCCESS("RS"),
126+
QUERY_RESPONSE("QR"), //response for select / read queries
127127
PING("PING"), //ping on on-going commit to check if thigns are still running
128128
MEM_FLUSH("MEM-FLUSH"); //flush a memory table to disk
129129

engine/src/main/java/com/blobcity/db/master/AbstractCommitMaster.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.concurrent.TimeUnit;
3232
import java.util.concurrent.TimeoutException;
3333

34+
import org.apache.mina.util.ConcurrentHashSet;
3435
import org.json.JSONObject;
3536
import org.springframework.context.ApplicationContext;
3637

@@ -42,6 +43,8 @@
4243
*/
4344
public abstract class AbstractCommitMaster implements MasterExecutable {
4445

46+
public static final Set<String> activeQueries = new ConcurrentHashSet<>();
47+
4548
protected final Query query;
4649
protected final ApplicationContext applicationContext;
4750
protected final Semaphore semaphore = new Semaphore(0);
@@ -74,7 +77,7 @@ protected ClusterMessaging clusterMessagingBeanInstance() {
7477

7578
protected void awaitCompletion() {
7679
try {
77-
semaphore.tryAcquire(60, TimeUnit.SECONDS); //waits 60 seconds
80+
semaphore.tryAcquire( 60, TimeUnit.SECONDS); //waits 60 seconds
7881
semaphore.release(); // release the immediately last acquire, as the semaphore is no longer required
7982
} catch (InterruptedException e) {
8083
System.out.println("Insert timed out");

0 commit comments

Comments
 (0)