Class NewtsWriter

  • All Implemented Interfaces:
    com.lmax.disruptor.WorkHandler<SampleBatchEvent>, org.springframework.beans.factory.DisposableBean

    public class NewtsWriter
    extends Object
    implements com.lmax.disruptor.WorkHandler<SampleBatchEvent>, org.springframework.beans.factory.DisposableBean
    Used to write samples to the SampleRepository. Calls to #insert() publish the samples to a ring buffer so that they don't block while the data is being persisted.
    Author:
    jwhite
    • Constructor Detail

      • NewtsWriter

        @Inject
        public NewtsWriter​(@Named("newts.max_batch_size")
                           Integer maxBatchSize,
                           @Named("newts.ring_buffer_size")
                           Integer ringBufferSize,
                           @Named("newts.writer_threads")
                           Integer numWriterThreads,
                           @Named("newtsMetricRegistry")
                           com.codahale.metrics.MetricRegistry registry)
    • Method Detail

      • destroy

        public void destroy()
                     throws Exception
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        Exception
      • insert

        public void insert​(List<org.opennms.newts.api.Sample> samples)
      • index

        public void index​(List<org.opennms.newts.api.Sample> samples)
      • setSampleRepository

        public void setSampleRepository​(org.opennms.newts.api.SampleRepository sampleRepository)
      • setIndexer

        public void setIndexer​(org.opennms.newts.api.search.Indexer indexer)