How to check jndi bind / unbind status?

I am looking for a way to check the binding status of an object and the corresponding jndi name.

For example, I have a ldap jms queue name: "/TheRootContext/SomeSubContext/SOME.QUEUE.NAME:queue"

I need to check that there is a corresponding queue, and it is attached to the passed name.

What would be the right way to check the binding status?

I see an algorithm like this:

  • Search jndi to ensure that the specified name exists.

    Object obj = ctx.lookup ("/TheRootContext/SomeSubContext/SOME.QUEUE.NAME: queue");

  • % I don’t know what to do next% , but I suggest something like checking that:

    obj! = null && & obj instanceof javax.jms.Queue

Am I right? What is the right way?

+3
1
+1

Source: https://habr.com/ru/post/1796246/


All Articles