public MethodInfo getMethodInfo(long hash) { MethodMatchInfo info = getMatchInfo(hash); if (info != null) { return info.getInfo(); } return null; }
protected void unlockWriteChain(MethodInterceptors methodInterceptors) { Object[] methodMatchInfos = methodInterceptors.infos.getValues(); for (int i = 0; i < methodMatchInfos.length; i++) { MethodMatchInfo methodMatchInfo = (MethodMatchInfo) methodMatchInfos[i]; methodMatchInfo.getInfo().getInterceptorChainReadWriteLock().writeLock().unlock(); } }
protected void lockWriteChain(MethodInterceptors methodInterceptors) { Object[] methodMatchInfos = methodInterceptors.infos.getValues(); for (int i = 0; i < methodMatchInfos.length; i++) { MethodMatchInfo methodMatchInfo = (MethodMatchInfo) methodMatchInfos[i]; methodMatchInfo.getInfo().getInterceptorChainReadWriteLock().writeLock().lock(); } }
protected void resetChainKeepInterceptors(MethodInterceptors methodInterceptors) { Object[] methodMatchInfos = methodInterceptors.infos.getValues(); for (int i = 0; i < methodMatchInfos.length; i++) { MethodMatchInfo methodMatchInfo = (MethodMatchInfo) methodMatchInfos[i]; JoinPointInfo info = methodMatchInfo.getInfo(); info.clear(); } }
protected void resetChain(MethodInterceptors methodInterceptors) { Object[] methodMatchInfos = methodInterceptors.infos.getValues(); for (int i = 0; i < methodMatchInfos.length; i++) { MethodMatchInfo methodMatchInfo = (MethodMatchInfo) methodMatchInfos[i]; if (methodMatchInfo.bindings != null) { methodMatchInfo.bindings.clear(); } if (methodMatchInfo.pointcutMethodMatches != null) { methodMatchInfo.pointcutMethodMatches.clear(); } methodMatchInfo.getInfo().clear(); } }
protected void finalizeMethodChain() { boolean maintain = AspectManager.maintainAdvisorMethodInterceptors; TLongObjectHashMap newMethodInfos = (maintain) ? new TLongObjectHashMap() : null; long[] keys = methodInfos.keys(); for (int i = 0; i < keys.length; i++) { MethodMatchInfo matchInfo = methodInfos.getMatchInfo(keys[i]); matchInfo.populateBindings(); MethodInfo info = matchInfo.getInfo(); adjustInfoForAddedBinding(info); ArrayList<Interceptor> list = info.getInterceptorChain(); Interceptor[] interceptors = null; if (list.size() > 0) { interceptors = applyPrecedence(list.toArray(new Interceptor[list.size()])); } info.setInterceptors(interceptors); if (maintain) { newMethodInfos.put(keys[i], info); } } methodInterceptors = newMethodInfos; }
protected void updateMethodPointcutAfterRemove(AdviceBinding binding) { long[] keys = methodInfos.keys(); for(int i =0; i < keys.length; i++) { Method method = (Method) advisedMethods.get(keys[i]); PointcutMethodMatch match = binding.getPointcut().matchesExecution(this, method); if (match != null && match.isMatch()) { if (AspectManager.verbose) { logger.debug("removing matched binding: "+method.toString()); } MethodMatchInfo info = methodInfos.getMatchInfo(keys[i]); info.removeMatchedBinding(binding, match); info.getInfo().clear(); if (AspectManager.maintainAdvisorMethodInterceptors) { methodInterceptors.put(keys[i], info); } } } }
private void easyFinalizeMethodChainForInstance(ClassAdvisor classAdvisor, MethodInterceptors newMethodInterceptors) { long[] keys = newMethodInterceptors.keys(); for (int i = 0; i < keys.length; i++) { MethodInfo classMethodInfo = classAdvisor.getMethodInfo(keys[i]); MethodMatchInfo matchInfo = newMethodInterceptors.getMatchInfo(keys[i]); MethodInfo myMethodInfo = matchInfo.getInfo(); myMethodInfo.cloneChains(classMethodInfo); if (updateOldInfo(oldInfos, myMethodInfo, OldInfoMaps.INFOS)) { MethodJoinPointGenerator generator = getJoinPointGenerator(myMethodInfo); generator.rebindJoinpoint(myMethodInfo); } } }
private void fullWorkFinalizeMethodChain(MethodInterceptors newMethodInterceptors) { //We are either the class advisor or an instanceadvisor with own data so we need to do all the work TLongObjectHashMap newMethodInfos = new TLongObjectHashMap(); long[] keys = newMethodInterceptors.keys(); for (int i = 0; i < keys.length; i++) { MethodMatchInfo matchInfo = newMethodInterceptors.getMatchInfo(keys[i]); matchInfo.populateBindings(); MethodInfo info = matchInfo.getInfo(); newMethodInfos.put(keys[i], info); MethodJoinPointGenerator generator = getJoinPointGenerator(info); finalizeChainAndRebindJoinPoint(oldInfos, info, generator, OldInfoMaps.INFOS); } if (AspectManager.maintainAdvisorMethodInterceptors) { methodInterceptors = newMethodInfos; } //Handle the overridden methods if (overriddenMethods != null && overriddenMethods.size() > 0) { for (MethodInfo info : overriddenMethods) { MethodJoinPointGenerator generator = getJoinPointGenerator(info); finalizeChainAndRebindJoinPoint(oldInfos, info, generator, OldInfoMaps.INFOS); } } }