/** * Hook method for overriding how the template creates {@link TransactionMonitor}s * * @param cls class to use (may be null) * @param monitorName should not be null * @return {@link TransactionMonitor} to use */ protected TransactionMonitor createMonitor(Class cls, String monitorName) { TransactionMonitor monitor; if (cls == null) { monitor = new TransactionMonitor(monitorName); } else { monitor = new TransactionMonitor(cls, monitorName); } return monitor; }
@VisibleForTesting TransactionMonitor createTransactionMonitor(final MethodInvocation invocation) { final MonitoringLevel level = getMonitoringLevel(invocation); final String nameFromAnnotation = getNameFromAnnotation(invocation); if (this.prependClassName || (nameFromAnnotation == null)) { final String name = nameFromAnnotation == null ? invocation.getMethod().getName() : nameFromAnnotation; return new TransactionMonitor(invocation.getMethod().getDeclaringClass(), name, level); } else { return new TransactionMonitor(nameFromAnnotation, level); } }