commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Osipov <>
Subject Re: [POOL2] Pooling mutable objects
Date Sun, 08 Feb 2015 10:07:59 GMT
Am 2015-02-06 um 22:13 schrieb Matthew Hall:
> On Fri, Feb 06, 2015 at 04:54:25PM +0100, Michael Osipov wrote:
>> This is what I did:
>> this.internalId = RandomStringUtils.randomAlphanumeric(8);
> When doing these types of tricks to assign transaction ID's or serial numbers
> to objects / log messages / etc., I'm more of a fan of using AtomicLong.
> These are handled w/ hardware accelerated instructions, whereas Random
> consumes lots of CPU on a crypto or semi-crypto algorithm for something which
> doesn't actually need to be random, and introduces the possibility of
> collisions, which AtomicLong will prevent, even with many threads.

How would you propose to use it?
I would still need a random number or do you recomment to use a static 
one and simply increment during the lifetime of the application?

If so, thing might cause trouble in the future because I would probably 
store the session information in a database for analysis issues and 
woudl have collisions.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message