Following servlet filter worked for me:

@WebFilter("/*")
public class OrientDBFilter implements Filter {

    @Inject
    OrientDbProducers odbProducer;

    @Inject
    Log log;

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain) throws ServletException {

        try {
            chain.doFilter(request, response);
        } catch (IOException e) {
            throw new ServletException(e);
        } finally {

            ODatabaseDocumentInternal database = ODatabaseRecordThreadLocal.
INSTANCE.getIfDefined();
            if (database != null) {

                database.close();
                ODatabaseRecordThreadLocal.INSTANCE.remove();
            }
        }
    }

    @Override
    public void destroy() {

        odbProducer.getGraphFactory().close();
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }

}


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to