[NO ISSUE][FAIL] Remove Not Serializable Field From ACIDException
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Remove not serializable ITransactionContext from ACIDException to
avoid serialization error when reporting errors to CC.
- Properly handle InterruptedException in lock manager.
- Remove unneeded WaitInterruptedException class.
Change-Id: Iee054a432b3e618579c3bc418175deab6abfb965
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2559
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ACIDException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ACIDException.java
index 77634eb..9775b45 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ACIDException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ACIDException.java
@@ -18,8 +18,6 @@
*/
package org.apache.asterix.common.exceptions;
-import org.apache.asterix.common.transactions.ITransactionContext;
-
/**
* Represents an exception related to an unexpected behavior that prevents the
* system from supporting ACID guarantees. The exception contains the
@@ -30,25 +28,6 @@
public class ACIDException extends RuntimeException {
private static final long serialVersionUID = -8855848112541877323L;
- private ITransactionContext txnContext;
-
- public ITransactionContext getTxnContext() {
- return txnContext;
- }
-
- public void setTxnContext(ITransactionContext txnContext) {
- this.txnContext = txnContext;
- }
-
- public ACIDException(ITransactionContext txnContext, String message) {
- super(message);
- this.txnContext = txnContext;
- }
-
- public ACIDException(ITransactionContext txnContext, String message, Throwable cause) {
- super(message, cause);
- this.txnContext = txnContext;
- }
public ACIDException(String message, Throwable cause) {
super(message, cause);
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/ConcurrentLockManager.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/ConcurrentLockManager.java
index 726f95c..c91d233 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/ConcurrentLockManager.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/ConcurrentLockManager.java
@@ -146,7 +146,8 @@
}
}
} catch (InterruptedException e) {
- throw new WaitInterruptedException(txnContext, "interrupted", e);
+ Thread.currentThread().interrupt();
+ throw new ACIDException(e);
} finally {
group.releaseLatch();
}
@@ -371,7 +372,8 @@
}
}
} catch (InterruptedException e) {
- throw new WaitInterruptedException(txnContext, "interrupted", e);
+ Thread.currentThread().interrupt();
+ throw new ACIDException(e);
} finally {
if (reqSlot != NILL) {
// deallocate request, if we allocated one earlier
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/WaitInterruptedException.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/WaitInterruptedException.java
deleted file mode 100644
index a4a5ad6..0000000
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/locking/WaitInterruptedException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.transaction.management.service.locking;
-
-import org.apache.asterix.common.exceptions.ACIDException;
-import org.apache.asterix.common.transactions.ITransactionContext;
-
-public class WaitInterruptedException extends ACIDException {
- private static final long serialVersionUID = 1L;
-
- public WaitInterruptedException(ITransactionContext txnContext, String message, Throwable cause) {
- super(txnContext, message, cause);
- }
-}
diff --git a/asterixdb/asterix-transactions/src/test/java/org/apache/asterix/transaction/management/service/locking/LockManagerUnitTest.java b/asterixdb/asterix-transactions/src/test/java/org/apache/asterix/transaction/management/service/locking/LockManagerUnitTest.java
index 817e0f0..0489319 100644
--- a/asterixdb/asterix-transactions/src/test/java/org/apache/asterix/transaction/management/service/locking/LockManagerUnitTest.java
+++ b/asterixdb/asterix-transactions/src/test/java/org/apache/asterix/transaction/management/service/locking/LockManagerUnitTest.java
@@ -31,6 +31,7 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.asterix.common.exceptions.ACIDException;
import org.apache.asterix.common.transactions.DatasetId;
import org.apache.asterix.common.transactions.ILockManager;
import org.apache.asterix.common.transactions.ITransactionContext;
@@ -106,7 +107,7 @@
reqs.add(req(Kind.LOCK, j(2), d(1), e(1), LockMode.X));
reqs.add(req(Kind.PRINT));
reqs.add(req(Kind.INSTANT_LOCK, j(3), d(1), e(1), LockMode.S));
- expectError(execute(reqs), j(3), WaitInterruptedException.class);
+ expectError(execute(reqs), j(3), ACIDException.class);
}
@Test