final String controllerCreateTypeEncoded = URLEncoder.encode ("#mosaic-components:java-component-container", "UTF-8");
final String controllerCreateConfigurationEncoded = URLEncoder.encode (DefaultJsonCoder.defaultInstance.encodeToString (controllerCreateConfiguration), "UTF-8");
controllerCreateUrlArguments = new String[] {String.format ("type=%s", controllerCreateTypeEncoded), String.format ("configuration=%s", controllerCreateConfigurationEncoded), "count=1"};
}
final ClasspathExporter exporter = ClasspathExporter.create (exporterAddress, classLoader, exceptions);
final SimpleSocketServer appender = new SimpleSocketServer ((LoggerContext) LoggerFactory.getILoggerFactory (), appenderAddress.getPort ());
Threading.registerExitCallback (threading, BasicComponentRemoteLauncher.class, "exit-hook-2", new Runnable () {
@Override
public final void run ()
{
logger.debug ("stopping exporter...");
try {
exporter.stopServer ();
} catch (final Throwable exception) {
exceptions.trace (ExceptionResolution.Ignored, exception);
logger.error ("failed stopping exporter; ignoring!", exception);
}
logger.debug ("sopping appender...");
try {
appender.close ();
} catch (final Throwable exception) {
exceptions.trace (ExceptionResolution.Ignored, exception);
logger.error ("failed stopping appender; ignoring!", exception);
}
}
});
logger.debug ("starting exporter...");
try {
exporter.startServer ();
} catch (final Throwable exception) {
exceptions.trace (ExceptionResolution.Ignored, exception);
logger.error ("failed starting exporter; ignoring!", exception);
throw (new Error (exception));
}
logger.debug ("starting appender...");
try {
appender.start ();
} catch (final Throwable exception) {
exceptions.trace (ExceptionResolution.Ignored, exception);
logger.error ("failed starting appender; ignoring!", exception);
throw (new Error (exception));
}