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


Java Duration.getLength方法代码示例

本文整理汇总了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);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:9,代码来源:StandardDuration.java

示例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;
    }
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:9,代码来源:ZeroDuration.java

示例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");
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:11,代码来源:ReentrantTransactionLock.java

示例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();
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:15,代码来源:ConfigurationPrinter.java

示例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);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:4,代码来源:ExpirationCacheTest.java

示例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);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:7,代码来源:StandardTimepoint.java

示例7: sub

import com.thinkaurelius.titan.core.attribute.Duration; //导入方法依赖的package包/类
@Override
public StandardTimepoint sub(Duration subtrahend) {
    return new StandardTimepoint(sinceEpoch - subtrahend.getLength(getNativeUnit()), provider);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:5,代码来源:StandardTimepoint.java

示例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);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:5,代码来源:StandardDuration.java


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