From fa8a887f6a31d119661d57aca42a98139ec7a792 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 10 Oct 2008 10:08:33 +0000 Subject: request consume on response delivery git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@100 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../stal/service/impl/STALRequestBrokerImpl.java | 44 ++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'BKUOnline/src/main/java/at') diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java index 074aff2d..03c7c601 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -190,12 +190,14 @@ public class STALRequestBrokerImpl implements STALRequestBroker { return Collections.singletonList((RequestType) new QuitRequestType()); } } - log.trace("consume request"); - List reqs = new ArrayList(); - reqs.addAll(requests); - requests.clear(); - return reqs; +// log.trace("consume request"); +// List reqs = new ArrayList(); +// reqs.addAll(requests); +// requests.clear(); +// return reqs; + log.trace("don't consume request now, leave for further connect calls"); + return requests; } } catch (InterruptedException ex) { log.warn("interrupt in nextRequest(): " + ex.getMessage()); @@ -221,6 +223,16 @@ public class STALRequestBrokerImpl implements STALRequestBroker { return null; } try { + synchronized (requests) { + log.trace("received responses, now consume request"); + if (requests.size() != 0) { + requests.clear(); + } else { + log.warn("requests queue is empty, response might have already been produced previously "); + // return QUIT? + } + } + synchronized (responses) { //respMon) { if (resps != null && resps.size() > 0) { // if (!expectingResponse) { @@ -274,16 +286,18 @@ public class STALRequestBrokerImpl implements STALRequestBroker { return Collections.singletonList((RequestType) new QuitRequestType()); } } - log.trace("consume request"); - List reqs = new ArrayList(); // reqMon.consume(); - reqs.addAll(requests); - -// if (requests.size() > 0 && requests.get(0) instanceof QuitRequestType) { -// log.trace("expecting no response in next nextRequest()"); -// expectingResponse = false; -// } - requests.clear(); - return reqs; +// log.trace("consume request"); +// List reqs = new ArrayList(); // reqMon.consume(); +// reqs.addAll(requests); +// +//// if (requests.size() > 0 && requests.get(0) instanceof QuitRequestType) { +//// log.trace("expecting no response in next nextRequest()"); +//// expectingResponse = false; +//// } +// requests.clear(); +// return reqs; + log.trace("don't consume request now, but on next response delivery"); + return requests; } } catch (InterruptedException ex) { log.warn("interrupt in nextRequest(): " + ex.getMessage()); -- cgit v1.2.3