I am on a project that has had many developers before I came to it. When it was put together, everything was made static so I can not extend anything.
The program takes commands from a front end (different language) via a Socket and then does things and / or sends back messages.
Since I could not extend the existing system, I made a new project and created an interface between the old and the new packages. One of the things the new software does is listen to MIDI messages over a cable. In order to keep the native cable from failing with a single long running
Thread, I configured the Threading as so :
Once this code runs, all other Threads seem to be blocked. In the pre-existing packages, there are a series of TimerTasks that run to do things like play a WAV sound for counting off song starts (e.g. "1" tick tick "2" tick tick "Set" tick tick "Go" tick tick and then the player I built starts playing and the listener I built start processing MIDI messages and sending them back to the front end. Now the TimerTasks never run.
Again, the TimerTask (and other Threads) are in the pre-existing packages. The new listener and player (and a few other things) are in the new packages. I know that my listeners are ready and working because I can press keys on my instrument and hear the notes play through my computer speakers (and output log messages from within the Thread). I also know that all the other Threads are blocked and not dead because if they were dead, my listener / player would be gone and I'd have ServerSocket error logs as well as other sorts of errors. I get no errors. The other Threads just seem to suspend.
I suspect that what is happening is that my run() method has become a long-running method that the main is waiting to complete and then blocking everything else while it's not complete. But, I'd love to know if I'm right on that or not. To fix this, do I have to make a Singleton and submit all my Runnables to it and have it add them to the Executor framework? I would rather not get into refactoring all that static code if I can avoid it. Is there some easy solution to this?
[EDITED: Typos]