本文整理了Java中com.vmware.xenon.common.Utils.getNowMicrosUtc()
方法的一些代码示例,展示了Utils.getNowMicrosUtc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getNowMicrosUtc()
方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:getNowMicrosUtc
[英]Return wall clock time, in microseconds since Unix Epoch (1/1/1970 UTC midnight). This functions guarantees time always moves forward, but it does not guarantee it does so in fixed intervals.
[中]返回挂钟时间,自Unix纪元(1/1/1970 UTC午夜)起以微秒为单位。这个函数保证时间总是向前移动,但不能保证时间以固定的间隔向前移动。
代码示例来源:origin: vmware/xenon
private void saveState(File sandboxDir) throws IOException, InterruptedException {
File hostStateFile = new File(sandboxDir, SERVICE_HOST_STATE_FILE);
this.state.documentUpdateTimeMicros = Utils.getNowMicrosUtc();
byte[] serializedState = Utils.toJsonHtml(this.state).getBytes(Utils.CHARSET);
Files.write(hostStateFile.toPath(), serializedState, StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING);
}
代码示例来源:origin: vmware/admiral
private boolean isInspectionNeeded(ContainerState container) {
Long lastInspect = inspectCache.get(container.documentSelfLink);
if (lastInspect == null || lastInspect < Utils.fromNowMicrosUtc(-INSPECT_INTERVAL)) {
inspectCache.put(container.documentSelfLink, Utils.getNowMicrosUtc());
return true;
}
return false;
}
代码示例来源:origin: vmware/xenon
public void scheduleNodeGroupChangeMaintenance(String nodeSelectorPath) {
long now = Utils.getNowMicrosUtc();
this.host.log(Level.FINE, "%s %d", nodeSelectorPath, now);
this.synchronizationTimes.put(nodeSelectorPath, now);
scheduleNodeGroupChangeMaintenance(nodeSelectorPath, null);
}
代码示例来源:origin: vmware/xenon
void archiveCorruptIndexFiles(File directory) {
File newDirectory = new File(new File(getHost().getStorageSandbox()), this.indexDirectory
+ "." + Utils.getNowMicrosUtc());
try {
logWarning("Archiving corrupt index files to %s", newDirectory.toPath());
Files.createDirectory(newDirectory.toPath());
// we assume a flat directory structure for the LUCENE directory
FileUtils.moveOrDeleteFiles(directory, newDirectory, false);
} catch (IOException e) {
logWarning(e.toString());
}
}
代码示例来源:origin: vmware/xenon
private static String getIdFromEnv() {
String s = System.getenv(ENV_XENON_ID);
if (s == null) {
s = System.getProperty("user.name") + "_" + Utils.getNowMicrosUtc();
}
return s;
}
代码示例来源:origin: com.vmware.xenon/xenon-common
private static String getIdFromEnv() {
String s = System.getenv(ENV_XENON_ID);
if (s == null) {
s = System.getProperty("user.name") + "_" + Utils.getNowMicrosUtc();
}
return s;
}
代码示例来源:origin: vmware/xenon
/**
* Issues a query to verify index is healthy
*/
private void doSelfValidationQuery() throws Exception {
TermQuery tq = new TermQuery(new Term(ServiceDocument.FIELD_NAME_SELF_LINK, getSelfLink()));
ServiceDocumentQueryResult rsp = new ServiceDocumentQueryResult();
Operation op = Operation.createGet(getUri());
EnumSet<QueryOption> options = EnumSet.of(QueryOption.INCLUDE_ALL_VERSIONS);
IndexSearcher s = new IndexSearcher(DirectoryReader.open(this.writer, true, true));
queryIndexPaginated(op, options, s, tq, null, Integer.MAX_VALUE, 0, null, null, rsp, null,
Utils.getNowMicrosUtc());
}
代码示例来源:origin: vmware/xenon
private Query createUpdatedSinceTimeRange(long timeInMicros) {
long limitToNowInMicros = Utils.getNowMicrosUtc() + TimeUnit.SECONDS.toMicros(10);
NumericRange<Long> range = NumericRange.createLongRange(timeInMicros, limitToNowInMicros,
true, false);
range.precisionStep = 64; // 4 and 8 doesn't work. 16 works but set 64 to be certain.
QueryTask.Query latestSinceCondition = new QueryTask.Query()
.setTermPropertyName(ServiceDocument.FIELD_NAME_UPDATE_TIME_MICROS)
.setNumericRange(range)
.setTermMatchType(MatchType.TERM);
latestSinceCondition.occurance = Occurance.MUST_OCCUR;
return latestSinceCondition;
}
代码示例来源:origin: vmware/xenon
@Before
public void setUp() throws Exception {
try {
this.baseAccountId = Utils.getNowMicrosUtc();
setUpHostWithAdditionalServices(this.host);
this.defaultHost = this.host;
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.vmware.xenon/xenon-common
@Before
public void setUp() throws Exception {
try {
this.baseAccountId = Utils.getNowMicrosUtc();
setUpHostWithAdditionalServices(this.host);
this.defaultHost = this.host;
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
StorageDescription state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
NetworkInterfaceDescription state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
ComputeDescription state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
NetworkInterfaceState state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
ComputeState state = validateCreate(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
SecurityGroupState state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
NetworkState state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.whenCompleteNotify(start);
}
代码示例来源:origin: com.vmware.xenon/xenon-common
@Before
public void prepare() throws Throwable {
this.baseAccountId = Utils.getNowMicrosUtc();
setUpHostWithAdditionalServices(this.host);
this.host.setOperationTimeOutMicros(TimeUnit.SECONDS.toMicros(1000));
this.defaultHost = this.host;
}
代码示例来源:origin: vmware/xenon
@Before
public void prepare() throws Throwable {
this.baseAccountId = Utils.getNowMicrosUtc();
setUpHostWithAdditionalServices(this.host);
this.host.setOperationTimeOutMicros(TimeUnit.SECONDS.toMicros(1000));
this.defaultHost = this.host;
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
@Override
public void handleCreate(Operation start) {
if (PhotonModelUtils.isFromMigration(start)) {
start.complete();
return;
}
DiskState state = processInput(start);
state.documentCreationTimeMicros = Utils.getNowMicrosUtc();
ResourceUtils.populateTags(this, state)
.thenAccept(__ -> ResourceUtils.initNoEndpointFlag(state, DiskState.class))
.whenCompleteNotify(start);
}
内容来源于网络,如有侵权,请联系作者删除!