2 Replies Latest reply on Feb 13, 2014 3:07 AM by Nicolas Nicolas

    Change dynamically the node selector

    Nicolas Nicolas Newbie

      Hello all,


      I use a JBoss EAP 6.2. I created a custom DeploymentNodeSelector class which does exactly what I want in 99% of the use cases.


      However there is still this 1% and that why I would like to know if it's possible to change the deployment.node.selector value during runtime.


      I can get it (EJBClientContext.getCurrent().getEJBClientConfiguration().getDeploymentNodeSelector()) but I didn't find if it's possible to directly modify it.

      I tried to set value during InitialContext Initialization (jndiProperties.put("deployment.node.selector", "foo.bar.MyNodeSelector");) but it does not work...


      I assume it's not a good practice, but it's only for any tests which have special needs and I don't want to use it in production.


      Any idea?


      Thanks in advance.

        • 1. Re: Change dynamically the node selector
          Wolf-Dieter Fink Master

          Depends on how your client code use the API.

          How the client look like?

          You can find some examples here jboss-as-quickstart/ejb-clients at ejb-clients might be out of date in some examples.

          I suppose you need to have a look to the jboss-api sub-project.


          Also you might use a hack and set a ThreadLocal inside the NodeSelector to control the behaviour for tests.

          1 of 1 people found this helpful
          • 2. Re: Change dynamically the node selector
            Nicolas Nicolas Newbie

            Thanks for your response,

            The examples are interesting.


            In fact, the context is a little bit more complex than I said precendtly.

            Indeed, my JUnit test call a remote SBSL (called EjbTest for example) which has to call another remote SBSL (EjbBusiness).

            The first SBSL can be comparated to a proxy which allows to get the "business SBSL".


            Finally, I think the easier solution is to use two differents DeploymentNodeSelector implementations : one in production and the other in test environment.

            The one used in test will be able to manage all cases thanks to a little hack


            I just have to manage two jboss-ejb-client.xml files.