Lines 276-281
Link Here
|
276 |
shutdown(); |
276 |
shutdown(); |
277 |
} |
277 |
} |
278 |
|
278 |
|
|
|
279 |
@SuppressWarnings("CallToThreadDumpStack") |
279 |
private void shutdown() { |
280 |
private void shutdown() { |
280 |
// this try-catch is only for investigation of the instable test failures |
281 |
// this try-catch is only for investigation of the instable test failures |
281 |
try { |
282 |
try { |
Lines 458-471
Link Here
|
458 |
} |
459 |
} |
459 |
} |
460 |
} |
460 |
|
461 |
|
|
|
462 |
private boolean checkVersion(char version) throws IOException { |
463 |
String versionsString = requestReader.readLine(); |
464 |
if (versionsString == null) { |
465 |
return false; |
466 |
} |
467 |
String versionsPattern = "VERSIONS "; |
468 |
if (!versionsString.startsWith(versionsPattern)) { |
469 |
if (err != null) { |
470 |
err.printf("Protocol error, expected %s, got %s\n", versionsPattern, versionsString); //NOI18N |
471 |
} |
472 |
return false; |
473 |
} |
474 |
String[] versionsArray = versionsString.substring(versionsPattern.length()).split(" "); |
475 |
for (String v : versionsArray) { |
476 |
if (v.length() != 1) { |
477 |
if (err != null) { |
478 |
err.printf("Protocol error: incorrect version format: %s\n", versionsString); //NOI18N |
479 |
} |
480 |
return false; |
481 |
} |
482 |
if (v.charAt(0) == version) { |
483 |
return true; |
484 |
} |
485 |
} |
486 |
return true; |
487 |
} |
488 |
|
461 |
/** |
489 |
/** |
462 |
* Feeds remote controller with the list of files and their lengths |
490 |
* Feeds remote controller with the list of files and their lengths |
463 |
* @return true in the case of success, otherwise false |
491 |
* @return true in the case of success, otherwise false |
464 |
* NB: in the case false is returned, no shutdown will be called |
492 |
* NB: in the case false is returned, no shutdown will be called |
465 |
*/ |
493 |
*/ |
466 |
boolean init() { |
494 |
boolean init() throws IOException { |
467 |
|
495 |
char version = USE_TIMESTAMPS ? '4' : '3'; |
468 |
char version = USE_TIMESTAMPS ? '2' : '1'; |
496 |
if (!checkVersion(version)) { |
|
|
497 |
return false; |
498 |
} |
469 |
logger.log(Level.FINE, "Initialization. Version=%c", version); |
499 |
logger.log(Level.FINE, "Initialization. Version=%c", version); |
470 |
if (CHECK_ALIVE && !ProcessUtils.isAlive(remoteControllerProcess)) { // fixup for remote tests unstable failure (caused by jsch issue) |
500 |
if (CHECK_ALIVE && !ProcessUtils.isAlive(remoteControllerProcess)) { // fixup for remote tests unstable failure (caused by jsch issue) |
471 |
if (err != null) { |
501 |
if (err != null) { |