accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Elser (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ACCUMULO-4067) TTimeoutTransport repeatedly uses reflection to obtain method
Date Mon, 30 Nov 2015 17:21:11 GMT
Josh Elser created ACCUMULO-4067:
------------------------------------

             Summary: TTimeoutTransport repeatedly uses reflection to obtain method
                 Key: ACCUMULO-4067
                 URL: https://issues.apache.org/jira/browse/ACCUMULO-4067
             Project: Accumulo
          Issue Type: Improvement
          Components: rpc
            Reporter: Josh Elser
            Priority: Critical
             Fix For: 1.6.5, 1.7.1, 1.8.0


Noticed the following in TTimeoutTransport while looking at ACCUMULO-4065:

{code}
  private static InputStream getInputStream(Socket socket, long timeout) {
    try {
      Method m = NetUtils.class.getMethod("getInputStream", Socket.class, Long.TYPE);
      return (InputStream) m.invoke(null, socket, timeout);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
{code}

We should really just invoke {{getMethod}} once and cache the {{Method}} instance instead
of repeatedly getting it every time we create a new connection (which is often).

Not sure if this is a "hot" enough code path to have a noticeable performance impact, but
it should be good to fix regardless.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message