static protected HashMap<String, String> secMapMulti = new HashMap<String, String>();
static protected HashMap<String, String> baMapMulti = new HashMap<String, String>();
static protected HashMap<String,PrintWriter> writeAndClientId = new HashMap<String,PrintWriter>();
static String client_id = "";
static PrintWriter pw_eq=null;
static String[] split_str_data;
static int data_length;
public static synchronized void serveAllWriters(String data) {
split_str_data = data.split(",");
data_length = data.indexOf('|');
for (Map.Entry<String, PrintWriter> entry : writeAndClientId.entrySet()) {
pw_eq = entry.getValue();
client_id = entry.getKey();
if (baMapMulti.containsKey(nse_eq_client_id + ":" + split_str_data[0])) {
pw_eq.println(data);
} else {
if (secMapMulti.containsKey(client_id + "-" + split_str_data[0])) {
data = data.substring(0, data_length + 1);
pw_eq.println(data);
}
}
}
}
有时两个 HashMap 都被比较,有时只比较 hashmap 的第一个值,奇怪的是发生了两个 Hashmap 包含需要根据特定条件比较的值。