From: Kal A. <ka...@te...> - 2004-09-09 12:02:24
|
Hi Pete, The newIDGenerator() method should not be getting called that often. In fact, it should really only get called once per application session (so your proposal of storing a single IDGenerator instance makes a lot of sense). I guess I can just grep the code for where newIDGenerator() is getting invoked - but if you have any pointers to the offending callers, that would be handy! Cheers, Kal On Thu, 2004-09-09 at 10:15, Pete Lewin-Harris wrote: > Hi, > > I have discovered a bit of weird behaviour in the id generator factory and > was wondering what the reasoning behind may be. Whenever the > IDGeneratorFactory.newIDGenerator() method is called, a completely new > IDGeneratorImpl object is constructed, which involes a Thread.sleep(100) > call being made.In my performance tests, this means that approximately 50% > of the time spend in TM4J is spent sleeping which really can't be good! > > I have rewritten the IDGeneratorFactory and IDGeneratorImpl classes so the > Factory stores a singleton IDGenerator object and the Generator returns a > random 32 character string (and the getID() method is synchronized). This > results in a massive performance benefit and seems to have no impact on > anything else. > > Anyone got any reasons why this is a bad idea? I haven't run the junit > tests so I may have missed something vital... > > cheers, Pete > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Tm4j-developers mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-developers -- Kal Ahmed <ka...@te...> techquila |