Skip to content

Commit

Permalink
fine tune InputQueueMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Aug 4, 2017
1 parent 436e2d0 commit 5cca039
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions jpos/src/main/java/org/jpos/transaction/TransactionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public Space getSpace() {
return sp;
}
public Space getInputSpace() {
return iisp;
return isp;
}
public Space getPersistentSpace() {
return psp;
Expand Down Expand Up @@ -993,18 +993,23 @@ public class InputQueueMonitor implements Runnable {
public void run() {
Thread.currentThread().setName (getName()+"-input-queue-monitor");
while (running()) {
while (getOutstandingTransactions() > getMaxSessions() && running()) {
while (getOutstandingTransactions() > getActiveSessions() + threshold && running()) {
ISOUtil.sleep(100L);
}
if (!running())
break;
Object context = isp.in(queue, 1000L);
if (context != null) {
if (!running()) {
isp.out(queue, context); // place it back
break;
try {
Object context = isp.in(queue, 1000L);
if (context != null) {
if (!running()) {
isp.out(queue, context); // place it back
break;
}
iisp.out(queue, context);
}
iisp.out(queue, context);
} catch (SpaceError e) {
getLog().error(e);
ISOUtil.sleep(1000L); // relax on error
}
}
}
Expand Down

0 comments on commit 5cca039

Please sign in to comment.