Java producer and consumer problem using a ferry boat as an example