I agree that multiple Cassandra connections are possible, however, the Cassandra best practice it to only have one per system. So you might have multiple connections to multiple keyspaces within a single cassandra cluster and all those should only use one connection to the cluster. (So sayeth the cassandra documentation). So I was looking for a way to do a single instance of the cluster connection.
I need to spend way more time understanding the intracacies of the assembler pattern. Claude On Mon, Dec 5, 2016 at 3:00 PM, Stian Soiland-Reyes <[email protected]> wrote: > Not sure what you mean by an assembler class.. I guess you mean > https://jena.apache.org/documentation/assembler/index.html > ? > > > Best practice thread-safe singleton pattern in Java is: > > public class Blah { > /* Private constructor, use getInstance() */ > private Blah(); > > private static class Singleton { > // will be late-bound by Singleton's class initializer > private final Blag INSTANCE = new Blah(); > } > > public static Blah getInstance() { > return Singleton.INSTANCE; > } > } > > Then of course any Assembler subclass can just use: > > public class FooAssembler implements Assembler { > private static Blah blah = Blah.getInstance(); > } > > which would then be bound at the first point of constructing > FooAssembler or using FooAssembler static methods. > > > If it's more complicated (your singleton needs another singleton!) you > should rather extends Jena's initialization system so the order is > fixed. > > https://jena.apache.org/documentation/notes/system-initialization.html > > > But to me both of these feel wrong as a Cassandra connection > presuambly is parameterized and could be multiple of - so a singleton > is not quite right. > > On 5 December 2016 at 13:40, Claude Warren <[email protected]> wrote: > > I am looking for a way to create a single instance of an object across a > > number of assembler classes (Specifically a Cassandra connection), is > there > > a standard singleton assembler pattern? If so where can I find it? > > > > Claude > > > > -- > > I like: Like Like - The likeliest place on the web > > <http://like-like.xenei.com> > > LinkedIn: http://www.linkedin.com/in/claudewarren > > > > -- > Stian Soiland-Reyes > http://orcid.org/0000-0001-9842-9718 > -- I like: Like Like - The likeliest place on the web <http://like-like.xenei.com> LinkedIn: http://www.linkedin.com/in/claudewarren
