This commit is contained in:
lyr90329 2014-08-13 17:56:39 +08:00
parent 4727c2dd9f
commit 4f1b963fcf
2 changed files with 23 additions and 12 deletions

View File

@ -10,6 +10,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.PropertyConfigurator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.w3c.dom.Document;
@ -90,8 +91,14 @@ public class WebServerMain {
}
}
}
public static void main(String[] args) {
for (int i =0; i< 10; i++){
WebServerMain.run(args);
}
}
public static void run(String[] args) {
PropertyConfigurator.configure(System.getProperty("user.dir")
+ "/bin/log4j.properties");// ¼ÓÔØ.propertiesÎļþ
initConfig();
@ -138,7 +145,7 @@ public class WebServerMain {
}
}
System.out.println(webSession.results.length());
try {
System.out.println(webSession.results.get(0));
} catch (JSONException e1) {
@ -146,21 +153,25 @@ public class WebServerMain {
}
webSession.getInstance().stats();
while (webSession.stats.size() != 4){
while (webSession.stats.size() != 4 || webSession.results.length() < 3000){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
try {
JSONObject jStats = new JSONObject(webSession.stats.get(1));
System.out.println(jStats);
System.out.println(jStats.get("cmd_get"));
System.out.println(jStats.get("cmd_set"));
} catch (JSONException e) {
e.printStackTrace();
}
System.out.println(webSession.results.length());
// try {
// JSONObject jStats = new JSONObject(webSession.stats.get(2));
// System.out.println(jStats);
// System.out.println(jStats.get("cmd_get"));
// System.out.println(jStats.get("cmd_set"));
// } catch (JSONException e) {
// e.printStackTrace();
// }
requestServer.stop();
//webSession.session = null;
webSession.results = new JSONArray();
}
// ÁÈ¡memcached clientÅäÖÃ

View File

@ -29,7 +29,7 @@ public class webSession implements Runnable {
ConcurrentLinkedQueue<MessageEvent> recvQueue = new ConcurrentLinkedQueue<MessageEvent>();
Map<Integer, Channel> MemcachedChannelMap = new ConcurrentHashMap<Integer, Channel>();
Map<Integer, Channel> RequestChannelMap = new ConcurrentHashMap<Integer, Channel>();
static webSession session = null;
public static webSession session = null;
public Channel curChannel;
public long totalTime = 0;