From: Chuck H. <ch...@gl...> - 2010-09-22 17:41:04
|
On Sep 22, 2010, at 7:27 AM, Ricardo J. Parada wrote: > > Maybe I don't understand the code but it seems to me that the _lastMilliseconds i-var in ERXAdaptorChannelDelegate.java should be a ThreadLocal or something like that. I don't think that ThreadLocal is what you want, but that does not look like it will work well with multiple EOF stacks. The whole static ivar for a delegate seems suspicious. I think it would be better off with: // Remove this line: private static ERXAdaptorChannelDelegate _delegate; public static void setupDelegate() { // Remove this line: _delegate = new ERXAdaptorChannelDelegate(); NSNotificationCenter.defaultCenter().addObserver(_delegate, new NSSelector("dataBaseChannelNeeded", ERXConstant.NotificationClassArray), EODatabaseContext.DatabaseChannelNeededNotification, null); } // Remove this method: public static ERXAdaptorChannelDelegate delegate() { return _delegate; } public void dataBaseChannelNeeded(NSNotification n) { if (ERXProperties.booleanForKeyWithDefault("er.extensions.ERXAdaptorChannelDelegate.enabled", false)) { EODatabaseContext context = (EODatabaseContext) n.object(); EODatabaseChannel channel = new EODatabaseChannel(context); context.registerChannel(channel); // Change this line: channel.adaptorChannel().setDelegate(new ERXAdaptorChannelDelegate()); } } > Just think of one thread calling adaptorChannelShouldEvaluateExpression() and recording _lastMilliseconds and before adaptorChannelDidEvaluateExpression() gets called the second thread then calls adaptorChannelShouldEvaluateExpression() thereby overwriting the _lastMilliseconds set by the first thread. Remember that both threads have their own EOF stack so it's not like one it's going to wait until the evaluate expression of the first one is completed. They are running concurrently. They have concurrent database access. > > And I'm ignoring the collect statements SQL in ERXAdaptorChannelDelegate logic for now since I'm not using that. > > Anyways, any thoughts? Try the changes above and see if they work. Chuck > On Sep 21, 2010, at 12:35 PM, Kieran Kelleher wrote: > >> If you are using MySQL, you can/should verify using the slow query log to be sure it is not your database-schema/server-load. >> >> >> On Sep 21, 2010, at 11:56 AM, Ricardo J. Parada wrote: >> >>> Hi All, >>> >>> I have an app without a GUI that creates two threads named performWork and performLifebeatUpdate. Each thread has its own EOF stack so they can work concurrently. The first thread executes queries that sometimes can take a long time and records results (primary keys of the records returned, number of records returned, etc.). The second thread is simply doing an update of a single record in the database every 15 seconds with a current timestamp as a way to say: I'm alive. >>> >>> Anyways, I turned on Wonder slow SQL logging but I'm not sure it is working right. It seems to be reporting the performLifebeatUpdate is taking long when I think it is the performWork thread the one taking long because some of the queries can be long as they are created by a user. >>> >>> Ok, so my question is, will the slow SQL logging work with this configuration? I see that ERXAdaptorChannelDelegate has a _lastMilliseconds i-var which is set by the adaptorChannelShouldEvaluateExpression() delegate method. But if the same ERXAdpatorChannelDelegate is used for all the adaptor channels, I'm wondering how this works in my configuration when you have two threads and each thread has its own EOF stack and work concurrently. >>> >>> Does anybody have an idea if Wonder's slow SQL logging as implemented by ERXAdaptorChannelDelegate works in this configuration? >>> >>> Thanks, >>> Ricardo >>> >>> >>> ------------------------------------------------------------------------------ >>> Start uncovering the many advantages of virtual appliances >>> and start using them to simplify application deployment and >>> accelerate your shift to cloud computing. >>> http://p.sf.net/sfu/novell-sfdev2dev >>> _______________________________________________ >>> Wonder-disc mailing list >>> Won...@li... >>> https://lists.sourceforge.net/lists/listinfo/wonder-disc >> > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev_______________________________________________ > Wonder-disc mailing list > Won...@li... > https://lists.sourceforge.net/lists/listinfo/wonder-disc -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects |