* Use logError() to log exceptions for internal, external and XML-RPC requests instead of logEvent().
* Try to handle InterruptedException properly by exiting the main request transactor loop. * No more need to catch Exceptions from Transactor.abort().
This commit is contained in:
parent
2f3f7d665c
commit
afcef645b9
1 changed files with 21 additions and 31 deletions
|
@ -146,8 +146,6 @@ public final class RequestEvaluator implements Runnable {
|
|||
String error = null;
|
||||
|
||||
while (!done && localrtx == rtx) {
|
||||
currentElement = null;
|
||||
|
||||
// catch errors in path resolution and script execution
|
||||
try {
|
||||
|
||||
|
@ -425,9 +423,7 @@ public final class RequestEvaluator implements Runnable {
|
|||
commitTransaction();
|
||||
} catch (Exception x) {
|
||||
abortTransaction();
|
||||
|
||||
app.logEvent("Exception in " + Thread.currentThread() + ": " +
|
||||
x);
|
||||
app.logError(txname + ": " + error, x);
|
||||
|
||||
// If the transactor thread has been killed by the invoker thread we don't have to
|
||||
// bother for the error message, just quit.
|
||||
|
@ -455,9 +451,7 @@ public final class RequestEvaluator implements Runnable {
|
|||
commitTransaction();
|
||||
} catch (Exception x) {
|
||||
abortTransaction();
|
||||
|
||||
app.logEvent("Exception in " + Thread.currentThread() +
|
||||
": " + x);
|
||||
app.logError(txname + ": " + error, x);
|
||||
|
||||
// If the transactor thread has been killed by the invoker thread we don't have to
|
||||
// bother for the error message, just quit.
|
||||
|
@ -487,9 +481,13 @@ public final class RequestEvaluator implements Runnable {
|
|||
try {
|
||||
// wait a bit longer with each try
|
||||
int base = 800 * tries;
|
||||
|
||||
Thread.sleep((long) (base + (Math.random() * base * 2)));
|
||||
} catch (Exception ignore) {
|
||||
} catch (InterruptedException interrupt) {
|
||||
// we got interrrupted, create minimal error message
|
||||
res.writeErrorReport(app.getName(), error);
|
||||
done = true;
|
||||
// and release resources and thread
|
||||
rtx = null;
|
||||
}
|
||||
} else {
|
||||
abortTransaction();
|
||||
|
@ -580,11 +578,7 @@ public final class RequestEvaluator implements Runnable {
|
|||
|
||||
synchronized void abortTransaction() {
|
||||
Transactor localrtx = (Transactor) Thread.currentThread();
|
||||
|
||||
try {
|
||||
localrtx.abort();
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void startTransactor() {
|
||||
|
@ -618,12 +612,15 @@ public final class RequestEvaluator implements Runnable {
|
|||
}
|
||||
|
||||
reqtype = NONE;
|
||||
|
||||
notifyAll();
|
||||
|
||||
try {
|
||||
// wait for request, max 10 min
|
||||
wait(1000 * 60 * 10);
|
||||
} catch (InterruptedException ix) {
|
||||
// we got interrrupted, releases resources and thread
|
||||
rtx = null;
|
||||
}
|
||||
|
||||
// if no request arrived, release ressources and thread
|
||||
if ((reqtype == NONE) && (rtx == localrtx)) {
|
||||
|
@ -633,8 +630,6 @@ public final class RequestEvaluator implements Runnable {
|
|||
// scriptingEngine = null;
|
||||
rtx = null;
|
||||
}
|
||||
} catch (InterruptedException ix) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -659,12 +654,7 @@ public final class RequestEvaluator implements Runnable {
|
|||
reqtype = NONE;
|
||||
|
||||
t.kill();
|
||||
|
||||
try {
|
||||
t.abort();
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
|
||||
t.closeConnections();
|
||||
|
||||
notifyAll();
|
||||
|
|
Loading…
Add table
Reference in a new issue