You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Creat Wiser instance and start the server by calling wiser.start().
2. Call wiser.stop() to stop the SMTPServer.
3. Call wiser.start() on the same instance to start the SMTPServer again.
What is the expected output? What do you see instead?
The SMTPServer should be started again, but the second call of the
wiser.start() throws the "java.lang.IllegalStateException: SMTPServer can only
be started once", because is started flag is not set to false in the
stop-method.
What version of the product are you using? On what operating system?
3.1.7
Original issue reported on code.google.com by [email protected] on 3 Feb 2015 at 12:28
The text was updated successfully, but these errors were encountered:
When you start the server with wiser.start(), an inner flag 'started' is set to true in the SMTPServer class; this one is not set to false when you stop the server with wiser.stop().
// True if this SMTPServer was started. It remains true even if the SMTPServer has been stopped since
@GuardedBy("this")
private boolean started = false;
It seems to be a deliberate comportment.
You have to instanciate a new server each time you want to create a new one.
wiser.start() // create a new server
wiser.stop() // stop the server and release resources (close sockets...)
wiser = new Wiser(port); // create a new one
This is what I do in Clojure, using reflection, it is super hacky but it works so I wonder whether a PR would be effective here.
;; AR - workaround - don't do this at home
(let [{:keys [server]} state
field (doto (.. server getClass (getDeclaredField "executorService")) (.setAccessible true))
executor-svc (. field (get server))]
(.stop server)
(.shutdownNow executor-svc))
Original issue reported on code.google.com by
[email protected]
on 3 Feb 2015 at 12:28The text was updated successfully, but these errors were encountered: