Put it anywhere you want <G>. Here's a good place to start: http://www.javapractices.com/topic/TopicAction.do?Id=46 where the distributePresents method is the one you have that returns the connection.
Here's a sample class that doesn't do much... public enum MyEnum { INSTANCE; private String _tester = ""; public void doStuff(String stuff) { if (_tester.length() == 0) { _tester = stuff; System.out.println("In initialization"); } System.out.println("Tester is " + _tester + " Stuff is " + stuff); } } you can imagine doStuff as getConnection with logic to initialize the connection where the string _tester is defined. Now you can call it from anywhere the enum is available like this: public class MyMain { public static void main(String[] args) { MyEnum.INSTANCE.doStuff("first time"); MyEnum.INSTANCE.doStuff("second time"); MyEnum.INSTANCE.doStuff("third time"); } } Best Erick On Thu, Aug 25, 2011 at 9:43 AM, samuele.mattiuzzo <samum...@gmail.com> wrote: > since i'm barely new to solr, can you please give some guidelines or provide > an example i can look at for starters? > > i already tought about a singleton implementation, but i'm not sure where i > have to put it and how should i start coding it > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Solr-indexing-process-keep-a-persistent-Mysql-connection-throu-all-the-indexing-process-tp3278608p3283901.html > Sent from the Solr - User mailing list archive at Nabble.com. >