RFR 9: [testbug] 8168613 : CORBA ObjectStreamTest fails with address in use
Paul Sandoz
paul.sandoz at oracle.com
Tue Oct 25 21:18:10 UTC 2016
> On 25 Oct 2016, at 13:50, Roger Riggs <Roger.Riggs at Oracle.com> wrote:
>
> Hi,
>
> On 10/25/2016 4:31 PM, Paul Sandoz wrote:
>> Hi Roger,
>>
>> Do you need to use a double-checked locking idiom in getEchoStub?
> Probably not, I'm just practicing the idiom.
> We are unlikely to move to concurrent test execution in testng (when it supports it).
>>
>> I cannot recall the life-cycle of per test execution, but i suspect you might be able to turn the static field and method getEchoStub into a non-static field and just make the method synchronized, but you might ned to annotate the shutdown with @AfterClass instead.
> That would work too.
>
> What's the rule for choosing synchronized vs volatile? I've gotten different recommendations in different cases.
> What's Occam's razor here?
Double-checked locking requires both :-), so you can safely publish the singleton. It’s generally used when performance is a concern, otherwise i would go for the simpler solution which is more likely to be correct and easier to understand :-)
>>
>> Actually, perhaps even better initiate the ORB and create the stub in a @BeforeClass method and clean up in a @AfterClass method?
> that would work, but it is only used in one of the tests. So just trying to keep the usage localized.
>
Ah, yes, i see.
Paul.
More information about the core-libs-dev
mailing list