(empty log message)
@@ -227,6 +227,17 @@ | ||
227 | 227 | pw.close(); |
228 | 228 | Thread.sleep(500); |
229 | 229 | soc.close(); |
230 | + } else if (command.equals("jobstatus")) { | |
231 | + | |
232 | + Map nowStatus = StatusUtil.getNowExecuteMethodNoMap(); | |
233 | + String statusStr = nowStatus.toString(); | |
234 | + pw.println(command + " Success"); | |
235 | + pw.println("Method status = " + statusStr); | |
236 | + pw.flush(); | |
237 | + br.close(); | |
238 | + pw.close(); | |
239 | + Thread.sleep(500); | |
240 | + soc.close(); | |
230 | 241 | } else if (command.equals("-help")) { |
231 | 242 | pw.println(command + " Success"); |
232 | 243 | pw.println(""); |
@@ -240,6 +251,7 @@ | ||
240 | 251 | pw.println("rname"); |
241 | 252 | pw.println("fullgc"); |
242 | 253 | pw.println("netdebug"); |
254 | + pw.println("jobstatus"); | |
243 | 255 | pw.println(""); |
244 | 256 | |
245 | 257 | pw.flush(); |
@@ -108,7 +108,9 @@ | ||
108 | 108 | // 実行メソッドをQueueにレポートする有無 |
109 | 109 | private boolean execMethodReportQueue = false; |
110 | 110 | |
111 | + private boolean newKeyNodeConnectionUse = false; | |
111 | 112 | |
113 | + | |
112 | 114 | /** |
113 | 115 | * Logger.<br> |
114 | 116 | */ |
@@ -191,6 +193,7 @@ | ||
191 | 193 | |
192 | 194 | Socket socket = null; |
193 | 195 | String socketString = null; |
196 | + int executeMethodNo = -1; | |
194 | 197 | |
195 | 198 | try{ |
196 | 199 |
@@ -340,10 +343,15 @@ | ||
340 | 343 | // 本体処理開始 |
341 | 344 | // 処理番号で処理を分岐 |
342 | 345 | // 実行許可も判定 |
343 | - switch (StatusUtil.isExecuteMethod(Integer.parseInt(clientParameterList[0]))) { | |
346 | + executeMethodNo = Integer.parseInt(clientParameterList[0]); | |
344 | 347 | |
348 | + // 実行中のメドッドNoを増分 | |
349 | + StatusUtil.incrExecuteMethodNo(executeMethodNo); | |
350 | + | |
351 | + newKeyNodeConnectionUse = false; | |
352 | + switch (StatusUtil.isExecuteMethod(executeMethodNo)) { | |
353 | + | |
345 | 354 | case 0 : |
346 | - | |
347 | 355 | // Client初期化情報 |
348 | 356 | retParams = this.initClient(); |
349 | 357 |
@@ -363,15 +371,17 @@ | ||
363 | 371 | case 201 : |
364 | 372 | //System.out.println(new String(BASE64DecoderStream.decode(clientParameterList[1].getBytes()))); |
365 | 373 | // Key値でValueを取得する |
374 | + newKeyNodeConnectionUse = true; | |
366 | 375 | retParams = this.getKeyValue(clientParameterList[1]); |
367 | 376 | |
368 | 377 | if (retParams.length > 1 && retParams[1].equals("true")) { |
369 | 378 | |
370 | - | |
371 | 379 | String[] realRetParams = new String[4]; |
372 | 380 | realRetParams[0] = "201"; |
373 | 381 | realRetParams[1] = "true"; |
374 | - byte[] valLenBytes = new Integer(retParams[2].length()).toString().getBytes(); | |
382 | + String compressStr = retParams[2]; | |
383 | + String compressFixStr = new String(BASE64EncoderStream.encode(SystemUtil.dataCompress(compressStr.getBytes()))); | |
384 | + byte[] valLenBytes = new Integer(compressFixStr.length()).toString().getBytes(); | |
375 | 385 | byte[] valLenInfo = {48,48,48,48,48,48,48,48,48}; |
376 | 386 | int idx = 0; |
377 | 387 | for (int i = (9 - valLenBytes.length); i < 9; i++) { |
@@ -379,7 +389,7 @@ | ||
379 | 389 | idx++; |
380 | 390 | } |
381 | 391 | realRetParams[2] = new String(valLenInfo); |
382 | - realRetParams[3] = retParams[2]; | |
392 | + realRetParams[3] = compressFixStr; | |
383 | 393 | retParams = realRetParams; |
384 | 394 | } |
385 | 395 |
@@ -1110,14 +1120,27 @@ | ||
1110 | 1120 | if (!reloopSameClient) |
1111 | 1121 | numberOfQueueBindWaitCounter.getAndIncrement(); |
1112 | 1122 | } |
1123 | + | |
1124 | + // 実行終了のMethodNoを減算 | |
1125 | + StatusUtil.decrExecuteMethodNo(executeMethodNo); | |
1126 | + executeMethodNo = -1; | |
1113 | 1127 | } |
1114 | 1128 | |
1115 | 1129 | ret = super.SUCCESS; |
1116 | 1130 | } catch(Exception e) { |
1117 | 1131 | |
1132 | + try { | |
1133 | + if (socket != null) socket.close(); | |
1134 | + socket = null; | |
1135 | + } catch (Throwable InnerE) { | |
1136 | + } | |
1118 | 1137 | logger.error("MasterManagerHelper - executeHelper - Error", e); |
1119 | 1138 | ret = super.ERROR; |
1120 | 1139 | } finally { |
1140 | + if (executeMethodNo == -1) { | |
1141 | + StatusUtil.decrExecuteMethodNo(executeMethodNo); | |
1142 | + executeMethodNo = -1; | |
1143 | + } | |
1121 | 1144 | } |
1122 | 1145 | |
1123 | 1146 |
@@ -4142,7 +4165,7 @@ | ||
4142 | 4165 | try { |
4143 | 4166 | |
4144 | 4167 | // KeyNodeとの接続を確立 |
4145 | - keyNodeConnector = this.createKeyNodeConnection(keyNodeName, keyNodePort, keyNodeFullName, false); | |
4168 | + keyNodeConnector = this.createKeyNodeConnection(keyNodeName, keyNodePort, keyNodeFullName, newKeyNodeConnectionUse); | |
4146 | 4169 | |
4147 | 4170 | nowUse = 1; |
4148 | 4171 | while (true) { |
@@ -7290,13 +7313,14 @@ | ||
7290 | 7313 | |
7291 | 7314 | // まだ接続が完了していない場合は接続処理続行 |
7292 | 7315 | // TODO:ConnectionPoolは一時休止中なのでコメントアウト |
7293 | - /*if (keyNodeConnector == null) | |
7316 | + //if (keyNodeConnector == null) | |
7294 | 7317 | // 新規接続 |
7295 | 7318 | // 親クラスから既に接続済みの接続をもらう |
7296 | - keyNodeConnector = super.getActiveConnection(connectionFullName); | |
7297 | - */ | |
7319 | + //keyNodeConnector = super.getActiveConnection(connectionFullName); | |
7320 | + // | |
7298 | 7321 | } |
7299 | 7322 | |
7323 | + | |
7300 | 7324 | // まだ接続が完了していない場合は接続処理続行 |
7301 | 7325 | if (keyNodeConnector == null) { |
7302 | 7326 | // 接続が存在しない場合は自身で接続処理を行う |
@@ -109,6 +109,7 @@ | ||
109 | 109 | // アクセスを時間帯単位でサマリーするリスト |
110 | 110 | private static AtomicLong[] accessCountList = new AtomicLong[24]; |
111 | 111 | |
112 | + private static AtomicLong[] nowExecuteMethodSummaryList = new AtomicLong[1000]; | |
112 | 113 | |
113 | 114 | |
114 | 115 | // 初期化 |
@@ -117,6 +118,10 @@ | ||
117 | 118 | accessCountList[i] = new AtomicLong(); |
118 | 119 | } |
119 | 120 | |
121 | + for (int i = 0; i < 1000; i++) { | |
122 | + nowExecuteMethodSummaryList[i] = new AtomicLong(); | |
123 | + } | |
124 | + | |
120 | 125 | try { |
121 | 126 | configDataKeyMap = new HashMap(); |
122 | 127 | // addNode4ConsistentHashMode |
@@ -707,7 +712,32 @@ | ||
707 | 712 | return strBuf.toString(); |
708 | 713 | } |
709 | 714 | |
715 | + public static void incrExecuteMethodNo(int no) { | |
716 | + if (no > -1 && no < 1000) { | |
717 | + nowExecuteMethodSummaryList[no].incrementAndGet(); | |
718 | + } | |
719 | + } | |
710 | 720 | |
721 | + public static void decrExecuteMethodNo(int no) { | |
722 | + if (no > -1 && no < 1000) { | |
723 | + nowExecuteMethodSummaryList[no].decrementAndGet(); | |
724 | + } | |
725 | + } | |
726 | + | |
727 | + public static Map getNowExecuteMethodNoMap() { | |
728 | + Map executeMethodNoMap = new LinkedHashMap(); | |
729 | + | |
730 | + | |
731 | + for (int i = 0; i < 1000; i++) { | |
732 | + long count = nowExecuteMethodSummaryList[i].longValue(); | |
733 | + if (count > 0L) { | |
734 | + executeMethodNoMap.put("MethodNo[" + i + "]", count); | |
735 | + } | |
736 | + } | |
737 | + return executeMethodNoMap; | |
738 | + } | |
739 | + | |
740 | + | |
711 | 741 | public static boolean isStandby() { |
712 | 742 | while(mainMasterNode == null || transactionMode == null || distributionAlgorithm == null) { |
713 | 743 | try { |
@@ -38,9 +38,10 @@ | ||
38 | 38 | * @param key |
39 | 39 | * @param value |
40 | 40 | */ |
41 | - public void put(Object key, Object value) { | |
41 | + public Object put(Object key, Object value) { | |
42 | 42 | SoftReference oldRef = (SoftReference)this.innerCacheMap.put(key, new SoftReference(value)); |
43 | 43 | if (oldRef != null) oldRef.clear(); |
44 | + return null; | |
44 | 45 | } |
45 | 46 | |
46 | 47 |
@@ -74,7 +75,23 @@ | ||
74 | 75 | return this.innerCacheMap.remove(key); |
75 | 76 | } |
76 | 77 | |
78 | + public boolean containsKey(Object key) { | |
79 | + Object value = null; | |
80 | + SoftReference refValue = null; | |
77 | 81 | |
82 | + // nullであれば存在しない | |
83 | + if ((refValue = (SoftReference)this.innerCacheMap.get(key)) == null) return false; | |
84 | + | |
85 | + // Referenceは存在するが内容がない場合はgcにて消されてるのでkeyも消す | |
86 | + if ((value = refValue.get())== null) this.innerCacheMap.remove(key); | |
87 | + | |
88 | + if (value == null) { | |
89 | + return false; | |
90 | + } else { | |
91 | + return true; | |
92 | + } | |
93 | + } | |
94 | + | |
78 | 95 | /** |
79 | 96 | * end<br> |
80 | 97 | * 本メソッド呼び出した後の本クラスの動きは保障されない.<br> |
@@ -6751,6 +6751,7 @@ | ||
6751 | 6751 | * @throws OkuyamaClientException |
6752 | 6752 | */ |
6753 | 6753 | public boolean requestReadByteValue(String keyStr) throws OkuyamaClientException { |
6754 | + | |
6754 | 6755 | boolean ret = false; |
6755 | 6756 | byte[] byteRet = null; |
6756 | 6757 |
@@ -6864,7 +6865,7 @@ | ||
6864 | 6865 | }*/ |
6865 | 6866 | this.bis.read(); |
6866 | 6867 | ret[0] = "true"; |
6867 | - ret[1] = this.dataDecoding(valueBytes); | |
6868 | + ret[1] = this.dataDecoding(SystemUtil.dataDecompress(this.dataDecoding(valueBytes))); | |
6868 | 6869 | } else { |
6869 | 6870 | // データなし |
6870 | 6871 | ret[0] = "false"; |