/** * 返回null表示异常发生; 返回空串,表示正常; 返回其它内容,表示有需要回应的错误信息 * * @param url 支持内含UTF-8的参数 * @return */ public static String retry(String url, boolean isTCP) { String msg = null; int tryTims = 0; while (true) { msg = IConstant.getInstance().getAjaxForSimu(url, isTCP); if ((msg == null && tryTims < 3) && (isTCP == false)) { } else { break; } tryTims++; try { Thread.sleep(1000); } catch (Exception e) { } } if (msg == null) { if (isLastUnConnServer == false) { LogManager.err(UN_CONN); isLastUnConnServer = true; } } else { isLastUnConnServer = false; } return msg; }
public static String getHideToken() { final byte[] bs = (byte[]) IConstant.getInstance().getObject(IConstant.CertKey); // 取后八位 final int tailSize = 4; final int startIdx = bs.length - tailSize; String hideToken = ""; for (int i = startIdx; i < bs.length; i++) { hideToken += Integer.toHexString(0xFF & bs[i]); } return hideToken; }