提交 674bfd0a authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use AtomicIntegerArray.getAndIncrement() to remove initial initialization with -1

上级 edb42434
...@@ -94,11 +94,7 @@ public class TraceObject { ...@@ -94,11 +94,7 @@ public class TraceObject {
private static final int LAST = ARRAY + 1; private static final int LAST = ARRAY + 1;
private static final AtomicIntegerArray ID = new AtomicIntegerArray(LAST); private static final AtomicIntegerArray ID = new AtomicIntegerArray(LAST);
static {
for (int i=0; i<LAST; i++) {
ID.set(i, -1);
}
}
private static final String[] PREFIX = { "call", "conn", "dbMeta", "prep", private static final String[] PREFIX = { "call", "conn", "dbMeta", "prep",
"rs", "rsMeta", "sp", "ex", "stat", "blob", "clob", "pMeta", "ds", "rs", "rsMeta", "sp", "ex", "stat", "blob", "clob", "pMeta", "ds",
"xads", "xares", "xid", "ar" }; "xads", "xares", "xid", "ar" };
...@@ -145,7 +141,7 @@ public class TraceObject { ...@@ -145,7 +141,7 @@ public class TraceObject {
* @return the new trace object id * @return the new trace object id
*/ */
protected static int getNextId(int type) { protected static int getNextId(int type) {
return ID.incrementAndGet(type); return ID.getAndIncrement(type);
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论