Article Discussion
From JavaOne 2009: On Trust and Types
Summary: The JVM's promise of write once, run anywhere works most of the time. But it can also make programmers complacent about cases where the WORA promise fails, says Gwyn Fisher, CTO of Klocwork, maker of the eponymous code analysis tool. One such case is resource management, where the JVM's latent garbage collector necessitates that developers think about the machine behind the VM. In this interview with Artima, Fisher describes cases where well-known Java APIs work differently based on deployment platform, and how well-defined type systems can make resource management more reliable:
31 posts on 3 pages.      
« Previous 1 2 3 Next »
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: October 6, 2009 0:43 PM by art
art
Posts: 4 / Nickname: articulate / Registered: September 19, 2005 8:54 AM
Re: From JavaOne 2009: On Trust and Types
October 6, 2009 0:43 PM      
I think the real time community is more sophisticated than enterprise developers in this area. For example pre-emption - if a higher priority request arrives, a lower priority request that holds required resources could be pre-empted, and their resource released for the high priority user. I have not supplied a priority, and a timeout to file open in any environment I have used.

I notice static types adding complexity to solutions where a closure returns values. I don't see types adding anything in this area. I do see features like closures, ThreadLocal, and aspects (AOP) helping centralize resource management.

Each use point of API's like java.sql and java.io must manage resources by calling close.

Spring lets you use many paradigms for solving these problems, including using closure like objects, annotations on functions, and helper functions for special cases.

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ch12s02.html#jdbc-JdbcTemplate

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ch10s05.html#transaction-declarative-annotations

Solutions where a separate thread does resource cleanup, like garbage collection, have to be able to stall a thread which makes an allocation request, when resources are exhausted, and do a clean up. It seems like a complicated solution. An explicitly parallel resource server where one server processes close and open might work better.
31 posts on 3 pages.
« Previous 1 2 3 Next »