diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-10-10 10:08:33 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-10-10 10:08:33 +0000 |
commit | fa8a887f6a31d119661d57aca42a98139ec7a792 (patch) | |
tree | 631f72692487e996927900b1cbdd357db892c085 | |
parent | 520f2a4ee9ae69a06e5355028f5d62ee173cd484 (diff) | |
download | mocca-fa8a887f6a31d119661d57aca42a98139ec7a792.tar.gz mocca-fa8a887f6a31d119661d57aca42a98139ec7a792.tar.bz2 mocca-fa8a887f6a31d119661d57aca42a98139ec7a792.zip |
request consume on response delivery
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@100 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r-- | BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java | 44 |
1 files changed, 29 insertions, 15 deletions
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<RequestType> reqs = new ArrayList<RequestType>(); - reqs.addAll(requests); - requests.clear(); - return reqs; +// log.trace("consume request"); +// List<RequestType> reqs = new ArrayList<RequestType>(); +// 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<RequestType> reqs = new ArrayList<RequestType>(); // 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<RequestType> reqs = new ArrayList<RequestType>(); // 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()); |