Pushes all metrics in a Collector, replacing all those with the same job and instance.
<p>
This is useful for pushing a single Gauge.
<p>
This uses the PUT HTTP method.
@deprecated use {@link #push(Collector, String, Map)}
437942
@Deprecated
  public void push(Collector collector, String job, String instance) throws IOException {
    push(collector, job, Collections.singletonMap("instance", instance));
  }
811518
@Override
  public void merge(MtasDataCollector<?, ?> newDataCollector,
      Map<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map,
      boolean increaseSourceNumber) throws IOException {
    closeNewList();
    if (!collectorType.equals(newDataCollector.getCollectorType())
        || !dataType.equals(newDataCollector.getDataType())
        || !statsType.equals(newDataCollector.getStatsType())
        || !(newDataCollector instanceof MtasDataAdvanced)) {
      throw new IOException("cannot merge different dataCollectors");
    } else {
      segmentRegistration = null;
      @SuppressWarnings("unchecked")
      MtasDataAdvanced<T1, T2> newMtasDataAdvanced = (MtasDataAdvanced<T1, T2>) newDataCollector;
      newMtasDataAdvanced.closeNewList();
      initNewList(newMtasDataAdvanced.getSize());
      if (collectorType.equals(DataCollector.COLLECTOR_TYPE_LIST)) {
        map.put(newDataCollector, this);
        for (int i = 0; i < newMtasDataAdvanced.getSize(); i++) {
          MtasDataCollector<?, ?>[] subCollectors = new MtasDataCollector[1];
          subCollectors[0] = add(newMtasDataAdvanced.keyList[i],
              increaseSourceNumber);
          setError(newCurrentPosition, newMtasDataAdvanced.errorNumber[i],
              newMtasDataAdvanced.errorList[i], newCurrentExisting);
          setValue(newCurrentPosition,
              newMtasDataAdvanced.advancedValueSumList[i],
              newMtasDataAdvanced.advancedValueSumOfLogsList[i],
              newMtasDataAdvanced.advancedValueSumOfSquaresList[i],
              newMtasDataAdvanced.advancedValueMinList[i],
              newMtasDataAdvanced.advancedValueMaxList[i],
              newMtasDataAdvanced.advancedValueNList[i], newCurrentExisting);
          if (hasSub() && newMtasDataAdvanced.hasSub()) {
            subCollectors[0].merge(
                newMtasDataAdvanced.subCollectorListNextLevel[i], map,
                increaseSourceNumber);
          }
        }
        closeNewList();
      } else if (collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) {
        map.put(newDataCollector, this);
        if (newMtasDataAdvanced.getSize() > 0) {
          MtasDataCollector<?, ?> subCollector = add(increaseSourceNumber);
          setError(newCurrentPosition, newMtasDataAdvanced.errorNumber[0],
              newMtasDataAdvanced.errorList[0], newCurrentExisting);
          setValue(newCurrentPosition,
              newMtasDataAdvanced.advancedValueSumList[0],
              newMtasDataAdvanced.advancedValueSumOfLogsList[0],
              newMtasDataAdvanced.advancedValueSumOfSquaresList[0],
              newMtasDataAdvanced.advancedValueMinList[0],
              newMtasDataAdvanced.advancedValueMaxList[0],
              newMtasDataAdvanced.advancedValueNList[0], newCurrentExisting);
          if (hasSub() && newMtasDataAdvanced.hasSub()) {
            subCollector.merge(newMtasDataAdvanced.subCollectorNextLevel, map,
                increaseSourceNumber);
          }
        }
        closeNewList();
      } else {
        throw new IOException("cannot merge " + collectorType);
      }
    }
  }
1197419
@Override
  public void merge(MtasDataCollector<?, ?> newDataCollector,
      Map<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map,
      boolean increaseSourceNumber) throws IOException {
    closeNewList();
    if (!collectorType.equals(newDataCollector.getCollectorType())
        || !dataType.equals(newDataCollector.getDataType())
        || !statsType.equals(newDataCollector.getStatsType())
        || !(newDataCollector instanceof MtasDataBasic)) {
      throw new IOException("cannot merge different dataCollectors");
    } else {
      segmentRegistration = null;
      @SuppressWarnings("unchecked")
      MtasDataBasic<T1, T2> newMtasDataBasic = (MtasDataBasic<T1, T2>) newDataCollector;
      newMtasDataBasic.closeNewList();
      initNewList(newMtasDataBasic.getSize());
      if (collectorType.equals(DataCollector.COLLECTOR_TYPE_LIST)) {
        map.put(newDataCollector, this);
        for (int i = 0; i < newMtasDataBasic.getSize(); i++) {
          MtasDataCollector<?, ?>[] subCollectors = new MtasDataCollector[1];
          subCollectors[0] = add(newMtasDataBasic.keyList[i],
              increaseSourceNumber);
          setError(newCurrentPosition, newMtasDataBasic.errorNumber[i],
              newMtasDataBasic.errorList[i], newCurrentExisting);
          setValue(newCurrentPosition, newMtasDataBasic.basicValueSumList[i],
              newMtasDataBasic.basicValueNList[i], newCurrentExisting);
          if (hasSub() && newMtasDataBasic.hasSub()) {
            // single key implies exactly one subCollector if hasSub
            subCollectors[0].merge(
                newMtasDataBasic.subCollectorListNextLevel[i], map,
                increaseSourceNumber);
          }
        }
        closeNewList();
      } else if (collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) {
        map.put(newDataCollector, this);
        if (newMtasDataBasic.getSize() > 0) {
          MtasDataCollector<?, ?> subCollector = add(increaseSourceNumber);
          setError(newCurrentPosition, newMtasDataBasic.errorNumber[0],
              newMtasDataBasic.errorList[0], newCurrentExisting);
          setValue(newCurrentPosition, newMtasDataBasic.basicValueSumList[0],
              newMtasDataBasic.basicValueNList[0], newCurrentExisting);
          if (hasSub() && newMtasDataBasic.hasSub()) {
            subCollector.merge(newMtasDataBasic.subCollectorNextLevel, map,
                increaseSourceNumber);
          }
        }
        closeNewList();
      } else {
        throw new IOException("cannot merge " + collectorType);
      }
    }
  }
162144
public void pushContextData(){
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "pushContextData");
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Setting the original thread's class loader and saving off the current one");
        }
        //Set the original Context Class Loader
        this.currentCL = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
            public ClassLoader run() {
                ClassLoader cl = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(originalCL);
                return cl;
            }
        });
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Saving the current thread's context data");
        }
        //We are going to save off the current threads component metadata and context
        //We will restore this when we pop later on
        this.currentCD = saveContextData();
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Setting the original thread's context data : " + this.originalCD);
        }
        if (this.originalCD != null) {

            //Push the data onto the thread that we have hooks into
            ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
            ComponentMetaData cmd = (ComponentMetaData) this.originalCD.get(ComponentMetaData);
            if (cmd != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Calling begin on the ComponentMetaData : " + cmdai + ", with : " + cmd);
                }
                cmdai.beginContext(cmd);
            }
            
            //Each producer service of the Transfer service is accessed in order to get the thread context data
          Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
          if (TransferIterator != null) {
            while(TransferIterator.hasNext()){
              ITransferContextService tcs = TransferIterator.next();
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Calling restoreState on: " + tcs);
              }
              tcs.restoreState(this.originalCD);
            }
          }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "pushContextData");
        }
    }
