#4 Attribute cacheing via <run>?

closed
nobody
None
5
2009-02-24
2008-12-02
Austin Hastings
No

This job:
<sequential name = "Machines in DEVINT cluster"
>
<set>
<!-- Overrides for local testing -->
<value name = "on-devint.url"
value = "service:jmx:rmi:///jndi/rmi://localhost:${deployment/vars.rmi-port}/oddjob"
/>
<value name = "server.url"
value = "service:jmx:rmi:///jndi/rmi://localhost:${deployment/vars.rmi-port}/oddjob"
/>
</set>
<echo text = "Server url = ${server.url}" />
<wait pause = "10000" />
<echo text = "Server url = ${server.url}" />
<wait for = "${rmireg}" />
<echo text = "Server url = ${server.url}" />
<run job = "${server}" />
<echo text = "Server url = ${server.url}" />

Produces this output:

Server url = service:jmx:rmi:///jndi/rmi://localhost:/oddjob
Server url = service:jmx:rmi:///jndi/rmi://localhost:/oddjob
Server url = service:jmx:rmi:///jndi/rmi://localhost:/oddjob
Server url = service:jmx:rmi:///jndi/rmi://devint:9996/oddjob

Notice that the final line is different. The server url is specified in the file as devint:9996, and the <set> task was supposed to change it. In fact, it appeared to change it, but when the <run> job actually executed the <server>, the url is back to the bad old version.

I haven't tried to follow this through the source, so I don't know what is going on, but this example is all running on a single box -- there's no client/server set up (the <server> task is supposed to do that).

Whatever it is, I'm pretty sure it's wrong.

Discussion

  • Rob Gordon
    Rob Gordon
    2009-02-24

    When a job runs it is re-configured which means any ${} values are reset. This overrides what is set with set.

    Probably a better solution would be do have:
    <server url="service:jmx:rmi:///jndi/rmi://${deployment/vars.host}:{$deployment/vars.port}/oddjob"/>

    where a variables job or custom bean with id 'vars' is in the nested oddjob of id 'deployment'.

     
  • Rob Gordon
    Rob Gordon
    2009-02-24

    • status: open --> closed