接口 JndiCallback<T>

  • 类型参数:
    T - the resulting object type
    函数接口:
    这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

    @FunctionalInterface
    public interface JndiCallback<T>
    Callback interface to be implemented by classes that need to perform an operation (such as a lookup) in a JNDI context. This callback approach is valuable in simplifying error handling, which is performed by the JndiTemplate class. This is a similar to JdbcTemplate's approach.

    Note that there is hardly any need to implement this callback interface, as JndiTemplate provides all usual JNDI operations via convenience methods.

    作者:
    Rod Johnson
    另请参阅:
    JndiTemplate, JdbcTemplate
    • 方法详细资料

      • doInContext

        @Nullable
        T doInContext​(Context ctx)
               throws NamingException
        Do something with the given JNDI context.

        Implementations don't need to worry about error handling or cleanup, as the JndiTemplate class will handle this.

        参数:
        ctx - the current JNDI context
        返回:
        a result object, or null
        抛出:
        NamingException - if thrown by JNDI methods