232781
@SuppressWarnings("unchecked")
	public <T> void unlink(PushMeasure<T> measure) {
		MeasureListener<T> listener = (MeasureListener<T>) linkedMeasures
				.get(measure);
		if (listener == null) {
			// no registered listener
		} else {
			measure.unregister(listener);
			linkedMeasures.remove(measure);
		}
	}
1303871
public int flush(final MetricSender sender) throws IOException, HttpException {
		Preconditions.checkNotNull(sender);
				
		// aggregate metrics that were enqueued before the current minute
		
		long currentMinute = (System.currentTimeMillis() / MS_IN_MIN) * MS_IN_MIN;
		
		LOGGER.debug("Flushing metrics < {}", currentMinute);
		LOGGER.debug("Metrics queue size {}", queue.size());
		
		MetricAggregator aggregator = new MetricAggregator(currentMinute, lastValues);
		
		while ((!queue.isEmpty()) && (queue.peek().getOccurredMillis() < currentMinute)) {
			aggregator.add(queue.remove());
		}

		// handle the auto reports
		
		if (lastFlush < currentMinute) {
			aggregator.autoReportZero(autoReportZeroMetrics);
			aggregator.autoReportLast(autoReportLastMetrics);
		}
		
		lastFlush = currentMinute;
		
		// get the aggregates
		
		List<MetricAggregate> aggregates = aggregator.getAggregates();

		// Save the values of gauge and average metrics for the next iteration
		// Gauge last value = aggregate last value
		// Average last value = aggregate last value / aggregate count
		
		if ((aggregates != null) && (!aggregates.isEmpty())) {
			for (MetricAggregate aggregate : aggregates) {
				if (aggregate.getIdentity().getType().equals(MetricMonitorType.GAUGE)) {
					lastValues.put(aggregate.getIdentity(), aggregate.getValue());
				} else if (aggregate.getIdentity().getType().equals(MetricMonitorType.AVERAGE)) {
					lastValues.put(aggregate.getIdentity(), aggregate.getValue() / aggregate.getCount());
				}
			}
		}
		
		// send the aggregates to Stackify
		
		int numSent = 0;
		
		if ((aggregates != null) && (!aggregates.isEmpty())) {
			LOGGER.debug("Sending aggregate metrics: {}", aggregates);
			sender.send(aggregates);
			numSent = aggregates.size();
		}
		
		return numSent;
	}
