Creates a snapshot for a producer.
@param producer
@param intervalName
@return
425225
public static ProducerSnapshot createSnapshot(IStatsProducer producer, String intervalName){
		ProducerSnapshot ret = new ProducerSnapshot();
		ret.setCategory(producer.getCategory());
		ret.setSubsystem(producer.getSubsystem());
		ret.setProducerId(producer.getProducerId());
		ret.setIntervalName(intervalName);


		List<IStats> stats = producer.getStats();
		if (stats!=null && stats.size()>0)
			ret.setStatClassName(stats.get(0).getClass().getName());


		//optimization
		if (stats==null || stats.size()==0)
			return ret;
		List<String> cachedValueNames = stats.get(0).getAvailableValueNames();


		for (IStats stat : stats){
			ret.addSnapshot(createStatSnapshot(stat, intervalName, cachedValueNames));
		}

		return ret;
	}
860153
@Override
	public Object[] getDatabaseSnapshot(Serializable id, SharedSessionContractImplementor session)
			throws HibernateException {

		if ( log.isTraceEnabled() ) {
			log.trace( "Getting current persistent state for: " + MessageHelper.infoString( this, id, getFactory() ) );
		}

		//snapshot is a Map in the end
		final Tuple resultset = getFreshTuple( EntityKeyBuilder.fromPersister( this, id, session ), session );

		//if there is no resulting row, return null
		if ( resultset == null || resultset.getSnapshot().isEmpty() ) {
			return null;
		}
		//otherwise return the "hydrated" state (ie. associations are not resolved)
		GridType[] types = gridPropertyTypes;
		Object[] values = new Object[types.length];
		boolean[] includeProperty = getPropertyUpdateability();
		for ( int i = 0; i < types.length; i++ ) {
			if ( includeProperty[i] ) {
				values[i] = types[i].hydrate( resultset, getPropertyAliases( "", i ), session, null ); //null owner ok??
			}
		}
		return values;
	}
1334213
private VersionedIntervalTimeline<String, DataSegment> buildVersionedIntervalTimeline(
      final String dataSource,
      final Collection<Interval> intervals,
      final Handle handle
  )
  {
    return VersionedIntervalTimeline.forSegments(intervals
        .stream()
        .flatMap(interval -> handle.createQuery(
                StringUtils.format(
                    "SELECT payload FROM %1$s WHERE dataSource = :dataSource AND start < :end AND %2$send%2$s > :start AND used = true",
                    getSegmentsTable(),
                    connector.getQuoteString()
                )
            )
            .setFetchSize(connector.getStreamingFetchSize())
            .bind("dataSource", dataSource)
            .bind("start", interval.getStart().toString())
            .bind("end", interval.getEnd().toString())
            .map((i, resultSet, context) -> {
              try {
                return jsonMapper.readValue(resultSet.getBytes("payload"), DataSegment.class);
              }
              catch (IOException e) {
                throw new RuntimeException(e);
              }
            })
            .list()
            .stream()
        )
        .iterator()
    );
  }
523898
public Integer deleteByTimestamp(String destination, int interval) {
        HashMap params = Maps.newHashMapWithExpectedSize(2);
        long timestamp = System.currentTimeMillis() - interval * 1000;
        params.put("timestamp", timestamp);
        params.put("destination", destination);
        return getSqlMapClientTemplate().delete("meta_snapshot.deleteByTimestamp", params);
    }
876565
@GET
  @Path("/{dataSourceName}/intervals/{interval}/serverview")
  @Produces(MediaType.APPLICATION_JSON)
  @ResourceFilters(DatasourceResourceFilter.class)
  public Response getSegmentDataSourceSpecificInterval(
      @PathParam("dataSourceName") String dataSourceName,
      @PathParam("interval") String interval,
      @QueryParam("partial") final boolean partial
  )
  {
    TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline(
        new TableDataSource(dataSourceName)
    );
    final Interval theInterval = Intervals.of(interval.replace('_', '/'));
    if (timeline == null) {
      log.debug("No timeline found for datasource[%s]", dataSourceName);
      return Response.ok(new ArrayList<ImmutableSegmentLoadInfo>()).build();
    }

    Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval);
    FunctionalIterable<ImmutableSegmentLoadInfo> retval = FunctionalIterable
        .create(lookup).transformCat(
            (TimelineObjectHolder<String, SegmentLoadInfo> input) ->
                Iterables.transform(
                    input.getObject(),
                    (PartitionChunk<SegmentLoadInfo> chunk) ->
                        chunk.getObject().toImmutableSegmentLoadInfo()
                )
        );
    return Response.ok(retval).build();
  }
1171701
public static TimestampInterval from(ChronoInterval<PlainTimestamp> interval) {

        if (interval instanceof TimestampInterval) {
            return TimestampInterval.class.cast(interval);
        } else {
            return new TimestampInterval(interval.getStart(), interval.getEnd());
        }

    }
