class CompileUtils {

	@SuppressWarnings("unchecked")
	public static <T> Class<T> compile(ClassLoader cl, String name, String code) {
		try {
			Cache<ClassLoader, Class> compiledClasses = COMPILED_CACHE.get(name,
					() -> CacheBuilder.newBuilder().maximumSize(5).weakKeys().softValues().build());
			return compiledClasses.get(cl, () -> doCompile(cl, name, code));
		} catch (Exception e) {
			throw new FlinkRuntimeException(e.getMessage(), e);
		}
	}

}