[ https://issues.apache.org/jira/browse/STORM-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14711519#comment-14711519 ]
ASF GitHub Bot commented on STORM-851: -------------------------------------- Github user hmcl commented on a diff in the pull request: https://github.com/apache/storm/pull/665#discussion_r37883322 --- Diff: external/storm-solr/src/main/java/org/apache/storm/solr/bolt/SolrUpdateBolt.java --- @@ -0,0 +1,107 @@ +package org.apache.storm.solr.bolt; + +import backtype.storm.task.OutputCollector; +import backtype.storm.task.TopologyContext; +import backtype.storm.topology.OutputFieldsDeclarer; +import backtype.storm.tuple.Tuple; +import org.apache.solr.client.solrj.SolrRequest; +import org.apache.solr.client.solrj.SolrServerException; +import org.apache.storm.solr.config.SolrCommitStrategy; +import org.apache.storm.solr.config.SolrConfig; +import org.apache.storm.solr.mapper.SolrMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * Created by hlouro on 7/19/15. + */ +public class SolrUpdateBolt extends AbstractSolrBolt { + private final Logger logger = LoggerFactory.getLogger(SolrUpdateBolt.class); + private final SolrMapper solrMapper; + private final SolrCommitStrategy commitStgy; + private List<Tuple> toCommitTuples; + private final String ackFailLock = "LOCK"; //serializable lock + + + public SolrUpdateBolt(SolrConfig solrConfig, SolrMapper solrMapper) { + this(solrConfig, solrMapper, null); + } + + public SolrUpdateBolt(SolrConfig solrConfig, SolrMapper solrMapper, SolrCommitStrategy commitStgy) { + super(solrConfig); + this.solrMapper = solrMapper; + this.commitStgy = commitStgy; + logger.info("Created {} with the following configuration: " + + "[SolrConfig = {}], [SolrMapper = {}], [CommitStgy = {}]", + this.getClass().getSimpleName(), solrConfig, solrMapper, commitStgy); + } + + @Override + public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { + super.prepare(stormConf, context, collector); + this.toCommitTuples = new LinkedList<>(); --- End diff -- It now uses ArrayList with the correct size at creation, to avoid reallocation overhead. > Storm Solr connector > -------------------- > > Key: STORM-851 > URL: https://issues.apache.org/jira/browse/STORM-851 > Project: Apache Storm > Issue Type: Improvement > Reporter: Sriharsha Chintalapani > Assignee: Hugo Louro > > Storm solr connector should provide bolt and trident implementation to allow > users to index data coming through the topology into solr. -- This message was sent by Atlassian JIRA (v6.3.4#6332)