本文整理汇总了Java中com.thinkaurelius.titan.core.attribute.Duration.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.getLength方法的具体用法?Java Duration.getLength怎么用?Java Duration.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thinkaurelius.titan.core.attribute.Duration
的用法示例。
在下文中一共展示了Duration.getLength方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sub
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public Duration sub(Duration subtrahend) {
long result = getLength(unit) - subtrahend.getLength(unit);
if (0 > result) {
result = 0;
}
return new StandardDuration(result, unit);
}
示例2: compareTo
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public int compareTo(Duration o) {
if (o.getLength(TimeUnit.NANOSECONDS) == 0) {
return 0;
} else {
return -1;
}
}
示例3: lock
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public void lock(Duration timeout) {
boolean success = false;
try {
success = super.tryLock(timeout.getLength(REENTRANT_LOCK_TIME_UNIT), REENTRANT_LOCK_TIME_UNIT);
} catch (InterruptedException e) {
log.warn("Interrupted waiting for lock: {}",e);
}
if (!success) throw new TitanException("Possible dead lock detected. Waited for transaction lock without success");
}
示例4: getStringForDefaultValue
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
private String getStringForDefaultValue(ConfigOption<?> c) {
Object o = c.getDefaultValue();
if (null == o) {
return "(no default value)";
} else if (o instanceof Duration) {
Duration d = (Duration)o;
return d.getLength(TimeUnit.MILLISECONDS) + " ms";
} else if (o instanceof String[]) {
return Joiner.on(",").join((String[])o);
}
return o.toString();
}
示例5: getCache
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
private static KCVSCache getCache(KeyColumnValueStore store, Duration expirationTime, Duration graceWait) {
return new ExpirationKCVSCache(store,METRICS_STRING,expirationTime.getLength(TimeUnit.MILLISECONDS),graceWait.getLength(TimeUnit.MILLISECONDS),CACHE_SIZE);
}
示例6: add
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public StandardTimepoint add(Duration addend) {
// Use this object's unit in returned object
// TODO check for and warn on loss of precision
return new StandardTimepoint(sinceEpoch + addend.getLength(getNativeUnit()), provider);
}
示例7: sub
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public StandardTimepoint sub(Duration subtrahend) {
return new StandardTimepoint(sinceEpoch - subtrahend.getLength(getNativeUnit()), provider);
}
示例8: add
import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public Duration add(Duration addend) {
return new StandardDuration(getLength(unit) + addend.getLength(unit), unit);
}