public static <L, R> Pair<L, R> pair(final L left, final R right) { return of(left, right); }
public static <L, R> Pair<L, R> of(final L left, final R right) { return new Pair<L, R>(left, right); }
private void refreshLocalClassLoader() { Future<Void> execute = bonitaTaskExecutor.execute( inSession(inTransaction(() -> { for (Pair<ScopeType, Long> id : ids) { dependencyService.refreshClassLoader(id.getKey(), id.getValue()); } return null; }))); try { execute.get(5, TimeUnit.MINUTES);//hard coded timeout, it should never happen } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new SBonitaRuntimeException("Unable to refresh the classloaders: "+ids, e); } }
void updateSProcessDefinitionTimestampInCache(long processId, SProcessDefinitionDeployInfo processDefinitionDeployInfo) throws SCacheException { final Pair<Long, SProcessDefinition> fromCache = getSProcessDefinitionFromCache(processId); if (fromCache != null) { storeProcessDefinitionInCache(fromCache.getValue(), processDefinitionDeployInfo.getLastUpdateDate()); } }
boolean isSProcessDefinitionUpToDate(SProcessDefinitionDeployInfo processDeploymentInfo, Pair<Long, SProcessDefinition> processWithTimestamp) { return processWithTimestamp == null || processWithTimestamp.getKey() != processDeploymentInfo.getLastUpdateDate(); }
@Override public final L getKey() { return getLeft(); }
void addClassloader(ScopeType type, long id) { ids.add(pair(type, id)); } }
@Override public R getValue() { return getRight(); }
private void refreshLocalClassLoader() { Future<Void> execute = bonitaTaskExecutor.execute( inSession(inTransaction(() -> { for (Pair<ScopeType, Long> id : ids) { dependencyService.refreshClassLoader(id.getKey(), id.getValue()); } return null; }))); try { execute.get(5, TimeUnit.MINUTES);//hard coded timeout, it should never happen } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new SBonitaRuntimeException("Unable to refresh the classloaders: "+ids, e); } }
void updateSProcessDefinitionTimestampInCache(long processId, SProcessDefinitionDeployInfo processDefinitionDeployInfo) throws SCacheException { final Pair<Long, SProcessDefinition> fromCache = getSProcessDefinitionFromCache(processId); if (fromCache != null) { storeProcessDefinitionInCache(fromCache.getValue(), processDefinitionDeployInfo.getLastUpdateDate()); } }
boolean isSProcessDefinitionUpToDate(SProcessDefinitionDeployInfo processDeploymentInfo, Pair<Long, SProcessDefinition> processWithTimestamp) { return processWithTimestamp == null || processWithTimestamp.getKey() != processDeploymentInfo.getLastUpdateDate(); }
@Override public final L getKey() { return getLeft(); }
void addClassloader(ScopeType type, long id) { ids.add(pair(type, id)); } }
@Override public R getValue() { return getRight(); }
@Override public SProcessDefinition getProcessDefinition(final long processId) throws SProcessDefinitionNotFoundException, SBonitaReadException { try { //get from database final SProcessDefinitionDeployInfo processDeploymentInfo = getProcessDeploymentInfo(processId); //get from cache final Pair<Long, SProcessDefinition> processWithTimestamp = getSProcessDefinitionFromCache(processId); //read SProcessDefinition if needed if (isSProcessDefinitionUpToDate(processDeploymentInfo, processWithTimestamp)) { return readSProcessDefinitionFromDatabase(processId, processDeploymentInfo); } else { return processWithTimestamp.getValue(); } } catch (IOException | SReflectException | SCacheException e) { throw new SBonitaReadException(e); } }
public static <L, R> Pair<L, R> pair(final L left, final R right) { return of(left, right); }
public static <L, R> Pair<L, R> of(final L left, final R right) { return new Pair<L, R>(left, right); }
@Override public SProcessDefinition getProcessDefinition(final long processId) throws SProcessDefinitionNotFoundException, SBonitaReadException { try { //get from database final SProcessDefinitionDeployInfo processDeploymentInfo = getProcessDeploymentInfo(processId); //get from cache final Pair<Long, SProcessDefinition> processWithTimestamp = getSProcessDefinitionFromCache(processId); //read SProcessDefinition if needed if (isSProcessDefinitionUpToDate(processDeploymentInfo, processWithTimestamp)) { return readSProcessDefinitionFromDatabase(processId, processDeploymentInfo); } else { return processWithTimestamp.getValue(); } } catch (IOException | SReflectException | SCacheException e) { throw new SBonitaReadException(e); } }