@@ -0,0 +1,2547 @@
+package io.highway.to.urhell.service.impl;%0A%0Aimport io.highway.to.urhell.domain.BreakerData;%0Aimport io.highway.to.urhell.domain.EntryPathData;%0Aimport io.highway.to.urhell.service.LeechService;%0A%0Aimport java.lang.instrument.Instrumentation;%0Aimport java.lang.instrument.UnmodifiableClassException;%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Apublic class TransformerService %7B%0A%09%0A%09private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());%0A%09%0A%09public void transformAllClassScanByH2h(Instrumentation inst,Set%3CString%3E entryClassName)%7B%0A%09%09for(String classNameNormalized : entryClassName)%7B%0A%09%09%09String className = classNameNormalized.replaceAll(%22/%22, %22.%22);%0A%09%09%09LOGGER.error(%22Transform class %7B%7D%22,className);%0A%09%09%09transformOneClass(inst, className);%0A%09%09%7D%0A%09%09%0A%09%7D%0A%09%0A%09private void transformOneClass(Instrumentation inst,String className)%7B%0A%09%09ClassLoader classLoader = Thread.currentThread().getContextClassLoader();%0A    %09try %7B%0A%09%09%09inst.retransformClasses(classLoader.loadClass(className));%0A%09%09%7D catch (ClassNotFoundException %7C UnmodifiableClassException e) %7B%0A%09%09%09LOGGER.error(%22Error while transform Class %7B%7D msg %7B%7D%22,className,e);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public Map%3CString, List%3CBreakerData%3E%3E transformDataH2h(Collection%3CLeechService%3E leechService)%7B%0A%09%09 Map%3CString, List%3CBreakerData%3E%3E mapToTransform = new HashMap%3CString, List%3CBreakerData%3E%3E();%0A%09%09 for(LeechService leech : leechService)%7B%0A%09%09%09 for(EntryPathData entryPath : leech.getFrameworkInformations().getListEntryPath())%7B%0A%09%09%09%09 if (!entryPath.getMethodEntry().equals(%22%22)) %7B%0A%09%09                BreakerData bd = new BreakerData();%0A%09%09                bd.setClassName(entryPath.getClassName());%0A%09%09                bd.setMethodName(entryPath.getMethodEntry());%0A%09%09                String classNameNormalized = entryPath.getClassName().replaceAll(%22%5C%5C.%22, %22/%22);%0A%09%09                bd.setClassNameNormalized(classNameNormalized);%0A%09%09                bd.setSignatureName(entryPath.getSignatureName());%0A%09%09                List%3CBreakerData%3E listbd = mapToTransform.get(classNameNormalized);%0A%09%09                if (listbd == null) %7B%0A%09%09                    //first time%0A%09%09                    listbd = new ArrayList%3CBreakerData%3E();%0A%09%09                    listbd.add(bd);%0A%09%09                    mapToTransform.put(classNameNormalized, listbd);%0A%09%09                %7D else %7B%0A%09%09                    listbd.add(bd);%0A%09%09                %7D%0A%09%09            %7D%0A%09%09%09 %7D%0A%09%09 %7D%0A%09%09 %0A%09%09 return mapToTransform;%0A%09%7D%0A%7D%0A

transform class after loading