/** * Binds an object and a naming context. * * @param obj Object to bind with naming context * @param context Associated naming context instance */ public static void bindContext(Object obj, Context context) { bindContext(obj, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Binds an object and a naming context. * * @param obj Object to bind with naming context * @param context Associated naming context instance */ public static void bindContext(Object obj, Context context) { bindContext(obj, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
public TomcatThreadContextListener() { ContextBindings.bindContext(OPENEJB_CONTEXT, new OpenEJBContext()); try { // someone decided to make the getThreadName package protected so we have to use reflection method = ContextBindings.class.getDeclaredMethod("getThreadName"); method.setAccessible(true); } catch (NoSuchMethodException e) { logger.error("Expected ContextBinding to have the method getThreadName()"); } }
/** * Creates a new instance. */ public TomcatThreadContextListener() { ContextBindings.bindContext(OPENEJB_CONTEXT, new OpenEJBContext()); try { // someone decided to make the getThreadName package protected so we have to use reflection method = ContextBindings.class.getDeclaredMethod("getThreadName"); method.setAccessible(true); final Field threadNameBindingsField = ContextBindings.class.getDeclaredField("threadObjectBindings"); threadNameBindingsField.setAccessible(true); threadNameBindings = (Hashtable<Thread, Object>) threadNameBindingsField.get(null); } catch (final Exception e) { logger.error("Expected ContextBinding to have the method getThreadName()"); } }
/** * Creates a new instance. */ public TomcatThreadContextListener() { ContextBindings.bindContext(OPENEJB_CONTEXT, new OpenEJBContext()); boolean accessible = false; try { // someone decided to make the getThreadName package protected so we have to use reflection method = ContextBindings.class.getDeclaredMethod("getThreadName"); // accessible = method.isAccessible(); method.setAccessible(true); } catch (NoSuchMethodException e) { logger.error("Expected ContextBinding to have the method getThreadName()"); // } finally { // if (!accessible) { // method.setAccessible(accessible); // } } }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
ContextBindings.bindContext(ICName, initialContext);
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }