Maybe set the query time limit at the database

http://stackoverflow.com/questions/5421776/how-can-i-limit-database-query-time-during-web-requests

Ramsey

On Oct 6, 2012, at 12:53 AM, Ricardo Parada wrote:

> Hi All,
> 
> Does EOF have a way to interrupt the thread when it is blocked waiting on the 
> results of evaluateExpression()?
> 
> In JDBC if I have the following code:
> 
>       ResultSet rs = statement.executeQuery(sql);
> 
> and the thread blocks in the executeQuery() waiting for the results then I 
> can have a watch dog thread that I spawned previously with access to the 
> statement and if the elapsed time exceeds a threshold I have the watch dog 
> thread do a statement.cancel() which causes the thread blocked in the 
> executeQuery() to throw a SQLException immediately.  So I can use this 
> mechanism to interrupt the query.
> 
> Is there something similar in EOF?  IF EOF allowed access to the underlying 
> jdbc Statement being executed I'm sure it would be possible.  I see that 
> JDBCChannel has a _statement i-var which holds the Statement object but it is 
> not a public i-var.  Something like a cancel() in the EOAdaptorChannel which 
> called the cancel() in super class (JDBCChannel) which would then call the 
> cancel() to the _statement.  That would be great.  But I don't see such a 
> thing.  EOAdaptorChannel has cancelFetch() but nowhere does it do a 
> _statement.cancel().
> 
> Any ideas?  If there is no way then my workaround would be to use EOF to 
> build the SQL from my qualifiers, etc. and then use JDBC's executeQuery() to 
> process it.  It should not be that bad as I only fetch a single attribute.  
> But the FROM and WHERE clause is where it gets hairy and why I want to use 
> EOF.  It can go so hairy that this is the reason why I want to be able to 
> interrupt it.
> 
> I tried using Thread's stop(t) on the thread blocked on evaluateExpression() 
> but it does not return right away.  It appears that it interrupts the thread 
> until the database server starts sending the results and about to start the 
> fetching.
> 
> Let me know please if anyone has any ideas.
> 
> Thanks,
> Ricardo
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ramseygurley%40gmail.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to