Commit ca5102da authored by afreyssin's avatar afreyssin
Browse files

Minor fixes.

parent 3e6c0789
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2004 - 2008 ScalAgent Distributed Technologies
* Copyright (C) 2004 - 2014 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
......@@ -65,15 +65,16 @@ public class ClusterAdmin {
ictx.rebind("clusterCF", clusterCF);
Properties prop = new Properties();
prop.setProperty("period","100");
prop.setProperty("producThreshold","1000");
prop.setProperty("consumThreshold","5");
prop.setProperty("period","5000");
prop.setProperty("producThreshold","150");
prop.setProperty("consumThreshold","1");
prop.setProperty("autoEvalThreshold","false");
prop.setProperty("waitAfterClusterReq","10000");
prop.setProperty("waitAfterClusterReq","5000");
prop.setProperty("maxFwdPerQueue", "1000");
Queue queue0 = Queue.create(0, null, Queue.CLUSTER_QUEUE, prop);
Queue queue1 = Queue.create(1, null, Queue.CLUSTER_QUEUE, prop);
Queue queue2 = Queue.create(2, null, Queue.CLUSTER_QUEUE, prop);
Queue queue0 = Queue.create(0, "queue", Queue.CLUSTER_QUEUE, prop);
Queue queue1 = Queue.create(1, "queue", Queue.CLUSTER_QUEUE, prop);
Queue queue2 = Queue.create(2, "queue", Queue.CLUSTER_QUEUE, prop);
System.out.println("queue0 = " + queue0);
System.out.println("queue1 = " + queue1);
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2004 - 2012 ScalAgent Distributed Technologies
* Copyright (C) 2004 - 2014 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
......@@ -55,8 +55,8 @@ public class MsgListener implements MessageListener {
public MsgListener(String ident) {
this.ident = ident;
int sleep = Integer.getInteger("sleep", 10).intValue();
int nbMsgSleep = Integer.getInteger("nbMsgSleep", 10).intValue();
sleep = Integer.getInteger("sleep", 10).intValue();
nbMsgSleep = Integer.getInteger("nbMsgSleep", 10).intValue();
System.out.println("sleep = " + sleep + ", nbMsgSleep=" + nbMsgSleep);
stats = new Hashtable<String, Counter>();
}
......@@ -64,9 +64,9 @@ public class MsgListener implements MessageListener {
public void onMessage(Message msg) {
try {
nbMsg++;
if (nbMsg == 1)
startTime = System.currentTimeMillis();
long time = System.currentTimeMillis();
if (nbMsg == 1)
startTime = time;
time = time - startTime;
String location = (String) msg.getStringProperty("location");
......@@ -79,12 +79,20 @@ public class MsgListener implements MessageListener {
counter.inc();
}
if (sleep > 0 && (nbMsg % nbMsgSleep) == 0) {
try {
Thread.sleep(sleep);
} catch (InterruptedException e) {}
}
if ((nbMsg % 100) == 99) {
System.out.println("time = " + time + " nbMsg=" + nbMsg);
StringBuffer strbuf = new StringBuffer();
strbuf.append(ident).append(": time = ").append(time).append(" nbMsg=").append(nbMsg);
for (Enumeration<String> e = stats.keys(); e.hasMoreElements();) {
String key = e.nextElement();
System.out.println(key + " -> "+ stats.get(key).get());
strbuf.append(key).append("->").append(stats.get(key).get()).append(',');
}
System.out.println(strbuf.toString());
}
} catch (JMSException jE) {
System.err.println("Exception in listener: " + jE);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment