Start DMTPListener during MailboxServer startup
This commit is contained in:
parent
44738b51dd
commit
2723ee4555
@ -24,6 +24,8 @@ public class MailboxServer implements IMailboxServer, Runnable {
|
|||||||
private final Shell shell;
|
private final Shell shell;
|
||||||
private final Integer dmtpServerPort;
|
private final Integer dmtpServerPort;
|
||||||
private final Integer dmapServerPort;
|
private final Integer dmapServerPort;
|
||||||
|
private DMTPListener dmtpListener;
|
||||||
|
private DMAPListener dmapListener;
|
||||||
private final ConcurrentHashMap<Email, LinkedList<Message>> messageStorage = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<Email, LinkedList<Message>> messageStorage = new ConcurrentHashMap<>();
|
||||||
private final ConcurrentHashMap<String, String> userStorage = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, String> userStorage = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@ -67,7 +69,8 @@ public class MailboxServer implements IMailboxServer, Runnable {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
// TODO spawn listener for transfer servers (DMTPListener)
|
this.dmtpListener = new DMTPListener(this.dmtpServerSocket, this.messageStorage);
|
||||||
|
this.dmtpListener.start();
|
||||||
// TODO spawn listener for user clients (DMAPListener)
|
// TODO spawn listener for user clients (DMAPListener)
|
||||||
this.shell.run();
|
this.shell.run();
|
||||||
}
|
}
|
||||||
@ -80,6 +83,7 @@ public class MailboxServer implements IMailboxServer, Runnable {
|
|||||||
try {
|
try {
|
||||||
if (dmtpServerSocket != null)
|
if (dmtpServerSocket != null)
|
||||||
dmtpServerSocket.close();
|
dmtpServerSocket.close();
|
||||||
|
this.dmtpListener.interrupt();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.severe("Error closing DMTP serverSocket " + dmtpServerSocket.toString());
|
logger.severe("Error closing DMTP serverSocket " + dmtpServerSocket.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user