86580
public void serviceName_snapshot_PUT(String serviceName, OvhSnapshot body) throws IOException {
		String qPath = "/vps/{serviceName}/snapshot";
		StringBuilder sb = path(qPath, serviceName);
		exec(qPath, "PUT", sb.toString(), body);
	}
292092
def _create_snapshot(logger, snapshot_name, vm, save_vm_memory_to_snapshot):
        
        logger.info("Create virtual machine snapshot")
        dump_memory = save_vm_memory_to_snapshot
        quiesce = True
        task = vm.CreateSnapshot(snapshot_name, 'Created by CloudShell vCenterShell', dump_memory, quiesce)
        return task
1234369
public void snapshot(byte[] snapshotName, byte[] tableName)
      throws IOException, IllegalArgumentException {
    snapshot(snapshotName, TableName.valueOf(tableName));
  }
711952
Snapshot snapshot() {
    Snapshot snapshot = raft.getSnapshotStore().newTemporarySnapshot(raft.getLastApplied(), new WallClockTimestamp());
    try (SnapshotWriter writer = snapshot.openWriter()) {
      for (RaftServiceContext service : raft.getServices()) {
        writer.buffer().mark();
        SnapshotWriter serviceWriter = new SnapshotWriter(writer.buffer().writeInt(0).slice(), writer.snapshot());
        snapshotService(serviceWriter, service);
        int length = serviceWriter.buffer().position();
        writer.buffer().reset().writeInt(length).skip(length);
      }
    } catch (Exception e) {
      snapshot.close();
      logger.error("Failed to snapshot services", e);
      throw e;
    }
    return snapshot;
  }
552607
private FlinkKafkaProducer<byte[], byte[]> createTransactionalProducer() throws FlinkKafka011Exception {
		String transactionalId = availableTransactionalIds.poll();
		if (transactionalId == null) {
			throw new FlinkKafka011Exception(
				FlinkKafka011ErrorCode.PRODUCERS_POOL_EMPTY,
				"Too many ongoing snapshots. Increase kafka producers pool size or decrease number of concurrent checkpoints.");
		}
		FlinkKafkaProducer<byte[], byte[]> producer = initTransactionalProducer(transactionalId, true);
		producer.initTransactions();
		return producer;
	}
1249161
@Override
	public TypeSerializerSnapshot<T> snapshotConfiguration() {
		if (configSnapshot == null) {
			checkAvroInitialized();
			configSnapshot = new AvroSerializerSnapshot<>(runtimeSchema, type);
		}
		return configSnapshot;
	}
1373069
private List<ProducerAO> getFilteredProducers(String intervalName, TimeUnit timeUnit, String category, String subsystem) throws APIException {
        if (!StringUtils.isEmpty(category)) {
            return getProducerAPI().getAllProducersByCategory(category, intervalName, timeUnit, true);
        }

        if (!StringUtils.isEmpty(subsystem)) {
            return getProducerAPI().getAllProducersBySubsystem(subsystem, intervalName, timeUnit, true);
        }

        return getProducerAPI().getAllProducers(intervalName, timeUnit, true);
    }
684687
public Long getUpdateTimestamp(String intervalName){
		return intervalName == null ? Long.valueOf(0) : intervalUpdateTimestamp.get(intervalName);
	}
677083
protected String generateSnapshotId(String spaceId, long timestamp) {
        SnapshotIdentifier snapshotIdentifier =
            new SnapshotIdentifier(dcAccountName, dcStoreId, spaceId, timestamp);
        return snapshotIdentifier.getSnapshotId();
    }
1188884
public static ProducerDecoratorBean filterProducersByDecoratorName(String decoratorName, List<ProducerAO> producers, Map<String, GraphDataBean> graphData) {
        ProducerDecoratorBean result = new ProducerDecoratorBean();
        result.setName(decoratorName);

        List<ProducerAO> decoratedProducers = new ArrayList<>();
        for (ProducerAO producer : producers) {
            IDecorator decorator = findOrCreateDecorator(producer);
            if (decorator.getName().equals(decoratorName)) {
                result.setCaptions(decorator.getCaptions());
                decoratedProducers.add(producer);

                // Filling graph data
                for (StatLineAO statLine : producer.getLines()) {
                    if (!"cumulated".equals(statLine.getStatName())) {
                        for (StatValueAO statValue : statLine.getValues()) {
                            final String graphKey = decorator.getName() + '_' + statValue.getName();
                            final GraphDataValueBean value = new GraphDataValueBean(producer.getProducerId() + '.' + statLine.getStatName(), statValue.getRawValue());

                            GraphDataBean graphDataBean = graphData.get(graphKey);
                            if (graphDataBean == null) {
                                graphDataBean = new GraphDataBean(decorator.getName() + '_' + statValue.getJsVariableName(), statValue.getName());
                            }

                            graphDataBean.addValue(value);
                            graphData.put(graphKey, graphDataBean);
                        }
                    }
                }
            }
        }

        result.setProducerBeans(decoratedProducers);

        return result;
    }
432491
public static <T> ComposableFuture<T> buildLazy(final Producer<T> producer) {
    return LazyComposableFuture.build(producer);
  }