@@ -90,7 +90,6 @@ public class ServiceManager {
90
90
/**
91
91
* This block restores the PolyphenyDbProcess on startup by checking the PID file. It will create a PolyphenyDbProcess
92
92
* from the PID if the file contains a PID number. Then it will check if the process is still alive.
93
- *
94
93
* TODO: This is maybe not required since we start a child process. By the termination of this process usually the child
95
94
* processes are terminated too. However, if later on there is another way of creating the Polypheny-DB process this
96
95
* static block would be more relevant (I guess).
@@ -151,7 +150,7 @@ public static boolean start( final ClientCommunicationStream clientCommunication
151
150
152
151
153
152
public static boolean start ( final ClientCommunicationStream clientCommunicationStream , final boolean startTailers ) {
154
- return start ( clientCommunicationStream , true , "" );
153
+ return start ( clientCommunicationStream , startTailers , "" );
155
154
}
156
155
157
156
@@ -192,10 +191,10 @@ public static boolean start( final ClientCommunicationStream clientCommunication
192
191
193
192
// Build list of arguments
194
193
List <String > pdbArguments = new LinkedList <>();
195
- if ( pdbmsArgs .trim ().length () > 0 ) {
194
+ if ( ! pdbmsArgs .trim ().isEmpty () ) {
196
195
pdbArguments .addAll ( Arrays .asList ( pdbmsArgs .split ( " " ) ) );
197
196
}
198
- if ( additionalArguments .trim ().length () > 0 ) {
197
+ if ( ! additionalArguments .trim ().isEmpty () ) {
199
198
pdbArguments .addAll ( Arrays .asList ( additionalArguments .split ( " " ) ) );
200
199
}
201
200
if ( configuration .getString ( "pcrtl.plugins.purge" ).equals ( "onStartup" ) ) {
@@ -256,21 +255,33 @@ public static boolean start( final ClientCommunicationStream clientCommunication
256
255
final Logger PDB_LOGGER = LoggerFactory .getLogger ( "PDB" );
257
256
258
257
if ( logTailer != null ) {
259
- logTailer .stop ();
258
+ logTailer .close ();
260
259
}
261
260
if ( clientCommunicationStream != null ) {
262
- logTailer = new Tailer ( new File ( logFile ), new LogTailerListener ( PDB_LOGGER ::info , clientCommunicationStream ::send ) );
261
+ logTailer = Tailer .builder ()
262
+ .setFile ( new File ( logFile ) )
263
+ .setTailerListener ( new LogTailerListener ( PDB_LOGGER ::info , clientCommunicationStream ::send ) )
264
+ .get ();
263
265
} else {
264
- logTailer = new Tailer ( new File ( logFile ), new LogTailerListener ( PDB_LOGGER ::info ) );
266
+ logTailer = Tailer .builder ()
267
+ .setFile ( new File ( logFile ) )
268
+ .setTailerListener ( new LogTailerListener ( PDB_LOGGER ::info ) )
269
+ .get ();
265
270
}
266
271
267
272
if ( errTailer != null ) {
268
- errTailer .stop ();
273
+ errTailer .close ();
269
274
}
270
275
if ( clientCommunicationStream != null ) {
271
- errTailer = new Tailer ( new File ( errFile ), new LogTailerListener ( PDB_LOGGER ::info , clientCommunicationStream ::send ) );
276
+ errTailer = Tailer .builder ()
277
+ .setFile ( new File ( errFile ) )
278
+ .setTailerListener ( new LogTailerListener ( PDB_LOGGER ::info , clientCommunicationStream ::send ) )
279
+ .get ();
272
280
} else {
273
- errTailer = new Tailer ( new File ( errFile ), new LogTailerListener ( PDB_LOGGER ::info ) );
281
+ errTailer = Tailer .builder ()
282
+ .setFile ( new File ( errFile ) )
283
+ .setTailerListener ( new LogTailerListener ( PDB_LOGGER ::info ) )
284
+ .get ();
274
285
}
275
286
276
287
if ( startTailers ) {
@@ -316,13 +327,13 @@ public static boolean stop( final ClientCommunicationStream clientCommunicationS
316
327
317
328
polyphenyDbProcess = null ;
318
329
319
- // Stopping std out redirectors
330
+ // Stopping std out redirections
320
331
if ( logTailer != null ) {
321
- logTailer .stop ();
332
+ logTailer .close ();
322
333
}
323
334
logTailer = null ;
324
335
if ( errTailer != null ) {
325
- errTailer .stop ();
336
+ errTailer .close ();
326
337
}
327
338
errTailer = null ;
328
339
@@ -1031,7 +1042,7 @@ public void fileNotFound() {
1031
1042
consumer .accept ( "> !! The log file was not found. Stopping the Tailer. !!" );
1032
1043
}
1033
1044
}
1034
- this .tailer .stop ();
1045
+ this .tailer .close ();
1035
1046
}
1036
1047
1037
1048
@@ -1062,7 +1073,7 @@ public void handle( Exception e ) {
1062
1073
for ( Consumer <String > consumer : consumers ) {
1063
1074
consumer .accept ( "> !! Exception occurred: " + e .getMessage () + ". Stopping the Tailer. !!" );
1064
1075
}
1065
- this .tailer .stop ();
1076
+ this .tailer .close ();
1066
1077
}
1067
1078
}
1068
1079
}
0 commit comments