Very Lazy Web: Static Analysis to Detect Blocking Operations
Wouldn't it rock if there was a tool to do static analysis of arbitrary code amenable to static analysis (such as Java) to detect and point out places that will block a thread?
Wouldn't it be double cool if the typical places where there is no choice (say, JDBC) vendors would provide non-blocking extensions?
Almost makes me want to write an async postgresql driver...
/me wonders why the Python community is so far ahead of the Java community on this one.
writebacks...
Bill Scherlis (CMU) and Bill Pugh (UMD) have been working on stuff like this. See , , etc.
Disappearing links, huzzah. See http://findbugs.sourceforge.net/ and http://www.surelogic.com/ and if this fails I'll mail you.
Annotations could be a solution.
I was thinking about how to do this the other day. Have you ever seen the @NotNull annotations from IntelliJ? Basically they are custom annotations for methods. If you annotate a method as @NotNull and it is possible for that method to return null, then it's flagged as an error. If you call a method that is tagged @Null and you call that method don't have null checks on the returned value then you get an error. If you do have null checks on a value returned from a method tagged @NotNull then IntelliJ warns you that it's not really neccessary. This idea could be extended to blocking. We could have two annotations: @MayBlock and @NonBlocking. Say you annotate an method as @NonBlocking but it calls methods tagged @MayBlock then you get an error in the IDE. If you tag a method as @NonBlocking but makes use of synchronised, wait or a native method then you get an error. Of course you'd need some way back-porting annotations on the standard libraries.
markup?
Dube, what's your markup scheme here? There should be in some guidance when writing a comment, as I find paragraphs are a good thing(tm).
Re: Markup
Markup schyeme is basically -- strip everything... :-( One of these days I need to upgrade to some new blogging software, but if wishes were fshes I would have spare cycles... or something like that.
Ok
See also http://www.eecs.harvard.edu/~mdw/proj/seda/ In MySQL you can do INSERT DELAYED (http://dev.mysql.com/doc/refman/5.0/en/insert-delayed.html) which is kind of async (although not at the JDBC level obviously). I don't think Postgres has anything equivalent. How useful it is is debatable anyway - I'm guessing updates are a bigger problem than inserts?
INSERT DELAYED
Nick: I am referring mostly to IO, but the ability to let the database defer something to a convenient time is awesome!
comment...