ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattf <>
Subject Re: How do I share data between custom Ant tasks?
Date Mon, 25 Oct 2010 23:53:01 GMT

I think there are several problems here, but the bottom like is: be upfront
about sharing data, hidden shared data may not give the user the tool they

In the following:
public Integer get_bigdata() {
        if (_static_bigdata == null) {
            log("alloc");  // from ant Task class
            _static_bigdata = new Integer(0);
        return _static_bigdata;

You have unsynchronized lazy init, the "if" block should be synchronized.
(Or use
static {
_static_bigdata = new Integer(0);
for load time init).

That may not solve your problem, but static lazy init blocks should be lock
On your other question, yes if the class is reloaded; the static
initializers will run again.  Consider placing your data into properties. 
This would also allow the user to control the shared data block.

View this message in context:
Sent from the Ant - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message