@OnStopped public void stop() { try { smtp.stop(); getLogger().debug("Stopped SMTP server on port " + smtp.getPort()); }catch (Exception ex){ getLogger().error("Error stopping SMTP server: " + ex.getMessage()); }finally { smtp = null; } }
private void configure() { when(configuration.getSmtpHost()).thenReturn("localhost"); when(configuration.getSmtpPort()).thenReturn(smtpServer.getServer().getPort()); when(configuration.getFrom()).thenReturn("server@nowhere"); when(configuration.getFromName()).thenReturn("SonarQube from NoWhere"); when(configuration.getPrefix()).thenReturn("[SONARQUBE]"); when(configuration.getServerBaseURL()).thenReturn("http://nemo.sonarsource.org"); }
@Override public void onTrigger(final ProcessContext context, final ProcessSessionFactory sessionFactory) throws ProcessException { if (smtp == null) { try { final SMTPServer server = prepareServer(context, sessionFactory); server.start(); getLogger().debug("Started SMTP Server on port " + server.getPort()); smtp = server; } catch (final Exception ex) {//have to catch exception due to awkward exception handling in subethasmtp smtp = null; getLogger().error("Unable to start SMTP server due to " + ex.getMessage(), ex); } } context.yield();//nothing really to do here since threading managed by smtp server sessions }
@Override public void start() { initSmtpReceiver(); log.info("starting SMTP server on port: " + this.smtpReceivingServer.getPort() + " address: " + this.smtpReceivingServer.getBindAddress()); try { this.smtpReceivingServer.start(); } catch (Throwable e) { throw new RuntimeException("Exception starting SMTP server. port: " + this.smtpReceivingServer.getPort() + " address: " + this.smtpReceivingServer.getBindAddress(), e); } log.info("Geroa email server started."); }
@OnStopped public void stop() { try { smtp.stop(); getLogger().debug("Stopped SMTP server on port " + smtp.getPort()); }catch (Exception ex){ getLogger().error("Error stopping SMTP server: " + ex.getMessage()); }finally { smtp = null; } }
@Override public void onTrigger(final ProcessContext context, final ProcessSessionFactory sessionFactory) throws ProcessException { if (smtp == null) { try { final SMTPServer server = prepareServer(context, sessionFactory); server.start(); getLogger().debug("Started SMTP Server on port " + server.getPort()); smtp = server; } catch (final Exception ex) {//have to catch exception due to awkward exception handling in subethasmtp smtp = null; getLogger().error("Unable to start SMTP server due to " + ex.getMessage(), ex); } } context.yield();//nothing really to do here since threading managed by smtp server sessions }