There is a problem in your consumer readLines() method. It returns immediately if input is not ready:
if (!rdr.ready()) { return Collections.emptyList(); } The producer and consumer run concurrently, and thus the consumer will start before the producer has generated any output. If you comment out the above lines, then your readLines() method will block in the read loop until input is available: while (true) { String line = rdr.readLine(); — Derek On 3 Nov 2014, at 13:31, Jan Winter <jan.winter.leip...@gmail.com> wrote: > Hello gogo.runtime experts, > > I have a syncronisation problem in gogo-runtime(0.10.0). > > I have 2 gogo commands 'producer' and 'consumer' (@see attached > Gogo_syncProblem.java > <http://apache-felix.18485.x6.nabble.com/file/n5010375/Gogo_syncProblem.java> > > ). > > 1) 'producer( optionalSecToWait )' produce 3 lines (line 1, line 2, line 3) > 2) 'consumer()' consume any line from System.in and print this out to > System.out > > Random observation by 'producer | consumer' > - sometimes 3 lines are printed > - sometimes NOT > > *FIX:* Closure.public synchronized Object executeStatement(...) > - Than 3 lines printed always. > > > > > -- > View this message in context: > http://apache-felix.18485.x6.nabble.com/gogo-runtime-0-10-Closure-executeStatement-methode-should-be-syncronized-tp5010375.html > Sent from the Apache Felix - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org >