--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/390304ad-7817-404a-8cde-7c3f184b9f22%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/390304ad-7817-404a-8cde-7c3f184b9f22%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/34504009-012e-4ee8-bf05-b9f9962235a1%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/CAJVB4jdUSVxNXe-P0qEcaa3218xQ7LV1Z7tN7BTbWL7KCdfVrw%40mail.gmail.com.
Actually I like Luis's idea much better Adam, as it opens the possibility of opening closures to the rest of the language. However, if you don't wish to do a closure like Luis suggested, then the next option would be to add a callback function like you suggested Adam.That is why closures are fun..
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/cf01899a-3f40-44c0-99e7-f911c9c4c5fd%40googlegroups.com.
Thanks Adam I am very well aware of what the differences are, it was a slip and I thought I had deleted the word callback when I rewrote that section of text.
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/447c21c5-c8f5-4d0e-bdf5-9600afdafc69%40googlegroups.com.
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/82c73a1a-643b-44bf-9c17-b2cdd522d381%40googlegroups.com.
Basically any operation that can block a network or local resource. Imagine doing this:fileRead( file, function(contents){process file here in the background once it is read.});
Luis: Did you try to implement non-blocking I/O with existing CFML yet?
You could maintain a queue that contains the callback obj info and then in onRequestEnd, you call a function that finds a completed queue unit and executes the callback method for it. This would allow everything to happen out of order at the end of the request similar to how node.js does it. I already made an asynchronous query system like this before, but I didn't think to implement a callback function as well, it would be pretty easy to do that as well.
Your framework could also have a way of setting up a group of these queued work units and the group would have its own callback function in addition to the individual work units having an optional callback.
At the end of all these callbacks, you'd execute the rest of onRequestEnd to finish off the request.
In some requests, it may be possible to pre-process some of the returned data before you need to have all of them ready at the same time, so you would improve performance in these areas as you begin to work in this style. Since I love performance, I will probably try to implement what I'm saying for my app.
You also need to build a system that limits the number of concurrent access to a shared resource in a specific way. Like you don't want to have 100 requests connect via CFHTTP to the same domain at the same time probably. You could make it part of the framework to limit threads globally. A framework is probably not going to want to ask its user to directly call CFHTTP anyway even if it did have the closure features, because you're going to want to augment its features somehow.
I wrote out how to do some of these things in detail with CFML in the last few days.
File I/O api was already improved in the past to waste less memory and block less if you want to do that, but we still don't have a detailed API for working with database and http in a streaming way. I don't like how much memory / cpu time is wasted from that either. cfquery lazy="true" almost fixed the database access, but I think it still stores a complete resultset after the loop is complete. It would be more efficient if it could discard the memory for the rows you already looped somehow. CFML database access uses more memory then many other languages just so you can access the data out of order? We almost never need the database data to be looped backwards or something...
I think you are missing the point that when a callback is sent then the engine should do the io operation in a separate thread thus continuing operation from the file read. Thus anything after would execute immediately and the engine spawns a thread to read the file and then call your callback once done. Therefore it won't block.
Bruce. That's a great project. Maybe a ColdBox module would be awesome for it?
However the concept of tasks is already available via the jcf ( java concurrent framework ) in all jdks. Marc esher has a cfconcurrent project already.
However, why not expose this java functionality directly as well. Where you can create task CFCs and send them to cf for processing like the executor and scheduler service in java already.
Now I know we can leverage cfthread and dynamic proxies to accomplish some of these things. However concurrency is such a complex topic that I think it is an area where CFML can come and save the day. Maybe even provide special concurrent locking shared scopes, scheduling, monitoring, thread and task pools, timeouts, etc.
I would love to see something like
Function operation() timeout=20{}
How cool would it be if the engine allowed us to provide timeouts for function calls.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/414075544-1382246889-cardhu_decombobulator_blackberry.rim.net-1288356286-%40b12.c20.bise6.blackberry.
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/6ee6cb9d-18cb-45d7-9d55-475d302a4a01%40googlegroups.com.
AdamI think you are missing the point that when a callback is sent then the engine should do the io operation in a separate thread thus continuing operation from the file read. Thus anything after would execute immediately and the engine spawns a thread to read the file and then call your callback once done. Therefore it won't block.
Especially the thing is that CFTHREAD type=”task” allows you to check your task manager inside the Railo Administrator in order to see whether your tasks have completed successfully (nothing to see) or whether they have failed. There is an additional attribute called retryinterval which takes either an array of structs or a struct containing the two keys interval (timespan) and tries (numeric) so that you can define a custom retry interval schedule if the task fails.
This is a perfect solution for stuff you need to make sure works…
Greetings from Switzerland
Gert Franz
The Railo Company Ltd. Professional Open Source
skype: gert.franz ge...@getrailo.com
+41 76 5680 231 www.getrailo.com
The Railo Company – Poland Street 15 – London W1F 8QE – United Kingdom
Company No. 8055066 – VAT Registration No. 150 4060 58
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/33e26e41-fce7-44c3-ac77-1ecda0e96ea2%40googlegroups.com.
If we can compare to other languages in this age, we must provide some type of non-blocking IO operations natively into the language. I propose adding closure callback support to the following functions/operations so they can be processed natively in the background (non-blocking) and then call back when done.FileReadFileWritecfqueryhttpcffeed/feedcfmail/mailstoredprocftp
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/4158c114-6746-4201-a37b-4cf5788284b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
We will also add the tag cftask to Railo 5 (light way version of cfthread-task).