114282
def push(self, stream, reading):
        

        # Make sure the stream is correct
        reading = copy.copy(reading)
        reading.stream = stream.encode()

        if stream.buffered:
            output_buffer = stream.output

            if self.id_assigner is not None:
                reading.reading_id = self.id_assigner(stream, reading)

            try:
                self._engine.push(reading)
            except StorageFullError:
                # If we are in fill-stop mode, don't auto erase old data.
                if (stream.output and not self._rollover_streaming) or (not stream.output and not self._rollover_storage):
                    raise

                self._erase_buffer(stream.output)
                self._engine.push(reading)

            for walker in self._queue_walkers:
                # Only notify the walkers that are on this queue
                if walker.selector.output == output_buffer:
                    walker.notify_added(stream)

        # Activate any monitors we have for this stream
        for selector in self._monitors:
            if selector is None or selector.matches(stream):
                for callback in self._monitors[selector]:
                    callback(stream, reading)

        # Virtual streams live only in their walkers, so update each walker
        # that contains this stream.
        for walker in self._virtual_walkers:
            if walker.matches(stream):
                walker.push(stream, reading)

        self._last_values[stream] = reading
852773
def push_all(self, record_shard_pairs):
        
        # Faster than inserting one at a time; the heap is sorted once after all inserts.
        for record, shard in record_shard_pairs:
            item = heap_item(self.clock, record, shard)
            self.heap.append(item)
        heapq.heapify(self.heap)
997629
protected void submit(final double value, final boolean isIncrement) {
		
		MetricCollector collector = MetricManager.getCollector();
		
		if (collector != null) {
			Metric.Builder builder = Metric.newBuilder();
			builder.identity(identity);
			builder.value(value);
			builder.isIncrement(isIncrement);
			
			Metric metric = builder.build();
			
			collector.submit(metric);
		}
	}
571552
public final void pushPair(int v1, int v2)
  {

    if (null == m_map)
    {
      m_map = new int[m_blocksize];
      m_mapSize = m_blocksize;
    }
    else
    {
      if ((m_firstFree + 2) >= m_mapSize)
      {
        m_mapSize += m_blocksize;

        int newMap[] = new int[m_mapSize];

        System.arraycopy(m_map, 0, newMap, 0, m_firstFree);

        m_map = newMap;
      }
    }

    m_map[m_firstFree] = v1;
    m_map[m_firstFree + 1] = v2;
    m_firstFree += 2;
  }
