protected void delay(BindingSession session) { session.writeLock(); try { int delayTime = session.get(DELAY_TIME, -1); if (delayTime < 0) { if (LOG.isInfoEnabled()) { LOG.info("No delay time configured."); } return; } Object lastExcution = session.get(LAST_EXECUTION); if (lastExcution instanceof Long) { long lastExcutionLong = (Long) lastExcution; long now = System.currentTimeMillis(); if (now - lastExcutionLong < delayTime) { try { Thread.sleep(delayTime - (now - lastExcutionLong)); } catch (InterruptedException e) { if (LOG.isDebugEnabled()) { LOG.debug("Interrupted sleep", e); } } } } session.put(LAST_EXECUTION, System.currentTimeMillis()); } finally { session.writeUnlock(); } }
protected void delay(BindingSession session) { session.writeLock(); try { int delayTime = session.get(DELAY_TIME, -1); if (delayTime < 0) { if (LOG.isInfoEnabled()) { LOG.info("No delay time configured."); } return; } Object lastExcution = session.get(LAST_EXECUTION); if (lastExcution instanceof Long) { long lastExcutionLong = (Long) lastExcution; long now = System.currentTimeMillis(); if (now - lastExcutionLong < delayTime) { try { Thread.sleep(delayTime - (now - lastExcutionLong)); } catch (InterruptedException e) { if (LOG.isDebugEnabled()) { LOG.debug("Interrupted sleep", e); } } } } session.put(LAST_EXECUTION, System.currentTimeMillis()); } finally { session.writeUnlock(); } }
@Override public void close() { checkSession(); session.writeLock(); try { CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.close(); } finally { session.writeUnlock(); session = null; } }
@Override public void close() { checkSession(); session.writeLock(); try { CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.close(); } finally { session.writeUnlock(); session = null; } }
session.writeLock(); try { httpclient = (OkHttpClient) session.get(HTTP_CLIENT);
session.writeLock(); try { httpclient = (OkHttpClient) session.get(HTTP_CLIENT);
session.writeLock(); try { httpclient = (DefaultHttpClient) session.get(HTTP_CLIENT);
@Override public void clearAllCaches() { checkSession(); session.writeLock(); try { session.put(CmisBindingsHelper.REPOSITORY_INFO_CACHE, new RepositoryInfoCache(session)); TypeDefinitionCache typeDefCache = CmisBindingsHelper.getTypeDefinitionCache(session); typeDefCache.removeAll(); CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.clearAllCaches(); } finally { session.writeUnlock(); } }
@Override public void clearAllCaches() { checkSession(); session.writeLock(); try { session.put(CmisBindingsHelper.REPOSITORY_INFO_CACHE, new RepositoryInfoCache(session)); TypeDefinitionCache typeDefCache = CmisBindingsHelper.getTypeDefinitionCache(session); typeDefCache.removeAll(); CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.clearAllCaches(); } finally { session.writeUnlock(); } }
@Override public void clearRepositoryCache(String repositoryId) { checkSession(); if (repositoryId == null) { return; } session.writeLock(); try { RepositoryInfoCache repInfoCache = (RepositoryInfoCache) session .get(CmisBindingsHelper.REPOSITORY_INFO_CACHE); repInfoCache.remove(repositoryId); TypeDefinitionCache typeDefCache = CmisBindingsHelper.getTypeDefinitionCache(session); typeDefCache.remove(repositoryId); CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.clearRepositoryCache(repositoryId); } finally { session.writeUnlock(); } }
@Override public void clearRepositoryCache(String repositoryId) { checkSession(); if (repositoryId == null) { return; } session.writeLock(); try { RepositoryInfoCache repInfoCache = (RepositoryInfoCache) session .get(CmisBindingsHelper.REPOSITORY_INFO_CACHE); repInfoCache.remove(repositoryId); TypeDefinitionCache typeDefCache = CmisBindingsHelper.getTypeDefinitionCache(session); typeDefCache.remove(repositoryId); CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.clearRepositoryCache(repositoryId); } finally { session.writeUnlock(); } }