Bounded buffer java implementation