aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java
diff options
context:
space:
mode:
authorsliard <samuel.liard@gmail.com>2021-04-07 17:28:50 +0200
committersliard <samuel.liard@gmail.com>2021-04-12 16:02:59 +0200
commit78ebc9a64fac6231e3e594200b9335a4c6372ed1 (patch)
tree4e48966a35f6cceaac4c00b705e640830e34c634 /src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java
parent8a00d4324ea7621df1a1febb8936df2807cbc443 (diff)
First sonar issues review
Issue-ID: DMAAP-1585 Change-Id: I5dc4d3d4cab75f5fabcc8d4f351eac4d3ea50d17 Signed-off-by: sliard <samuel.liard@gmail.com>
Diffstat (limited to 'src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java')
-rw-r--r--src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java b/src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java
index 2e514b0..f7341ec 100644
--- a/src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java
+++ b/src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumerWithReturnResponse.java
@@ -45,6 +45,9 @@ public class SimpleExampleConsumerWithReturnResponse {
long count = 0;
long nextReport = 5000;
+ // remove while true and limite execution time in seconds
+ int timeMax = 86400; // one day
+ long endDate = System.currentTimeMillis() + timeMax*1000;
final long startMs = System.currentTimeMillis ();
@@ -60,7 +63,7 @@ public class SimpleExampleConsumerWithReturnResponse {
routeReader= new FileReader(new File (routeFilePath));
props= new Properties();
final MRConsumer cc = MRClientFactory.createConsumer ( "src/main/resources/dme2/consumer.properties" );
- while ( true )
+ while ( System.currentTimeMillis() < endDate )
{
MRConsumerResponse mrConsumerResponse = cc.fetchWithReturnConsumerResponse();
System.out.println("mrConsumerResponse code :"+mrConsumerResponse.getResponseCode());