From: Pete Lewin-H. <pe...@il...> - 2004-09-09 12:56:21
|
Kal, I haven't gone into any detail about where all the calls are, but a grep for newIDGenerator returns 21 matches across the codebase. The most nefarious of these is in the instantiation of the org.tm4j.topicmap.hibernate.TopicMapFactoryImpl class, which is called every time the topic map is retrieved via the tmapi getTopicMap() method. This is the one that is causing most problems for me, but I'm sure there are others... If you like, I can mail you the updated IDGeneratorFactory and IDGeneratorImpl classes which can just be plugged in and seem to work fine. cheers, Pete ----- Original Message ----- From: "Kal Ahmed" <ka...@te...> To: "Pete Lewin-Harris" <pe...@il...> Cc: <tm4...@li...> Sent: Thursday, September 09, 2004 1:03 PM Subject: Re: [Tm4j-developers] ID Generators > 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 > > > > ------------------------------------------------------- > 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 > > |