try { if (!transport.isConnected ()) transport.connect(); } catch (MessagingException e) {  log.error ("Unable to connect transport.", e);
try { if (!transport.isConnected ()) { transport.connect(); } } catch (MessagingException e) {  log.error ("Unable to connect transport.", e);
    public void run () {        while (true) {            try {                if (threadSuspended) {                    synchronized (this) {                        while (threadSuspended)                            this.wait (milliSecondsWaitRunLoop);                    }                }            } catch (InterruptedException e) {		log.warn ("ERMailSender thread has been interrupted.");                threadSuspended = true;                return;            }	    // If there are still messages pending ...	    if (!messages.empty ()) {		Session session     = null;		Transport transport = null;		session   = ERJavaMail.sharedInstance ().newSession ();		transport = this._connectedTransportForSession (session);		try {		    if (!transport.isConnected ())			transport.connect();		} catch (MessagingException e) {		    // Notify error in logs		    log.error ("Unable to connect transport.", e);		    // Exit run loop		    throw new RuntimeException ("Unable to connect transport.");		}		while (!messages.empty ()) {		    ERMessage message = (ERMessage)messages.pop();		    try {			this._sendMessageNow (message, transport);		    } catch (MessagingException e) {			// Here we get all the exceptions that are			// not 'SendFailedException's.			// All we can do is warn the admin.			log.error ("Fatal Messaging Exception. Can't send the mail.", e);		    }		}		try {		    if (transport != null)			transport.close ();		} catch (MessagingException e) /* once again ... */ {		    log.warn ("Unable to close transport.  Perhaps it has already been closed?", e);		}	    }            threadSuspended = true;        }    }