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


Java TimelineEvent.getTimestamp方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.records.timeline.TimelineEvent.getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java TimelineEvent.getTimestamp方法的具体用法?Java TimelineEvent.getTimestamp怎么用?Java TimelineEvent.getTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.records.timeline.TimelineEvent的用法示例。


在下文中一共展示了TimelineEvent.getTimestamp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAndSetStartTime

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
/**
 * Get the unique start time for a given entity as a byte array that sorts the
 * timestamps in reverse order (see
 * {@link GenericObjectMapper#writeReverseOrderedLong(long)}). If the start
 * time doesn't exist, set it based on the information provided. Should only
 * be called when a lock has been obtained on the entity.
 *
 * @param entityId
 *          The id of the entity
 * @param entityType
 *          The type of the entity
 * @param startTime
 *          The start time of the entity, or null
 * @param events
 *          A list of events for the entity, or null
 * @return A StartAndInsertTime
 * @throws IOException
 */
private Long getAndSetStartTime(String entityId, String entityType,
    Long startTime, List<TimelineEvent> events) throws IOException {
  EntityIdentifier entity = new EntityIdentifier(entityId, entityType);
  Long time = startTimeWriteCache.get(entity);
  if (time != null) {
    // return the value in the cache
    return time;
  }
  if (startTime == null && events != null) {
    // calculate best guess start time based on lowest event time
    startTime = Long.MAX_VALUE;
    for (TimelineEvent e : events) {
      if (e.getTimestamp() < startTime) {
        startTime = e.getTimestamp();
      }
    }
  }
  // check the provided start time matches the db
  return checkStartTimeInDb(entity, startTime);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:39,代码来源:RollingLevelDBTimelineStore.java

示例2: getAndSetStartTime

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
/**
 * Get the unique start time for a given entity as a byte array that sorts the
 * timestamps in reverse order (see
 * {@link GenericObjectMapper#writeReverseOrderedLong(long)}). If the start
 * time doesn't exist, set it based on the information provided.
 *
 * @param entityId
 *          The id of the entity
 * @param entityType
 *          The type of the entity
 * @param startTime
 *          The start time of the entity, or null
 * @param events
 *          A list of events for the entity, or null
 * @return A StartAndInsertTime
 * @throws IOException
 */
private Long getAndSetStartTime(String entityId,
    String entityType, Long startTime, List<TimelineEvent> events)
    throws IOException {
  EntityIdentifier entity = new EntityIdentifier(entityId, entityType);
  Long time = startTimeWriteCache.get(entity);
  if (time != null) {
    // return the value in the cache
    return time;
  }
  if (startTime == null && events != null) {
    // calculate best guess start time based on lowest event time
    startTime = Long.MAX_VALUE;
    for (TimelineEvent e : events) {
      if (e.getTimestamp() < startTime) {
        startTime = e.getTimestamp();
      }
    }
  }
  // check the provided start time matches the db
  return checkStartTimeInDb(entity, startTime);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:RollingLevelDBTimelineStore.java

示例3: getAndSetStartTime

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
/**
 * Get the unique start time for a given entity as a byte array that sorts
 * the timestamps in reverse order (see {@link
 * GenericObjectMapper#writeReverseOrderedLong(long)}). If the start time
 * doesn't exist, set it based on the information provided. Should only be
 * called when a lock has been obtained on the entity.
 *
 * @param entityId The id of the entity
 * @param entityType The type of the entity
 * @param startTime The start time of the entity, or null
 * @param events A list of events for the entity, or null
 * @return A StartAndInsertTime
 * @throws IOException
 */
private StartAndInsertTime getAndSetStartTime(String entityId,
    String entityType, Long startTime, List<TimelineEvent> events)
    throws IOException {
  EntityIdentifier entity = new EntityIdentifier(entityId, entityType);
  if (startTime == null) {
    // start time is not provided, so try to look it up
    if (startTimeWriteCache.containsKey(entity)) {
      // found the start time in the cache
      return startTimeWriteCache.get(entity);
    } else {
      if (events != null) {
        // prepare a start time from events in case it is needed
        Long min = Long.MAX_VALUE;
        for (TimelineEvent e : events) {
          if (min > e.getTimestamp()) {
            min = e.getTimestamp();
          }
        }
        startTime = min;
      }
      return checkStartTimeInDb(entity, startTime);
    }
  } else {
    // start time is provided
    if (startTimeWriteCache.containsKey(entity)) {
      // always use start time from cache if it exists
      return startTimeWriteCache.get(entity);
    } else {
      // check the provided start time matches the db
      return checkStartTimeInDb(entity, startTime);
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:48,代码来源:LeveldbTimelineStore.java

示例4: getEntityTimelines

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
@Override
public synchronized TimelineEvents getEntityTimelines(String entityType,
    SortedSet<String> entityIds, Long limit, Long windowStart,
    Long windowEnd,
    Set<String> eventTypes) {
  TimelineEvents allEvents = new TimelineEvents();
  if (entityIds == null) {
    return allEvents;
  }
  if (limit == null) {
    limit = DEFAULT_LIMIT;
  }
  if (windowStart == null) {
    windowStart = Long.MIN_VALUE;
  }
  if (windowEnd == null) {
    windowEnd = Long.MAX_VALUE;
  }
  for (String entityId : entityIds) {
    EntityIdentifier entityID = new EntityIdentifier(entityId, entityType);
    TimelineEntity entity = entities.get(entityID);
    if (entity == null) {
      continue;
    }
    EventsOfOneEntity events = new EventsOfOneEntity();
    events.setEntityId(entityId);
    events.setEntityType(entityType);
    for (TimelineEvent event : entity.getEvents()) {
      if (events.getEvents().size() >= limit) {
        break;
      }
      if (event.getTimestamp() <= windowStart) {
        continue;
      }
      if (event.getTimestamp() > windowEnd) {
        continue;
      }
      if (eventTypes != null && !eventTypes.contains(event.getEventType())) {
        continue;
      }
      events.addEvent(event);
    }
    allEvents.addEvent(events);
  }
  return allEvents;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:47,代码来源:MemoryTimelineStore.java

示例5: getEntityTimelines

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
@Override
public synchronized TimelineEvents getEntityTimelines(String entityType,
    SortedSet<String> entityIds, Long limit, Long windowStart,
    Long windowEnd,
    Set<String> eventTypes) {
  if (getServiceStopped()) {
    LOG.info("Service stopped, return null for the storage");
    return null;
  }
  TimelineEvents allEvents = new TimelineEvents();
  if (entityIds == null) {
    return allEvents;
  }
  if (limit == null) {
    limit = DEFAULT_LIMIT;
  }
  if (windowStart == null) {
    windowStart = Long.MIN_VALUE;
  }
  if (windowEnd == null) {
    windowEnd = Long.MAX_VALUE;
  }
  for (String entityId : entityIds) {
    EntityIdentifier entityID = new EntityIdentifier(entityId, entityType);
    TimelineEntity entity = entities.get(entityID);
    if (entity == null) {
      continue;
    }
    EventsOfOneEntity events = new EventsOfOneEntity();
    events.setEntityId(entityId);
    events.setEntityType(entityType);
    for (TimelineEvent event : entity.getEvents()) {
      if (events.getEvents().size() >= limit) {
        break;
      }
      if (event.getTimestamp() <= windowStart) {
        continue;
      }
      if (event.getTimestamp() > windowEnd) {
        continue;
      }
      if (eventTypes != null && !eventTypes.contains(event.getEventType())) {
        continue;
      }
      events.addEvent(event);
    }
    allEvents.addEvent(events);
  }
  return allEvents;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:51,代码来源:KeyValueBasedTimelineStore.java

示例6: getEntityTimelines

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
@Override
public TimelineEvents getEntityTimelines(String entityType,
    SortedSet<String> entityIds, Long limit, Long windowStart,
    Long windowEnd,
    Set<String> eventTypes) {
  TimelineEvents allEvents = new TimelineEvents();
  if (entityIds == null) {
    return allEvents;
  }
  if (limit == null) {
    limit = DEFAULT_LIMIT;
  }
  if (windowStart == null) {
    windowStart = Long.MIN_VALUE;
  }
  if (windowEnd == null) {
    windowEnd = Long.MAX_VALUE;
  }
  for (String entityId : entityIds) {
    EntityIdentifier entityID = new EntityIdentifier(entityId, entityType);
    TimelineEntity entity = entities.get(entityID);
    if (entity == null) {
      continue;
    }
    EventsOfOneEntity events = new EventsOfOneEntity();
    events.setEntityId(entityId);
    events.setEntityType(entityType);
    for (TimelineEvent event : entity.getEvents()) {
      if (events.getEvents().size() >= limit) {
        break;
      }
      if (event.getTimestamp() <= windowStart) {
        continue;
      }
      if (event.getTimestamp() > windowEnd) {
        continue;
      }
      if (eventTypes != null && !eventTypes.contains(event.getEventType())) {
        continue;
      }
      events.addEvent(event);
    }
    allEvents.addEvent(events);
  }
  return allEvents;
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:47,代码来源:MemoryTimelineStore.java


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