Open GoogleCodeExporter opened 9 years ago
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
Hope these few explanations will help you.
Hello! I read on this line: https://github.com/voodoodyne/subethasmtp/blob/master/src/main/java/org/subethamail/smtp/server/SMTPServer.java#L72
that the thread pool cannot be restarted...isn't ExecutorServices.shutdownNow
an option?
Would you accept a PR to make the server fully stoppable/reloadable?
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
beast.sh...@gmail.com
on 3 Feb 2015 at 12:28