当前位置: 首页>>代码示例>>Java>>正文


Java HashUtil.hash方法代码示例

本文整理汇总了Java中scouter.util.HashUtil.hash方法的典型用法代码示例。如果您正苦于以下问题:Java HashUtil.hash方法的具体用法?Java HashUtil.hash怎么用?Java HashUtil.hash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scouter.util.HashUtil的用法示例。


在下文中一共展示了HashUtil.hash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUseridCustom

import scouter.util.HashUtil; //导入方法依赖的package包/类
public static long getUseridCustom(HttpServletRequest req, HttpServletResponse res, String key) {
	if (key == null || key.length() == 0)
		return 0;
	try {
		String cookie = req.getHeader("Cookie");
		if (cookie != null) {
			int x1 = cookie.indexOf(key);
			if (x1 >= 0) {
				String value = null;
				int x2 = cookie.indexOf(';', x1);
				if (x2 > 0) {
					value = cookie.substring(x1 + key.length() + 1, x2);
				} else {
					value = cookie.substring(x1 + key.length() + 1);
				}
				if (value != null) {
					return HashUtil.hash(value);
				}
			}
		}
	} catch (Throwable t) {
		Logger.println("A154", t.toString());
	}
	return 0;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:UseridUtil.java

示例2: saveConfigContents

import scouter.util.HashUtil; //导入方法依赖的package包/类
private SaveResult saveConfigContents() {
	String contents = ruleText.getText();
	if (HashUtil.hash(contents) == ruleContentsHash) {
		return SaveResult.NA;
	}
	MapPack paramPack = new MapPack();
	paramPack.put("counterName", this.counterName);
	paramPack.put("contents", contents);
	MapPack resultPack = getResultMapPack(RequestCmd.SAVE_ALERT_SCRIPTING_CONTETNS, paramPack);
	if (resultPack == null) {
		return SaveResult.FAIL;
	}
	if (resultPack.getBoolean("success")) {
		ruleContentsHash = HashUtil.hash(contents);
		return SaveResult.SUCCESS;
	} else {
		return SaveResult.FAIL;
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:20,代码来源:AlertScriptingView.java

示例3: saveRuleContents

import scouter.util.HashUtil; //导入方法依赖的package包/类
private SaveResult saveRuleContents() {
	String contents = configText.getText();
	if (HashUtil.hash(contents) == configContentsHash) {
		return SaveResult.NA;
	}
	MapPack paramPack = new MapPack();
	paramPack.put("counterName", this.counterName);
	paramPack.put("contents", contents);
	MapPack resultPack = getResultMapPack(RequestCmd.SAVE_ALERT_SCRIPTING_CONFIG_CONTETNS, paramPack);
	if (resultPack == null) {
		return SaveResult.FAIL;
	}

	if (resultPack.getBoolean("success")) {
		ruleContentsHash = HashUtil.hash(contents);
		return SaveResult.SUCCESS;
	} else {
		return SaveResult.FAIL;
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:21,代码来源:AlertScriptingView.java

示例4: createLoader

import scouter.util.HashUtil; //导入方法依赖的package包/类
private synchronized static ClassLoader createLoader(ClassLoader parent, String key) {

		int hashKey = (parent == null ? 0 : System.identityHashCode(parent));
		hashKey = hashKey ^ HashUtil.hash(key);
		ClassLoader loader = loaders.get(hashKey);
		if (loader == null) {
			try {
				byte[] bytes = deployJarBytes(key);
				if (bytes != null) {
					loader = new BytesClassLoader(bytes, parent);
					loaders.put(hashKey, loader);
				}
			} catch (Throwable e) {
				Logger.println("A137", "SUBLOADER " + key + " " + e);
			}
		}
		return loader;
	}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:19,代码来源:LoaderManager.java

示例5: addGroup

import scouter.util.HashUtil; //导入方法依赖的package包/类
public int addGroup(String groupName) {
	int grpHash = HashUtil.hash(groupName);
	if (saved.contains(grpHash) == false) {
		TextPermWR.add(TextTypes.GROUP, grpHash, groupName);
	}
	return grpHash;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:8,代码来源:IXLog.java

示例6: getFloatValue

import scouter.util.HashUtil; //导入方法依赖的package包/类
@ConfigDesc("get the another objects counter's value as float.")
@ParamDesc("String objectFullName, String counter")
public float getFloatValue(String objectFullName, String counter) {
	int anotherObjHash = HashUtil.hash(objectFullName);
	Value v = CounterCache.get(new CounterKey(anotherObjHash, counter, _timetype));
	if (v instanceof Number)
		return ((Number) v).floatValue();
	else
		return 0;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:RealCounter.java

示例7: extractObjectPack

import scouter.util.HashUtil; //导入方法依赖的package包/类
private static ObjectPack extractObjectPack(JSONObject objJson) {
	String host = (String) objJson.get("host");
	String name = (String) objJson.get("name");
	String objName = getObjName(host, name);
	int objHash = HashUtil.hash(objName);
	ObjectPack objPack = new ObjectPack();
	objPack.objHash = objHash;
	objPack.objName = objName;
	objPack.objType = (String) objJson.get("type");
	objPack.address = (String) objJson.get("address");
	return objPack;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:CounterHandler.java

示例8: sendUserAgent

import scouter.util.HashUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:DataProxy.java

示例9: sendApicall

import scouter.util.HashUtil; //导入方法依赖的package包/类
public static int sendApicall( String name) {
	int hash = HashUtil.hash(name);
	if (apicall.contains(hash)) {
		return hash;
	}
	apicall.put(hash);
	udpCollect.add(new TextPack(TextTypes.APICALL, hash, name));
	return hash;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:DataProxy.java

示例10: sendError

import scouter.util.HashUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:DataProxy.java

示例11: sendDesc

import scouter.util.HashUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:DataProxy.java

示例12: resetObjInfo

import scouter.util.HashUtil; //导入方法依赖的package包/类
public synchronized void resetObjInfo() {
	this.obj_type = getValue("obj_type", CounterConstants.BATCH);
	String detected = CounterConstants.HOST;
	if (SystemUtil.IS_LINUX) {
		detected = CounterConstants.LINUX;
	} else if (SystemUtil.IS_WINDOWS) {
		detected = CounterConstants.WINDOWS;
	} else if (SystemUtil.IS_MAC_OSX) {
		detected = CounterConstants.OSX;
	} else if (SystemUtil.IS_AIX) {
		detected = CounterConstants.AIX;
	} else if (SystemUtil.IS_HP_UX) {
		detected = CounterConstants.HPUX;
	}
	this.obj_host_type = getValue("obj_host_type", detected);
	this.obj_host_name = getValue("obj_host_name", SysJMX.getHostName());
	this.objHostName = "/" + this.obj_host_name;
	this.objHostHash = HashUtil.hash(this.objHostName);
	this.obj_name_auto_pid_enabled = getBoolean("obj_name_auto_pid_enabled", false);
	
	this.obj_name = getValue("obj_name", "batch");
	this.objName = this.objHostName + "/" + this.obj_name;
	// make hash value 
	try { this.objHash = HashUtil.hash( objName.getBytes("UTF-8")); }catch(Throwable ex){}
	
	System.setProperty("scouter.objname", this.objName);
	System.setProperty("scouter.objtype", this.obj_type);
	System.setProperty("scouter.dir", agent_dir_path);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:30,代码来源:Configure.java

示例13: sendLogin

import scouter.util.HashUtil; //导入方法依赖的package包/类
public static int sendLogin( String loginName) {
int hash = HashUtil.hash(loginName);
if (loginTable.contains(hash)) {
	return hash;
}
loginTable.put(hash);
udpCollect.add(new TextPack(TextTypes.LOGIN, hash, loginName));
return hash;
 }
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:DataProxy.java

示例14: Server

import scouter.util.HashUtil; //导入方法依赖的package包/类
public Server(String ip, String port, String name) {
	this.id = HashUtil.hash(ip + port);
	this.ip = ip;
	this.port = Integer.valueOf(port);
	this.name = name;
	this.connPool = new ConnectionPool(conf.getNetWebappTcpClientPoolSize());
	this.counterEngine = new CounterEngine();
	this.xLogRetrieveThread = new XLogRetrieveThread(this);
	xLogRetrieveThread.start();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:Server.java

示例15: sendHashedMessage

import scouter.util.HashUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:DataProxy.java


注:本文中的scouter.util.HashUtil.hash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。