Posts

Showing posts from January, 2009

J2EE/Java Grips 1: Websphere is garbage, OMFG 1

I was debugging a websphere/RAD issue, thinking that maybe I had messed up a configuration way down in the cellar of RAD's infinite supply of configurations. Maybe the flux-capacitor node mx3e cell.xml missed the rptptppt_Vn_ setting. No my friends, RAD seemed to have bombed on a missing servlet tag in the web.xml. NPE, NullPointer on not having the most basic setting in a J2EE app. Don't get me wrong, a developer should have the setting, but something more helpful like 'You are missing your servlet mapping' would have been helpful. here is the configuration and the error. < servlet-mapping > < servlet-name >OnlineServlet</ servlet-name > < url-pattern >/OnlineServlet</ url-pattern > </ servlet-mapping > ------ [ 1/26/09 23:30:14:166 EST ] 00000047 SystemOut O Caused by: java.lang.NullPointerException at com.ibm.ws.wswebcontainer.webapp.WebAppConfigurationHelper.constructServletMappings(WebAppCo

Simple Agents/Concurrent Programming in Clojure

Image
"All concurrency issues boil down to coordinating access to mutable state. The less mutable state, the easier it is to ensure thread safety." -- Java Concurrency in Practice (from Bill Clementson's blog) Like Erlang, Clojure is becoming a very powerful concurrent oriented language. It is designed to be a simple language making it easier to coordinate access to resources. "Agents provide independent, asynchronous change of individual locations. Agents are bound to a single storage location for their lifetime, and only allow mutation of that location (to a new state) to occur as a result of an action" -- http://clojure.org/agents Here is a simple example of two agent functions 'agent' and 'send': ;; ;; Simple example of agents (concurrent coding) in Clojure ;; The send function waits/hangs and then returns the result. ;; ;; Note: only the calls to 'Thread.sleep' in the main program ;; block the main thread. ;; @see http://clojure.or