Search in sources :

Example 1 with EventContext

use of javax.naming.event.EventContext in project hibernate-orm by hibernate.

the class JndiServiceImpl method addListener.

@Override
public void addListener(String jndiName, NamespaceChangeListener listener) {
    final InitialContext initialContext = buildInitialContext();
    final Name name = parseName(jndiName, initialContext);
    try {
        ((EventContext) initialContext).addNamingListener(name, EventContext.OBJECT_SCOPE, listener);
    } catch (Exception e) {
        throw new JndiException("Unable to bind listener to namespace [" + name + "]", e);
    } finally {
        cleanUp(initialContext);
    }
}
Also used : EventContext(javax.naming.event.EventContext) JndiException(org.hibernate.engine.jndi.JndiException) InitialContext(javax.naming.InitialContext) NamingException(javax.naming.NamingException) JndiException(org.hibernate.engine.jndi.JndiException) JndiNameException(org.hibernate.engine.jndi.JndiNameException) InvalidNameException(javax.naming.InvalidNameException) NameNotFoundException(javax.naming.NameNotFoundException) Name(javax.naming.Name)

Aggregations

InitialContext (javax.naming.InitialContext)1 InvalidNameException (javax.naming.InvalidNameException)1 Name (javax.naming.Name)1 NameNotFoundException (javax.naming.NameNotFoundException)1 NamingException (javax.naming.NamingException)1 EventContext (javax.naming.event.EventContext)1 JndiException (org.hibernate.engine.jndi.JndiException)1 JndiNameException (org.hibernate.engine.jndi.JndiNameException)1