hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Lipcon (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8218) RPC.closeProxy shouldn't throw error when closing a mock
Date Tue, 27 Mar 2012 02:31:26 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-8218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239121#comment-13239121

Todd Lipcon commented on HADOOP-8218:

I see three options:
1) Anywhere we call RPC.closeProxy, we check "if (foo instanceof Closeable) { ... } " first.
But, that defeats the whole purpose of throwing the exception when we pass non-closeables,
so we might as well just revert the behavior back to the original rather than does this.
2) In RPC.closeProxy, if the object doesn't implement Closeable, check if the proxy is a mock
object. We can do this by looking for the string "EnhancerByMockitoWithCGLIB" in the class
name. If we see that, pass through.
3) Anywhere we mock out an IPC protocol, we could use the syntax {{mock(FooProtocol.class,
withSettings().extraInterfaces(Closeable.class));}}. I am not a fan of this, since it leaks
the issue out to all of the test code, rather than localizing the workaround in the one place
that matters. Plus, newer users of the mock framework won't know this advanced usage syntax
(I had to google for a while to figure it out)

So, I plan to implement #2.
> RPC.closeProxy shouldn't throw error when closing a mock
> --------------------------------------------------------
>                 Key: HADOOP-8218
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8218
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: ipc, test
>    Affects Versions: 0.24.0
>            Reporter: Todd Lipcon
>            Assignee: Todd Lipcon
>            Priority: Critical
> HADOOP-8202 changed the behavior of RPC.stopProxy() to throw an exception if called on
an object which doesn't implement Closeable. Unfortunately, we use mock objects in many test
cases, and those mocks don't implement Closeable. This is causing TestZKFailoverController
to fail in trunk, for example.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message