/** * Given source and name will compile and store the filter if it detects that the filter code has changed or * the filter doesn't exist. Otherwise it will return an instance of the requested ZuulFilter * * @param sCode source code * @param sName name of the filter * @return the IZuulFilter * @throws IllegalAccessException * @throws InstantiationException */ public ZuulFilter getFilter(String sCode, String sName) throws Exception { if (filterCheck.get(sName) == null) { filterCheck.putIfAbsent(sName, sName); if (!sCode.equals(filterClassCode.get(sName))) { LOG.info("reloading code " + sName); filterRegistry.remove(sName); } } ZuulFilter filter = filterRegistry.get(sName); if (filter == null) { Class clazz = compiler.compile(sCode, sName); if (!Modifier.isAbstract(clazz.getModifiers())) { filter = filterFactory.newInstance(clazz); } } return filter; }
if (filterClassLastModified.get(sName) != null && (file.lastModified() != filterClassLastModified.get(sName))) { LOG.debug("reloading filter " + sName); filterRegistry.remove(sName);
/** * Given source and name will compile and store the filter if it detects that the filter code has changed or * the filter doesn't exist. Otherwise it will return an instance of the requested ZuulFilter * * @param sCode source code * @param sName name of the filter * @return the IZuulFilter * @throws IllegalAccessException * @throws InstantiationException */ public ZuulFilter getFilter(String sCode, String sName) throws Exception { if (filterCheck.get(sName) == null) { filterCheck.putIfAbsent(sName, sName); if (!sCode.equals(filterClassCode.get(sName))) { LOG.info("reloading code " + sName); filterRegistry.remove(sName); } } ZuulFilter filter = filterRegistry.get(sName); if (filter == null) { Class clazz = compiler.compile(sCode, sName); if (!Modifier.isAbstract(clazz.getModifiers())) { filter = filterFactory.newInstance(clazz); } } return filter; }
if (filterClassLastModified.get(sName) != null && (file.lastModified() != filterClassLastModified.get(sName))) { LOG.debug("reloading filter " + sName); filterRegistry.remove(sName);
@PreDestroy public void contextDestroyed() { log.info("Stopping filter initializer"); for (Map.Entry<String, ZuulFilter> entry : this.filters.entrySet()) { filterRegistry.remove(entry.getKey()); } clearLoaderCache(); TracerFactory.initialize(null); CounterFactory.initialize(null); }
/** * Removes a {@link Interceptor} file. * * @param interceptor {@link InterceptorFileDTO} */ public void removeFileInterceptor(InterceptorFileDTO interceptor) { File interceptorFile = new File(interceptor.getPath()); if (interceptorFile.exists() && interceptorFile.isFile()) { String filter = interceptorFile.getAbsolutePath() + interceptorFile.getName(); if (interceptorFile.delete()) { log.info("File - Removing File Filter: {}", interceptorFile.getAbsolutePath()); FilterRegistry.instance().remove(filter); clearLoaderCache(); log.debug("FilterRegistry - Removing File Filter {}", filter); } else { log.warn("Not possible to remove File: {} with Interceptor ID: {}", interceptorFile.getAbsolutePath(), interceptor.getId()); } } }
/** * Given source and name will compile and store the filter if it detects that the filter code has changed or * the filter doesn't exist. Otherwise it will return an instance of the requested ZuulFilter * * @param sCode source code * @param sName name of the filter * @return the IZuulFilter * @throws IllegalAccessException * @throws InstantiationException */ public ZuulFilter getFilter(String sCode, String sName) throws Exception { if (filterCheck.get(sName) == null) { filterCheck.putIfAbsent(sName, sName); if (!sCode.equals(filterClassCode.get(sName))) { LOG.info("reloading code " + sName); filterRegistry.remove(sName); } } ZuulFilter filter = filterRegistry.get(sName); if (filter == null) { Class clazz = compiler.compile(sCode, sName); if (!Modifier.isAbstract(clazz.getModifiers())) { filter = filterFactory.newInstance(clazz); } } return filter; }
if (filterClassLastModified.get(sName) != null && (file.lastModified() != filterClassLastModified.get(sName))) { LOG.debug("reloading filter " + sName); filterRegistry.remove(sName);