StoreMsgIn must define synchronized add() and synchronized remove() methods. Messages will be added to the queue using add(). Messages will be removed from the queue using remove() method. XFerMsg must execute in a separate
thread, which regularly calls the remove() method. To reduce the load on the processor use the wait-notify protocol. If at the time of remove() the thread of XFerMsg finds that the queue is empty, then it must go into wait(). Then inside every add() method there must be a notify/notifyAll() to wake up waiting thread/threads.