ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schall <mike.sch...@gmail.com>
Subject Should IntegerTypeHandler use Integer.valueOf instead of new Integer()
Date Thu, 04 Mar 2010 18:53:54 GMT
I have been doing some performance tuning and looking a heap dumps.
The number of Integer objects in memory is staggering. Looking at the
1.5 java docs, using Integer.valueOf should help.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html#valueOf(int)

This could be extended to most of the number type TypeHandlers in the
2.3.4 code base as it requires Java 1.5.  How is this handled in 3.0?

IntegerTypeHandler (version 2.3.4 )
  public Object getResult(ResultSet rs, String columnName)
      throws SQLException {
    int i = rs.getInt(columnName);
    if (rs.wasNull()) {
      return null;
    } else {
      return new Integer(i);
    }
  }

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message