本文整理汇总了Java中java.util.concurrent.atomic.AtomicLong.longValue方法的典型用法代码示例。如果您正苦于以下问题:Java AtomicLong.longValue方法的具体用法?Java AtomicLong.longValue怎么用?Java AtomicLong.longValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.atomic.AtomicLong
的用法示例。
在下文中一共展示了AtomicLong.longValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: highestStampForDir
import java.util.concurrent.atomic.AtomicLong; //导入方法依赖的package包/类
private static boolean highestStampForDir(File file, AtomicReference<File> newestFile, AtomicLong result, AtomicInteger crc) {
if (file.getName().equals(".nbattrs")) { // NOI18N
return true;
}
File[] children = file.listFiles();
if (children == null) {
if (crc != null) {
crc.addAndGet(file.getName().length());
}
long time = file.lastModified();
if (time > result.longValue()) {
newestFile.set(file);
result.set(time);
}
return false;
}
for (File f : children) {
highestStampForDir(f, newestFile, result, crc);
}
return true;
}
示例2: iterateTests
import java.util.concurrent.atomic.AtomicLong; //导入方法依赖的package包/类
private void iterateTests(TestResult result, StringBuffer times, TestSuite suite, AtomicLong min, AtomicLong max) {
Enumeration en = suite.tests();
while (en.hasMoreElements()) {
Test t = (Test)en.nextElement();
if (t instanceof Callable) {
try {
Long v = (Long)((Callable) t).call();
long time = v.longValue();
if (time < min.longValue()) {
min.set(time);
}
if (time > max.longValue()) {
max.set(time);
}
// append(t.toString()).append(" value: ")
times.append("Run: ").append(v).append('\n');
} catch (Exception ex) {
result.addError(this, ex);
}
}
if (t instanceof TestSuite) {
iterateTests(result, times, (TestSuite)t, min, max);
}
}
}
示例3: run
import java.util.concurrent.atomic.AtomicLong; //导入方法依赖的package包/类
@Override
public void run(TestResult result) {
result.startTest(this);
StringBuffer times = new StringBuffer("\n");
AtomicLong min = new AtomicLong(Long.MAX_VALUE);
AtomicLong max = new AtomicLong(Long.MIN_VALUE);
iterateTests(result, times, suite, min, max);
System.err.println(times.toString());
if (max.longValue() > 3 * min.longValue()) {
result.addFailure(this, new AssertionFailedError(times.toString()));
}
result.endTest(this);
}
示例4: getImportsHashCodeForRoots
import java.util.concurrent.atomic.AtomicLong; //导入方法依赖的package包/类
public static long getImportsHashCodeForRoots(Collection<FileObject> roots) {
long hash = 5;
for(FileObject root : roots) {
AtomicLong rootHash = computedImportsHashCodes.get(root);
if(rootHash != null) {
hash = hash * 51 + rootHash.longValue();
}
}
return hash;
}
示例5: findMatchStatement
import java.util.concurrent.atomic.AtomicLong; //导入方法依赖的package包/类
public static QLMatchResult findMatchStatement(INodeTypeManager aManager,QLPatternNode pattern ,List<? extends IDataNode> nodes,int point) throws Exception{
AtomicLong maxMatchPoint = new AtomicLong();
QLMatchResult result = findMatchStatementWithAddRoot(aManager,pattern,nodes,point,true,maxMatchPoint);
if(result == null || result.matchs.size() == 0){
throw new Exception("程序错误,不满足语法规范,没有匹配到合适的语法,最大匹配致[0:" + (maxMatchPoint.longValue()-1) +"]");
}else if(result != null && result.matchs.size() != 1){
throw new Exception("程序错误,不满足语法规范,必须有一个根节点:" + pattern + ",最大匹配致[0:" + (maxMatchPoint.longValue()-1) +"]");
}
return result;
}
示例6: newLinearId
import java.util.concurrent.atomic.AtomicLong; //导入方法依赖的package包/类
/**
* Creates new linear identification number from the provided parameter.
* <p>
* Used for session scope and router scope ids
*
* @param longValue start address of the identification number. Next number will be
* this value plus 1
* @return new id
*/
public static long newLinearId(AtomicLong longValue) {
long candiateId = longValue.incrementAndGet();
if (candiateId > IdGenerator.MAX) {
longValue.set(1L);
candiateId = longValue.longValue();
}
return candiateId;
}