little refa
This commit is contained in:
parent
2951dfaf6c
commit
ad688287e3
|
@ -1,15 +1,21 @@
|
|||
package org.bench4q.agent.parameterization.impl;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Para_IteratorNumber {
|
||||
public Long iteratorNum = new Long(0);
|
||||
|
||||
public String getIteratorNumber(UUID id)
|
||||
{
|
||||
/**
|
||||
* For all methods, they will has these two params
|
||||
*
|
||||
* @param id
|
||||
* @param a
|
||||
* @return
|
||||
*/
|
||||
public String getIteratorNumber(UUID id, Map<String, Object> a) {
|
||||
long result = 0;
|
||||
synchronized(iteratorNum)
|
||||
{
|
||||
synchronized (iteratorNum) {
|
||||
iteratorNum++;
|
||||
result = iteratorNum;
|
||||
}
|
||||
|
@ -17,8 +23,7 @@ public class Para_IteratorNumber {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public void unreg(UUID id)
|
||||
{
|
||||
public void unreg(UUID id) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ public class ParameterizationParser {
|
|||
result = insCon.getParameterByContext(name);
|
||||
if (result != null)
|
||||
return result;
|
||||
if (type == "crossThread") {
|
||||
if (type.equals("crossThread")) {
|
||||
result = insCon.getParameter(name, getCurrentPackageFullName()
|
||||
+ "." + className, methodName, args);
|
||||
} else if (type == "inThread") {
|
||||
} else if (type.equals("inThread")) {
|
||||
result = insCon.instanceLevelGetParameter(name, className,
|
||||
methodName, args);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package org.bench4q.agent.test.parameterization;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.agent.parameterization.impl.InstanceControler;
|
||||
import org.bench4q.agent.parameterization.impl.ParameterizationParser;
|
||||
import org.bench4q.share.helper.TestHelper;
|
||||
|
@ -22,9 +20,8 @@ public class Test_ParameterizationParser {
|
|||
public void testParse() {
|
||||
ParameterizationParser parameterParser = new ParameterizationParser();
|
||||
String result = parameterParser.parse(
|
||||
"<parameter class=\"Para_IteratorNumber\" method=\"getIteratorNumber\" args=\""
|
||||
+ UUID.randomUUID() + "\" type=\"crossThread\"/>",
|
||||
new InstanceControler());
|
||||
"<parameter class=\"Para_IteratorNumber\" method=\"getIteratorNumber\""
|
||||
+ " type=\"crossThread\"/>", new InstanceControler());
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue