On Thu, 2017-02-02 at 14:47 -0800, Kevin Dorff wrote:
> Hi,
>
> I tried to search Google (and here) for others reporting this or a
> similar
> problem but had no obvious success.
Google is not the fount of all knowledge, only much of it. ;-)
> I am attempting to write Spock unit tests for a class which contains
> a
> method that contains .eachParallel run within a GParsPool.withPool
> stanza.
> It seems that if I Spy the class (similar to Mock, so I can do
> partial
> mocking of the class) any calls to .eachParallel will hang the test
> suite.
So there are two players here Spy and GPars…
> I have created a simple example and set of simple Spock test cases
> which
> demonstrate what I am seeing (and that if I call .each instead of
> .eachParallel it works just fine).
> In my repo, the failing test cases are marked as *@Ignore* because
… given the test "Test with calc as spy, add a number and a list of
numbers (parallel)" works fine if I replace:
calc = Spy(Calc)
with
calc = new Calc()
the the Spy class is doing something that is incompatible with GPars
threadpool. I think there is a deadlock occurring. Since the tests work
without the Spy proxy, it isn't a GPars problem it's a Spy problem: Spy
is not a transparent proxy as you are trying to use it.
On a more constructive, rather than blame assigning note, I am not sure
how we can progress this with any speed, at least from the GPars end.
Towards the end of this month I had been hoping to get GPars 2.0
released (basically GPars 1.3.0-SNAPSHOT but with all the ParallelArray
stuff removed). It is not clear just at the moment if GPars 1.3.0 will
ever be released.
It is not entirely clear just now if eachParallel will exist in GPars
2.0, especially since Stream.forEach exists – it is not clear if the
old GPars API should be preserved or whether people should just use
Streams things directly.
In this case, constructing an array by side effect as being done here
is probably a bad design – at least as shown here. However that may be
the nature of the strip down. The reasons this is bad code are many
and varied, and require a separate essay. :-)
--
Russel.
=============================================================================
Dr Russel Winder t:
+44 20 7585 2200 voip:
sip:russel...@ekiga.net
41 Buckmaster Road m:
+44 7770 465 077 xmpp:
rus...@winder.org.uk
London SW11 1EN, UK w:
www.russel.org.uk skype: russel_winder