I have a java app with two different threads that does the following thing:
1.The first thread(which is a ThreadPool)- Listens to one port for incoming connections from five different users.
Let's call them :
user1 user2 user3 user4 user5
each of them sending GPS data.
2.The second thread In the same time my java app listens to a second port where waits for another client(different from those who send GPS data) to connect to it.
Now...I have a second app that connects to the java app that I've just described it.
In this second app I have a list user1...user5 and depending on which item I will choose(user1...5) I have to receive the correct data from the user I pick. Also all this data will be stored at the second user in a DB.
Now can anyone give me a hint of how could I share all this data between the threads ????
I tried with Singleton classes and also with BlockingQ but seems none of these are suitable cause the data gets lost!