private void releasePersistenceService() { // for now directory sessions are lost during passivation of the DirectoryFacade // this can't be tested on the client side // => release directorySession after each call ... if (directoryService == null) { dirSession = null; return; } if (dirSession != null) { try { dirSession.close(); } catch (DirectoryException e) { // do nothing } } dirSession = null; }
if (session != null) { try { session.close(); } catch (DirectoryException e) {
public DocumentModelList getEntries(String directory) throws ToutaticeException { DocumentModelList entries = null; Session directorySession = null; try { directorySession = getService().open(directory); if (null != directorySession) { entries = directorySession.getEntries(); } else { log.error("Failed to obtain a session to the the directory '" + directory + "'"); } } catch (Exception e) { log.warn("Failed to either get a session to the directory '" + directory + "' or failed to get the entries, error: " + e.getMessage()); throw new ToutaticeException(e); } finally { if (null != directorySession) { try { directorySession.close(); } catch (DirectoryException e) { log.error("Failed to close the session to the directory '" + directory + "', error: " + e.getMessage()); } } } return entries; }
if (null != directorySession) { try { directorySession.close(); } catch (DirectoryException e) { log.error("Failed to close the session to the directory '" + directory + "', error: " + e.getMessage());
try { Session dirSession = dir.getSession(); dirSession.close(); dirName = dir.getName(); } catch (DirectoryException e) {
public DocumentModelList getItems(String directoryName, Map<String, Serializable> filter, Set<String> fulltext, Map<String, String> orderBy) throws ToutaticeException { DocumentModelList items = null; Session session = null; try { session = getService().open(directoryName); } catch (DirectoryException e) { throw new ToutaticeException("could not open session on directory '" + directoryName + "', error: " + e.getMessage()); } if (null != session) { try { items = session.query(filter, fulltext, orderBy); } catch (Exception e) { throw new ToutaticeException("could not query on directory '" + directoryName + "', error: " + e.getMessage()); } finally { try { if (null != session) { session.close(); } } catch (DirectoryException ce) { log.error("Could not close directory session", ce); } } } else { throw new ToutaticeException("could not open session on directory: " + directoryName); } return items; }