-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from abes-esr/CDE-277-Mesurer-et-noter-les-per…
…formances-sur-plusieurs-fichiers Ajout @ExecutionTime sur méthodes du projet faisant appel à la basexml
- Loading branch information
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...es/src/main/java/fr/abes/convergence/kbartws/repository/BiblioTableFrbr4XXRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package fr.abes.convergence.kbartws.repository; | ||
|
||
import fr.abes.convergence.kbartws.entity.BiblioTableFrbr4XX; | ||
import fr.abes.convergence.kbartws.utils.ExecutionTime; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface BiblioTableFrbr4XXRepository extends JpaRepository<BiblioTableFrbr4XX, Integer> { | ||
@ExecutionTime | ||
List<BiblioTableFrbr4XX> findAllByTagAndDatas(String tag, String datas); | ||
} |
2 changes: 2 additions & 0 deletions
2
...services/src/main/java/fr/abes/convergence/kbartws/repository/NoticesBibioRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package fr.abes.convergence.kbartws.repository; | ||
|
||
import fr.abes.convergence.kbartws.entity.NoticesBibio; | ||
import fr.abes.convergence.kbartws.utils.ExecutionTime; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface NoticesBibioRepository extends JpaRepository<NoticesBibio, Integer> { | ||
@ExecutionTime | ||
Optional<NoticesBibio> findByPpn(String ppn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
kbart-webservices/src/main/java/fr/abes/convergence/kbartws/utils/ExecutionTime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package fr.abes.convergence.kbartws.utils; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface ExecutionTime { | ||
} |
24 changes: 24 additions & 0 deletions
24
kbart-webservices/src/main/java/fr/abes/convergence/kbartws/utils/ExecutionTimeAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package fr.abes.convergence.kbartws.utils; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
|
||
@Aspect | ||
@Slf4j | ||
public class ExecutionTimeAspect { | ||
|
||
@Around("@annotation(ExecutionTime)") | ||
public Object measureExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable { | ||
long startTime = System.currentTimeMillis(); | ||
|
||
Object result = joinPoint.proceed(); | ||
|
||
long endTime = System.currentTimeMillis(); | ||
double executionTime = (endTime - startTime) / 1000; | ||
|
||
log.debug("Temps d'exécution : " + executionTime + " secondes"); | ||
return result; | ||
} | ||
} |