Hello,
i am currently learning designs in
java. I am working on an application which is like a FTP Client. It has a UI with 3 Panels, one Panel is for start/stop downloading (buttons), one panel represents a JTable which holds 0-n files/directories (with meta information), and one panel holds just a status bar.
When the user adds some files and clicks on "download", the download should start - what it does.
The Metainformation describes how many threads are allowed to download this file/directory.
Now i am going to move to MVP (resp. presenter first) and i am wondering how i should implement the ExecutorService to inform my UI about the current state.
At the moment i have a FtpWorkerPool which encapsulates a ExecutorService, it has 3 methods to add a FtpFile - addFtpFile(FtpFile, TransferListener) - addFtpFile(FtpFile, TransferListener, DetailTransferListener) and addFtpFile(FtpFile)
That does not look good to me, i would prefer to use something like FtpWorkerPool.addListenerForFtpFile(FtpFile, Listener) and now i have the problem:
How should i get to these informations?
I created a
and thought i could access it with
But the queue is always empty? Must i extend the executor service and override the methods which are responsible for adding the jobs, so i can save them in a map (e.g. Map jobs<FtpFile, Listeners>) so i can add listeners later to the jobs?