private void incrementClassMappingFailureTypeStat(Object[] args) { // Determine src and dest class name. The combination of src and dest class name will be used for the statistic entry key. String srcClassName = null; if (args[0] != null) { srcClassName = args[0].getClass().getName(); } String destClassName = null; if (args[1] != null) { if (args[1] instanceof Class) { destClassName = ((Class<?>) args[1]).getName(); } else { destClassName = args[1].getClass().getName(); } } statsMgr.increment(StatisticType.MAPPING_FAILURE_TYPE_COUNT, srcClassName + "-->" + destClassName); } }
public void clearAll() { statsMgr.clearAll(); }
protected long getStatisticValue(StatisticType statisticType) { return statsMgr.getStatisticValue(statisticType); }
protected Mapper getMappingProcessor() { initMappings(); Mapper processor = new MappingProcessor(customMappings, globalConfiguration, cacheManager, statsMgr, customConverters, eventManager, getCustomFieldMapper(), customConvertersWithId); // If statistics are enabled, then Proxy the processor with a statistics interceptor if (statsMgr.isStatisticsEnabled()) { processor = (Mapper) Proxy.newProxyInstance(processor.getClass().getClassLoader(), processor.getClass().getInterfaces(), new StatisticsInterceptor(processor, statsMgr)); } return processor; }
protected Set<String> getStatisticEntries(StatisticType statisticType) { Set<String> result = new TreeSet<String>(); for (StatisticEntry entry : statsMgr.getStatisticEntries(statisticType)) { result.add(entry.getKey().toString() + ": Count " + entry.getValue()); } return result; }
public void logStatistics() { statsMgr.logStatistics(); }
public String dumpStatistics() { return statsMgr.getStatistics().toString(); }
protected Mapper getMappingProcessor() { log.info("OpenL Mapper Framework v. 1.1.13-SNAPSHOT (Dozer 5.3.2)"); if (initializing.compareAndSet(false, true)) { try { loadCustomMappings(); eventManager = new DozerEventManager(eventListeners); } finally { ready.countDown(); } } try { ready.await(); } catch (InterruptedException e) { log.error("Thread interrupted: ", e); } Mapper processor = new MappingProcessor(customMappings, globalConfiguration, cacheManager, statsMgr, customConverters, eventManager, getCustomFieldMapper(), customConvertersWithId, mappingConditions, mappingConditionsWithId, collectionItemDiscriminators, collectionItemDiscriminatorsWithId); // If statistics are enabled, then Proxy the processor with a statistics // interceptor if (statsMgr.isStatisticsEnabled()) { processor = (Mapper) Proxy.newProxyInstance(processor.getClass().getClassLoader(), processor.getClass() .getInterfaces(), new StatisticsInterceptor(processor, statsMgr)); } return processor; }
protected Set<String> getStatisticEntries(StatisticType statisticType) { Set<String> result = new TreeSet<String>(); for (StatisticEntry entry : statsMgr.getStatisticEntries(statisticType)) { result.add(entry.getKey().toString() + ": Count " + entry.getValue()); } return result; }
public void logStatistics() { statsMgr.logStatistics(); }
public String dumpStatistics() { return statsMgr.getStatistics().toString(); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { long start = System.currentTimeMillis(); try { Object result = method.invoke(delegate, args); long stop = System.currentTimeMillis(); statsMgr.increment(StatisticType.MAPPING_SUCCESS_COUNT); statsMgr.increment(StatisticType.MAPPING_TIME, (stop - start)); return result; } catch (InvocationTargetException e) { Throwable ex = e.getTargetException(); statsMgr.increment(StatisticType.MAPPING_FAILURE_COUNT); Throwable rootCause = MappingUtils.getRootCause(ex); statsMgr.increment(StatisticType.MAPPING_FAILURE_EX_TYPE_COUNT, rootCause.getClass()); incrementClassMappingFailureTypeStat(args); throw ex; } }
if (statsMgr.isStatisticsEnabled()) { processor = (Mapper) Proxy.newProxyInstance(processor.getClass().getClassLoader(), processor.getClass().getInterfaces(),
protected long getStatisticValue(StatisticType statisticType) { return statsMgr.getStatisticValue(statisticType); }
public void clearAll() { statsMgr.clearAll(); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { long start = System.currentTimeMillis(); try { Object result = method.invoke(delegate, args); long stop = System.currentTimeMillis(); statsMgr.increment(StatisticType.MAPPING_SUCCESS_COUNT); statsMgr.increment(StatisticType.MAPPING_TIME, (stop - start)); return result; } catch (InvocationTargetException e) { Throwable ex = e.getTargetException(); statsMgr.increment(StatisticType.MAPPING_FAILURE_COUNT); Throwable rootCause = MappingUtils.getRootCause(ex); statsMgr.increment(StatisticType.MAPPING_FAILURE_EX_TYPE_COUNT, rootCause.getClass()); incrementClassMappingFailureTypeStat(args); throw ex; } }
public ValueType get(KeyType key) { if (key == null) { throw new IllegalArgumentException("Key cannot be null"); } CacheEntry<KeyType, ValueType> result = cacheMap.get(key); if (result != null) { statMgr.increment(StatisticType.CACHE_HIT_COUNT, name); return result.getValue(); } else { statMgr.increment(StatisticType.CACHE_MISS_COUNT, name); return null; } }
private void incrementClassMappingFailureTypeStat(Object[] args) { // Determine src and dest class name. The combination of src and dest // class name will be used for the statistic entry key. String srcClassName = null; if (args[0] != null) { srcClassName = args[0].getClass().getName(); } String destClassName = null; if (args[1] != null) { if (args[1] instanceof Class) { destClassName = ((Class<?>) args[1]).getName(); } else { destClassName = args[1].getClass().getName(); } } statsMgr.increment(StatisticType.MAPPING_FAILURE_TYPE_COUNT, srcClassName + "-->" + destClassName); } }
public ValueType get(KeyType key) { if (key == null) { throw new IllegalArgumentException("Key cannot be null"); } CacheEntry<KeyType, ValueType> result = cacheMap.get(key); if (result != null) { statMgr.increment(StatisticType.CACHE_HIT_COUNT, name); return result.getValue(); } else { statMgr.increment(StatisticType.CACHE_MISS_COUNT, name); return null; } }