atmosphere icon indicating copy to clipboard operation
atmosphere copied to clipboard

Make Message UUID generator pluggable

Open xenster86 opened this issue 14 years ago • 3 comments

Message id is generated using UUID.randomUUID() which uses SecureRandom and it will be very slow on linux systems when creating many messages :) http://stackoverflow.com/questions/137212/how-to-solve-performance-problem-with-java-securerandom For most cases incremental integer generator will be enough: AtomicLong.incrementAndGet. However, it is possible that in some cases a global unique UUID will be required (in clustered environment?). So it's better to make such generator pluggable.

public interface UidGenerator {
String generate();
}

xenster86 avatar Sep 17 '12 14:09 xenster86

Fixed https://github.com/Atmosphere/atmosphere/commit/725d526d717a316611c76094c79c026d689571fe

jfarcand avatar Jan 08 '15 21:01 jfarcand

The fix isn't complete, BroadcastMessage.java still has UUID.randomUUID() hard coded.

slovdahl avatar Jan 12 '15 18:01 slovdahl

@slovdahl That one can't be changed. Instead the API should be deprecated.

jfarcand avatar Jan 12 '15 18:01 jfarcand