503916
private void pushMetadata(final Map<URI, Map<String, Element>> mapSet) {
        if (!mapSet.isEmpty()) {
            //process map first
            final DitaMapMetaWriter mapInserter = new DitaMapMetaWriter();
            mapInserter.setLogger(logger);
            mapInserter.setJob(job);
            for (final Entry<URI, Map<String, Element>> entry : mapSet.entrySet()) {
                final URI key = stripFragment(entry.getKey());
                final FileInfo fi = job.getFileInfo(key);
                if (fi == null) {
                    logger.error("File " + new File(job.tempDir, key.getPath()) + " was not found.");
                    continue;
                }
                final URI targetFileName = job.tempDirURI.resolve(fi.uri);
                assert targetFileName.isAbsolute();
                if (fi.format != null && ATTR_FORMAT_VALUE_DITAMAP.equals(fi.format)) {
                    mapInserter.setMetaTable(entry.getValue());
                    if (toFile(targetFileName).exists()) {
                        logger.info("Processing " + targetFileName);
                        mapInserter.read(toFile(targetFileName));
                    } else {
                        logger.error("File " + targetFileName + " does not exist");
                    }

                }
            }
            //process topic
            final DitaMetaWriter topicInserter = new DitaMetaWriter();
            topicInserter.setLogger(logger);
            topicInserter.setJob(job);
            for (final Entry<URI, Map<String, Element>> entry : mapSet.entrySet()) {
                final URI key = stripFragment(entry.getKey());
                final FileInfo fi = job.getFileInfo(key);
                if (fi == null) {
                    logger.error("File " + new File(job.tempDir, key.getPath()) + " was not found.");
                    continue;
                }
                final URI targetFileName = job.tempDirURI.resolve(fi.uri);
                assert targetFileName.isAbsolute();
                if (fi.format == null || fi.format.equals(ATTR_FORMAT_VALUE_DITA)) {
                    final String topicid = entry.getKey().getFragment();
                    topicInserter.setTopicId(topicid);
                    topicInserter.setMetaTable(entry.getValue());
                    if (toFile(targetFileName).exists()) {
                        topicInserter.read(toFile(targetFileName));
                    } else {
                        logger.error("File " + targetFileName + " does not exist");
                    }

                }
            }
        }
    }
1080354
@Override
    protected void collectMetrics(final Metrics metrics) {
        for (final JvmMetricsCollector collector : _collectorsEnabled) {
            collector.collect(metrics, _managementFactory);
        }
    }
594809
@Override
    public final void put(Object o) {
        boolean discarded = false;

        if (inactive) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "setting active: " + this);

            // If the pool was marked inactive by the pool manager alarm, then
            // switch it back to active.  Hopefully this happens before too
            // many other threads notice and cause contention with the
            // following sync block.
            inactive = false;

            // If this pool has been inactive long enough to be marked
            // unmanaged, then add it back as managed again.
            synchronized (this) {
                if (!ivManaged) {
                    poolMgr.add(this);
                    ivManaged = true;
                }
            }
        }

        discarded = !buffer.pushWithLimit(o, poolSize.maxSize);

        if (discarded) {
            if (discardStrategy != null) {
                discardStrategy.discard(o);
            }
        }

        if (beanPerf != null) { // Update PMI data
            beanPerf.objectReturn(buffer.size(), discarded);
        }
    }
668641
@Override
    public void putAll(Map<? extends String, ? extends GroovyRunner> m) {
        Map<String, GroovyRunner> map = getMap();
        writeLock.lock();
        try {
            cachedValues = null;
            for (Map.Entry<? extends String, ? extends GroovyRunner> entry : m.entrySet()) {
                if (entry.getKey() != null && entry.getValue() != null) {
                    map.put(entry.getKey(), entry.getValue());
                }
            }
        } finally {
            writeLock.unlock();
        }
    }
720511
public final void push(int value)
  {

    int ff = m_firstFree;

    if ((ff + 1) >= m_mapSize)
    {
      if (null == m_map)
      {
        m_map = new int[m_blocksize];
        m_mapSize = m_blocksize;
      }
      else
      {
        m_mapSize += m_blocksize;

        int newMap[] = new int[m_mapSize];

        System.arraycopy(m_map, 0, newMap, 0, ff + 1);

        m_map = newMap;
      }
    }

    m_map[ff] = value;

    ff++;

    m_firstFree = ff;
  }
218039
public synchronized void pushMetric(final MetricsRecord mr) {
    if (changed) {
      try {
        mr.setMetric(getName(), value);
      } catch (Exception e) {
        LOG.info("pushMetric failed for " + getName() + "\n" +
            StringUtils.stringifyException(e));
      }
    }
    changed = false;
  }
910975
@Deprecated
    public void putAllParameters ()
    {
        Enumeration<?> e = _req.getParameterNames();
        while (e.hasMoreElements()) {
            String param = (String)e.nextElement();
            put(param, _req.getParameter(param));
        }
    }