Fix unnecessary application of Math.abs()

This commit is contained in:
Trustin Lee 2012-05-10 21:56:10 +09:00
parent b4764f6164
commit 532672deae

View File

@ -42,10 +42,13 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
* non-negative integers are allowed.
*/
private static Integer allocateId(Channel channel) {
int idVal = -Math.abs(System.identityHashCode(channel));
if (idVal >= 0) {
int idVal = System.identityHashCode(channel);
if (idVal > 0) {
idVal = -idVal;
} else if (idVal == 0) {
idVal = -1;
}
Integer id;
for (;;) {
id = Integer.valueOf(idVal);