com.github.dynamicextensionsalfresco.metrics.Timer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annotations-runtime Show documentation
Show all versions of annotations-runtime Show documentation
Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features
package com.github.dynamicextensionsalfresco.metrics
/**
* register timing information during a transaction and report after commit
* (reporting dependant of implementation)
*
* @author Laurent Van der Linden
*/
public interface Timer {
fun start(label: String)
fun stop()
val enabled: Boolean
}
inline fun Timer.time(labelProvider: () -> String, operation: () -> Unit) {
if (enabled) {
start(labelProvider.invoke())
try {
operation()
} finally {
stop()
}
} else {
operation()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy