Package org.opennms.netmgt.newts
Class NewtsWriter
- java.lang.Object
-
- org.opennms.netmgt.newts.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 theSampleRepository. 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 Summary
Constructors Constructor Description NewtsWriter(Integer maxBatchSize, Integer ringBufferSize, Integer numWriterThreads, com.codahale.metrics.MetricRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voidindex(List<org.opennms.newts.api.Sample> samples)voidinsert(List<org.opennms.newts.api.Sample> samples)voidonEvent(SampleBatchEvent event)voidsetIndexer(org.opennms.newts.api.search.Indexer indexer)voidsetSampleRepository(org.opennms.newts.api.SampleRepository sampleRepository)
-
-
-
Method Detail
-
destroy
public void destroy() throws Exception- Specified by:
destroyin interfaceorg.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)
-
onEvent
public void onEvent(SampleBatchEvent event) throws Exception
- Specified by:
onEventin interfacecom.lmax.disruptor.WorkHandler<SampleBatchEvent>- Throws:
Exception
-
setSampleRepository
public void setSampleRepository(org.opennms.newts.api.SampleRepository sampleRepository)
-
setIndexer
public void setIndexer(org.opennms.newts.api.search.Indexer indexer)
-
-