4949
5050public class CcmBridge implements AutoCloseable {
5151
52- private static final Logger logger = LoggerFactory .getLogger (CcmBridge .class );
53-
54- private final int [] nodes ;
55-
56- private final Path configDirectory ;
57-
58- private final AtomicBoolean started = new AtomicBoolean ();
59-
60- private final AtomicBoolean created = new AtomicBoolean ();
61-
62- private final String ipPrefix ;
63-
64- private final Map <String , Object > cassandraConfiguration ;
65- private final Map <String , Object > dseConfiguration ;
66- private final List <String > rawDseYaml ;
67- private final List <String > createOptions ;
68- private final List <String > dseWorkloads ;
69-
70- private final String jvmArgs ;
52+ private static final Logger LOG = LoggerFactory .getLogger (CcmBridge .class );
7153
7254 public static final Version VERSION =
73- Objects .requireNonNull (Version .parse (System .getProperty ("ccm.version" , "3.11 .0" )));
55+ Objects .requireNonNull (Version .parse (System .getProperty ("ccm.version" , "4.0 .0" )));
7456
7557 public static final String INSTALL_DIRECTORY = System .getProperty ("ccm.directory" );
7658
@@ -126,6 +108,26 @@ public class CcmBridge implements AutoCloseable {
126108 private static final Version V3_0_15 = Version .parse ("3.0.15" );
127109 private static final Version V2_1_19 = Version .parse ("2.1.19" );
128110
111+ static {
112+ if (DSE_ENABLEMENT ) {
113+ LOG .info ("CCM Bridge configured with DSE version {}" , VERSION );
114+ } else {
115+ LOG .info ("CCM Bridge configured with Apache Cassandra version {}" , VERSION );
116+ }
117+ }
118+
119+ private final int [] nodes ;
120+ private final Path configDirectory ;
121+ private final AtomicBoolean started = new AtomicBoolean ();
122+ private final AtomicBoolean created = new AtomicBoolean ();
123+ private final String ipPrefix ;
124+ private final Map <String , Object > cassandraConfiguration ;
125+ private final Map <String , Object > dseConfiguration ;
126+ private final List <String > rawDseYaml ;
127+ private final List <String > createOptions ;
128+ private final List <String > dseWorkloads ;
129+ private final String jvmArgs ;
130+
129131 private CcmBridge (
130132 Path configDirectory ,
131133 int [] nodes ,
@@ -141,10 +143,7 @@ private CcmBridge(
141143 // Hack to ensure that the default DC is always called 'dc1': pass a list ('-nX:0') even if
142144 // there is only one DC (with '-nX', CCM configures `SimpleSnitch`, which hard-codes the name
143145 // to 'datacenter1')
144- int [] tmp = new int [2 ];
145- tmp [0 ] = nodes [0 ];
146- tmp [1 ] = 0 ;
147- this .nodes = tmp ;
146+ this .nodes = new int [] {nodes [0 ], 0 };
148147 } else {
149148 this .nodes = nodes ;
150149 }
@@ -351,27 +350,27 @@ private void executeCheckLogError() {
351350
352351 private void execute (CommandLine cli , boolean forceErrorLogging ) {
353352 if (forceErrorLogging ) {
354- logger .error ("Executing: " + cli );
353+ LOG .error ("Executing: " + cli );
355354 } else {
356- logger .debug ("Executing: " + cli );
355+ LOG .debug ("Executing: " + cli );
357356 }
358357 ExecuteWatchdog watchDog = new ExecuteWatchdog (TimeUnit .MINUTES .toMillis (10 ));
359358 try (LogOutputStream outStream =
360359 new LogOutputStream () {
361360 @ Override
362361 protected void processLine (String line , int logLevel ) {
363362 if (forceErrorLogging ) {
364- logger .error ("ccmout> {}" , line );
363+ LOG .error ("ccmout> {}" , line );
365364 } else {
366- logger .debug ("ccmout> {}" , line );
365+ LOG .debug ("ccmout> {}" , line );
367366 }
368367 }
369368 };
370369 LogOutputStream errStream =
371370 new LogOutputStream () {
372371 @ Override
373372 protected void processLine (String line , int logLevel ) {
374- logger .error ("ccmerr> {}" , line );
373+ LOG .error ("ccmerr> {}" , line );
375374 }
376375 }) {
377376 Executor executor = new DefaultExecutor ();
@@ -381,8 +380,7 @@ protected void processLine(String line, int logLevel) {
381380
382381 int retValue = executor .execute (cli );
383382 if (retValue != 0 ) {
384- logger .error (
385- "Non-zero exit code ({}) returned from executing ccm command: {}" , retValue , cli );
383+ LOG .error ("Non-zero exit code ({}) returned from executing ccm command: {}" , retValue , cli );
386384 }
387385 } catch (IOException ex ) {
388386 if (watchDog .killedProcess ()) {
@@ -413,7 +411,7 @@ private static File createTempStore(String storePath) {
413411 f .deleteOnExit ();
414412 Resources .copy (CcmBridge .class .getResource (storePath ), os );
415413 } catch (IOException e ) {
416- logger .warn ("Failure to write keystore, SSL-enabled servers may fail to start." , e );
414+ LOG .warn ("Failure to write keystore, SSL-enabled servers may fail to start." , e );
417415 }
418416 return f ;
419417 }
0 commit comments