[ 
https://issues.apache.org/jira/browse/DERBY-6885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15256391#comment-15256391
 ] 

ASF subversion and git services commented on DERBY-6885:
--------------------------------------------------------

Commit 1740842 from [~knutanders] in branch 'code/trunk'
[ https://svn.apache.org/r1740842 ]

DERBY-6885: Remove ReuseFactory

The methods getInteger(), getShort(), getByte(), getLong() and
getBoolean() are now simple wrappers around Integer.valueOf(),
Short.valueOf(), and so on. They no longer have any purpose, and can
be removed. Callers can either call the corresponding valueOf() method
directly or rely on auto-boxing (which use valueOf() implicitly).

The remaining method, getZeroLenByteArray(), which returns a static
instance of an empty byte array, is replaced with a static final field
in the ArrayUtil class.

> Remove ReuseFactory
> -------------------
>
>                 Key: DERBY-6885
>                 URL: https://issues.apache.org/jira/browse/DERBY-6885
>             Project: Derby
>          Issue Type: Improvement
>          Components: Services
>    Affects Versions: 10.13.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d6885.diff
>
>
> ReuseFactory used to help reduce object allocations when converting 
> numbers/booleans from primitive types to object types. After DERBY-2383 and 
> DERBY-6230, the ReuseFactory methods are just wrappers around standard 
> library methods such as Integer.valueOf() and Long.valueOf().
> Callers could just as easily call the corresponding valueOf() method 
> directly, or rely on auto-boxing. Both ways use the same cache as 
> ReuseFactory currently does, so ReuseFactory has no purpose anymore.
> One exception: ReuseFactory.getZeroLenByteArray() is still used and provides 
> value, as it avoids the allocation cost when an empty byte array is needed. 
> The ArrayUtil class is probably just as good a home for it, so I propose we 
> move it there and remove the ReuseFactory class.



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

Reply via email to