Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
vertigo - simple java starter Copyright (C) 2013, KleeGroup, ( KleeGroup, Centre d'affaire la Boursidiere - BP 159 - 92357 Le Plessis Robinson Cedex - France Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Plugin de calcul du temps d'exécution d'une requête.

	private final TaskManager taskManager;

Constructeur apr défaut.

workManager Manager des works
	public PerformanceMetricEngine(final TaskManager taskManager) {
		this. = taskManager;

	public PerformanceMetric execute(final TaskDefinition taskDefinition) {
		try {
			return doExecute(taskDefinition);
catch (final Throwable e) {
			//throw new RiException("Erreur du plugin perfs", e);
			return new PerformanceMetric(e);
	private PerformanceMetric doExecute(final TaskDefinition taskDefinition) {
		//System.out.println(">>>>" + currentTask.getEngineClass().getCanonicalName());
		if (TaskEngineSelect.class.isAssignableFrom(taskDefinition.getTaskEngineClass()) && !hasNotNullOutParams(taskDefinition)) {
			//	System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>" + currentTask.getEngineClass().getCanonicalName());
			final TaskPopulator taskPopulator = new TaskPopulator(taskDefinition);
			final Task task = taskPopulator.populateTask();
			final long startTime = System.currentTimeMillis();
			/*TaskResult result =*/.execute(task);
			//on n'utilise pas le resultat
			final long endTime = System.currentTimeMillis();
			final long executionTime = endTime - startTime;
			return new PerformanceMetric(executionTime);
		//Le test n'a pas de sens. 
		return new PerformanceMetric();
	private static boolean hasNotNullOutParams(final TaskDefinition taskDefinition) {
		for (final TaskAttribute attribute : taskDefinition.getAttributes()) {
			if (!attribute.isIn() && attribute.isNotNull()) {
				return true;
		return false;
New to GrepCode? Check out our FAQ X