private static int getSqlHash(String sql) { if (sql.length() < 100) return HashUtil.hash(sql); int id = sql.hashCode(); int hash = sqlHash.get(id); if (hash == 0) { hash = HashUtil.hash(sql); sqlHash.put(id, hash); } return hash; } private static IntLinkedSet sqlText = new IntLinkedSet().setMax(10000);
public static int sendServiceName(String service) { int hash = HashUtil.hash(service); sendServiceName(hash,service); return hash; } public static void sendServiceName(int hash, String service) {
public static int sendObjName(String objName) { int hash = HashUtil.hash(objName); sendObjName(hash,objName); return hash; } public static void sendObjName(int hash, String objName) {
public Server getServer(String addr) { String[] iport = addr.split(":"); if (iport == null || iport.length < 2) { return null; } return getServer(HashUtil.hash(iport[0] + iport[1])); }
public static int sendObjName(String objName) { int hash = HashUtil.hash(objName); sendObjName(hash,objName); return hash; } public static void sendObjName(int hash, String objName) {
public static long hashAddr(byte[] src) { switch(src.length){ case 4: int c= toInt(src); return c*c; case 8: return toLong(src); default: return hash(src); } } private static int toInt(byte[] buf) {
public static long hashAddr(byte[] src) { switch(src.length){ case 4: int c= toInt(src); return c*c; case 8: return toLong(src); default: return hash(src); } } private static int toInt(byte[] buf) {
public static long hashAddr(byte[] src) { switch(src.length){ case 4: int c= toInt(src); return c*c; case 8: return toLong(src); default: return hash(src); } } private static int toInt(byte[] buf) {
public static long hashAddr(byte[] src) { switch(src.length){ case 4: int c= toInt(src); return c*c; case 8: return toLong(src); default: return hash(src); } } private static int toInt(byte[] buf) {
@ConfigDesc("make shorten url.") public String toShortenUrl(String producerUrl, String urlToShortening) throws UnsupportedEncodingException { String shorten = Hexa32.toString32(HashUtil.hash(urlToShortening)); KeyValueStoreRW.set(SHORTENER_KEY_SPACE, shorten, urlToShortening); return producerUrl + "/" + shorten; }
public static int sendDesc( String desc) { int hash = HashUtil.hash(desc); if (descTable.contains(hash)) { return hash; } descTable.put(hash); udpCollect.add(new TextPack(TextTypes.DESC, hash, desc)); return hash; } private static IntLinkedSet loginTable = new IntLinkedSet().setMax(10000);
public static int sendGroup(String text) { int hash = HashUtil.hash(text); if (groupAgent.contains(hash)) { return hash; } groupAgent.put(hash); udpCollect.add(new TextPack(TextTypes.GROUP, hash, text)); return hash; } private static IntLinkedSet hashMessage = new IntLinkedSet().setMax(10000);
public static int sendReferer(String text) { int hash = HashUtil.hash(text); if (referer.contains(hash)) { return hash; } referer.put(hash); sendDirect(new TextPack(TextTypes.REFERER, hash, text)); return hash; } private static IntLinkedSet userAgent = new IntLinkedSet().setMax(1000);
public static int sendDesc( String desc) { int hash = HashUtil.hash(desc); if (descTable.contains(hash)) { return hash; } descTable.put(hash); udpCollect.add(new TextPack(TextTypes.DESC, hash, desc)); return hash; } private static IntLinkedSet loginTable = new IntLinkedSet().setMax(10000);
public static int sendHashedMessage(String text) { int hash = HashUtil.hash(text); if (hashMessage.contains(hash)) { return hash; } hashMessage.put(hash); udpCollect.add(new TextPack(TextTypes.HASH_MSG, hash, text)); return hash; }
public static int sendMethodName(String name) { int hash = HashUtil.hash(name); if (methodName.contains(hash)) { return hash; } methodName.put(hash); udpCollect.add(new TextPack(TextTypes.METHOD, hash, name)); return hash; } private static IntLinkedSet apicall = new IntLinkedSet().setMax(10000);
public static int sendUserAgent(String text) { int hash = HashUtil.hash(text); if (userAgent.contains(hash)) { return hash; } userAgent.put(hash); udpCollect.add(new TextPack(TextTypes.USER_AGENT, hash, text)); return hash; } private static IntLinkedSet methodName = new IntLinkedSet().setMax(10000);
public static int sendError( String message) { int hash = HashUtil.hash(message); if (errText.contains(hash)) { return hash; } errText.put(hash); udpCollect.add(new TextPack(TextTypes.ERROR, hash, message)); return hash; } private static IntLinkedSet descTable = new IntLinkedSet().setMax(1000);
public static int sendGroup(String text) { int hash = HashUtil.hash(text); if (groupAgent.contains(hash)) { return hash; } groupAgent.put(hash); udpCollect.add(new TextPack(TextTypes.GROUP, hash, text)); return hash; } private static IntLinkedSet hashMessage = new IntLinkedSet().setMax(10000);