bindLater + HttpClientPool + NPE

3 views
Skip to first unread message

javaguy44

unread,
Nov 13, 2011, 4:38:45 PM11/13/11
to Groovy++
Hi,

I'm using groovypp and gretty, which are both great libraries.

Unfortunately I'm looking for an example of HttpClientPool & bindLater
with a local variable I want to access in the GrettyHttpResponse.
Currently my local var is null. As an example:

MimeMessage message = mail.message

httpClientPool.allocateResource() { it ->
GrettyClient grettyClient = it
GrettyHttpRequest grettyHttpRequest = new
GrettyHttpRequest("/")

grettyClient.request(grettyHttpRequest,
httpClientPool.executor) { responseBindLater ->
GrettyHttpResponse grettyHttpResponse =
responseBindLater.get()
println("message=${message}")
httpClientPool.releaseResource(grettyClient)
}
}

In this example, the variable message is null in the pringln statement
after I get the GrettyHttpResponse. In normal java / Swing
invokeLater, marking message as final is enough. However I'm not sure
how to bind in this case

Would appreciate an example / advice!

Thanks
Reply all
Reply to author
Forward
0 new messages