Dataset Viewer
Auto-converted to Parquet Duplicate
proj_name
stringclasses
157 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
49
masked_class
stringlengths
68
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
27
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-aop/autoload-cache-aop-aspectj/src/main/java/com/jarvis/cache/aop/aspectj/AspectjAopInterceptor.java
AspectjAopInterceptor
checkAndProceed
class AspectjAopInterceptor { private final CacheHandler cacheHandler; public AspectjAopInterceptor(CacheHandler cacheHandler) { this.cacheHandler = cacheHandler; } public Object checkAndProceed(ProceedingJoinPoint pjp) throws Throwable {<FILL_FUNCTION_BODY>} public void checkAndDeleteCa...
Signature signature = pjp.getSignature(); MethodSignature methodSignature = (MethodSignature) signature; Method method = methodSignature.getMethod(); if (method.isAnnotationPresent(Cache.class)) { Cache cache = method.getAnnotation(Cache.class);// method.getAnnotationsByType...
591
134
725
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-aop/autoload-cache-aop-aspectj/src/main/java/com/jarvis/cache/aop/aspectj/AspectjCacheAopProxyChain.java
AspectjCacheAopProxyChain
getMethod
class AspectjCacheAopProxyChain implements CacheAopProxyChain { private final ProceedingJoinPoint jp; private Method method; public AspectjCacheAopProxyChain(ProceedingJoinPoint jp) { this.jp = jp; } @Override public Object[] getArgs() { return jp.getArgs(); } @Over...
if (null == method) { Signature signature = jp.getSignature(); MethodSignature methodSignature = (MethodSignature) signature; this.method = methodSignature.getMethod(); } return method;
188
57
245
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-aop/autoload-cache-aop-aspectj/src/main/java/com/jarvis/cache/aop/aspectj/AspectjDeleteCacheAopProxyChain.java
AspectjDeleteCacheAopProxyChain
getMethod
class AspectjDeleteCacheAopProxyChain implements DeleteCacheAopProxyChain { private JoinPoint jp; public AspectjDeleteCacheAopProxyChain(JoinPoint jp) { this.jp = jp; } @Override public Object[] getArgs() { return jp.getArgs(); } @Override public Object getTarget() { ...
Signature signature = jp.getSignature(); MethodSignature methodSignature = (MethodSignature) signature; return methodSignature.getMethod();
140
37
177
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/CacheUtil.java
CacheUtil
getMiscHashCode
class CacheUtil { private static final String SPLIT_STR = "_"; @SuppressWarnings("rawtypes") public static boolean isEmpty(Object obj) { if (null == obj) { return true; } if (obj instanceof String) { return ((String) obj).length() == 0; } Cla...
if (null == str || str.length() == 0) { return ""; } int originSize = 20; if (str.length() <= originSize) { return str; } StringBuilder tmp = new StringBuilder(); tmp.append(str.hashCode()).append(SPLIT_STR).append(getHashCode(str)); ...
778
183
961
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/comparator/AutoLoadOldestComparator.java
AutoLoadOldestComparator
compare
class AutoLoadOldestComparator implements Comparator<AutoLoadTO> { @Override public int compare(AutoLoadTO autoLoadTO1, AutoLoadTO autoLoadTO2) {<FILL_FUNCTION_BODY>} }
if (autoLoadTO1 == null && autoLoadTO2 != null) { return 1; } else if (autoLoadTO1 != null && autoLoadTO2 == null) { return -1; } else if (autoLoadTO1 == null && autoLoadTO2 == null) { return 0; } long now = System.currentTimeMillis(); ...
62
298
360
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/comparator/AutoLoadRequestTimesComparator.java
AutoLoadRequestTimesComparator
compare
class AutoLoadRequestTimesComparator implements Comparator<AutoLoadTO> { @Override public int compare(AutoLoadTO autoLoadTO1, AutoLoadTO autoLoadTO2) {<FILL_FUNCTION_BODY>} }
if (autoLoadTO1 == null && autoLoadTO2 != null) { return 1; } else if (autoLoadTO1 != null && autoLoadTO2 == null) { return -1; } else if (autoLoadTO1 == null && autoLoadTO2 == null) { return 0; } if (autoLoadTO1.getRequestTimes() > autoLoadTO...
62
158
220
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/reflect/generics/ParameterizedTypeImpl.java
ParameterizedTypeImpl
validateConstructorArguments
class ParameterizedTypeImpl implements ParameterizedType { private Type[] actualTypeArguments; private Class<?> rawType; private Type ownerType; private ParameterizedTypeImpl(Class<?> paramClass, Type[] paramArrayOfType, Type paramType) { this.actualTypeArguments = paramArrayOfType; ...
@SuppressWarnings("rawtypes") TypeVariable[] arrayOfTypeVariable = this.rawType.getTypeParameters(); if (arrayOfTypeVariable.length != this.actualTypeArguments.length) { throw new MalformedParameterizedTypeException(); } // for(int i=0; i < this.actualTypeArguments....
976
93
1,069
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/to/AutoLoadTO.java
AutoLoadTO
toString
class AutoLoadTO implements Serializable { private static final long serialVersionUID = 1L; private final CacheAopProxyChain joinPoint; private final Object[] args; /** * 缓存注解 */ private final Cache cache; /** * 缓存时长 */ private int expire; /** * 缓存Key ...
return "AutoLoadTO{" + "joinPoint=" + joinPoint + ", args=" + Arrays.toString(args) + ", cache=" + cache + ", expire=" + expire + ", cacheKey=" + cacheKey + ", lastLoadTime=" + lastLoadTime + ", last...
1,499
159
1,658
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/to/CacheKeyTO.java
CacheKeyTO
getCacheKey
class CacheKeyTO implements Serializable { private static final long serialVersionUID = 7229320497442357252L; private final String namespace; private final String key;// 缓存Key private final String hfield;// 设置哈希表中的字段,如果设置此项,则用哈希表进行存储 public CacheKeyTO(String namespace, String key, String hfield...
if (null != this.namespace && this.namespace.length() > 0) { return new StringBuilder(this.namespace).append(":").append(this.key).toString(); } return this.key;
506
57
563
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/to/CacheWrapper.java
CacheWrapper
clone
class CacheWrapper<T> implements Serializable, Cloneable { private static final long serialVersionUID = 1L; /** * 缓存数据 */ private T cacheObject; /** * 最后加载时间 */ private long lastLoadTime; /** * 缓存时长 */ private int expire; public CacheWrapper() { } ...
@SuppressWarnings("unchecked") CacheWrapper<T> tmp = (CacheWrapper<T>) super.clone(); tmp.setCacheObject(this.cacheObject); return tmp;
479
53
532
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/to/ProcessingTO.java
ProcessingTO
toString
class ProcessingTO { private volatile long startTime; private volatile CacheWrapper<Object> cache; private volatile boolean firstFinished = false; private volatile Throwable error; public ProcessingTO() { startTime = System.currentTimeMillis(); } public CacheWrapper<Object>...
return "ProcessingTO{" + "startTime=" + startTime + ", cache=" + cache + ", firstFinished=" + firstFinished + ", error=" + error + '}';
418
59
477
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/lib/util/BeanUtil.java
BeanUtil
toString
class BeanUtil { @SuppressWarnings("rawtypes") private static final ConcurrentHashMap<Class, Field[]> FIELDS_CAHCE = new ConcurrentHashMap<Class, Field[]>(); /** * 是否为基础数据类型 * * @param obj Object * @return boolean true or false */ public static boolean isPrimitive(Object obj) ...
if (obj == null) { return "null"; } Class cl = obj.getClass(); if (isPrimitive(obj)) { return String.valueOf(obj); } else if (obj instanceof Enum) { return ((Enum) obj).name(); } else if (obj instanceof Date) { return Strin...
256
871
1,127
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/lib/util/StringUtil.java
StringUtil
containsText
class StringUtil { /** * Check whether the given {@code CharSequence} contains actual <em>text</em>. * <p>More specifically, this method returns {@code true} if the * {@code CharSequence} is not {@code null}, its length is greater than * 0, and it contains at least one non-whitespace character. ...
int strLen = str.length(); for (int i = 0; i < strLen; i++) { if (!Character.isWhitespace(str.charAt(i))) { return true; } } return false;
511
66
577
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-core/src/main/java/com/jarvis/cache/CacheHelper.java
CacheHelper
initDeleteCacheKeysSet
class CacheHelper { private static final ThreadLocal<CacheOpType> OP_TYPE = new ThreadLocal<CacheOpType>(); private static final ThreadLocal<Set<CacheKeyTO>> DELETE_CACHE_KEYS = new ThreadLocal<Set<CacheKeyTO>>(); /** * 获取CacheOpType * * @return ThreadLocal中设置的CacheOpType */ publi...
Set<CacheKeyTO> set = DELETE_CACHE_KEYS.get(); if (null == set) { set = new HashSet<CacheKeyTO>(); DELETE_CACHE_KEYS.set(set); }
421
66
487
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-core/src/main/java/com/jarvis/cache/ComboCacheManager.java
ComboCacheManager
mset
class ComboCacheManager implements ICacheManager { /** * 表达式解析器 */ private final AbstractScriptParser scriptParser; /** * 本地缓存实现 */ private ICacheManager localCache; /** * 远程缓存实现 */ private ICacheManager remoteCache; private static final Logger log = Log...
if (method.isAnnotationPresent(LocalCache.class)) { LocalCache lCache = method.getAnnotation(LocalCache.class); for (MSetParam param : params) { if (param == null) { continue; } setLocalCache(lCache, param.getCacheKey()...
1,647
131
1,778
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-core/src/main/java/com/jarvis/cache/DataLoaderFactory.java
DataLoaderFactory
getDataLoader
class DataLoaderFactory extends BasePooledObjectFactory<DataLoader> { private static volatile DataLoaderFactory instance; private final GenericObjectPool<DataLoader> factory; private DataLoaderFactory() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1...
try { return factory.borrowObject(); } catch (Exception e) { e.printStackTrace(); } return new DataLoader();
411
43
454
<methods>public void <init>() ,public void activateObject(PooledObject<com.jarvis.cache.DataLoader>) throws java.lang.Exception,public abstract com.jarvis.cache.DataLoader create() throws java.lang.Exception,public void destroyObject(PooledObject<com.jarvis.cache.DataLoader>) throws java.lang.Exception,public PooledObj...
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-core/src/main/java/com/jarvis/cache/DeleteCacheMagicHandler.java
DeleteCacheMagicHandler
getCacheKeyForMagic
class DeleteCacheMagicHandler { private final CacheHandler cacheHandler; private final DeleteCacheAopProxyChain jp; private final CacheDeleteMagicKey[] cacheDeleteKeys; private final Object[] arguments; private final Method method; private final Object retVal; private final Object targ...
List<List<CacheKeyTO>> lists = new ArrayList<>(cacheDeleteKeys.length); for (CacheDeleteMagicKey cacheDeleteKey : cacheDeleteKeys) { isMagic(cacheDeleteKey); String keyExpression = cacheDeleteKey.value(); String hfieldExpression = cacheDeleteKey.hfield(); ...
1,559
280
1,839
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-core/src/main/java/com/jarvis/cache/RefreshHandler.java
RefreshHandler
doRefresh
class RefreshHandler { private static final Logger log = LoggerFactory.getLogger(RefreshHandler.class); private static final int REFRESH_MIN_EXPIRE = 120; private static final int ONE_THOUSAND_MS = 1000; /** * 刷新缓存线程池 */ private final ThreadPoolExecutor refreshThreadPool; /** ...
int expire = cacheWrapper.getExpire(); if (expire < REFRESH_MIN_EXPIRE) {// 如果过期时间太小了,就不允许自动加载,避免加载过于频繁,影响系统稳定性 return; } // 计算超时时间 int alarmTime = cache.alarmTime(); long timeout; if (alarmTime > 0 && alarmTime < expire) { timeout = expir...
1,526
349
1,875
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-lock/autoload-cache-lock-jedis/src/main/java/com/jarvis/cache/lock/ShardedJedisLock.java
ShardedJedisLock
setnx
class ShardedJedisLock extends AbstractRedisLock { private ShardedJedisPool shardedJedisPool; public ShardedJedisLock(ShardedJedisPool shardedJedisPool) { this.shardedJedisPool = shardedJedisPool; } private void returnResource(ShardedJedis shardedJedis) { shardedJedis.close(); } ...
ShardedJedis shardedJedis = null; try { shardedJedis = shardedJedisPool.getResource(); Jedis jedis = shardedJedis.getShard(key); return OK.equalsIgnoreCase(jedis.set(key, val, SetParams.setParams().nx().ex(expire))); } finally { returnResource(sha...
254
113
367
<methods>public non-sealed void <init>() ,public boolean tryLock(java.lang.String, int) ,public void unlock(java.lang.String) <variables>protected static final java.lang.String EX,private static final ThreadLocal<Map<java.lang.String,com.jarvis.cache.to.RedisLockInfo>> LOCK_START_TIME,protected static final java.lang.S...
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-lock/autoload-cache-lock-redis/src/main/java/com/jarvis/cache/lock/AbstractRedisLock.java
AbstractRedisLock
unlock
class AbstractRedisLock implements ILock { private static final Logger logger = LoggerFactory.getLogger(AbstractRedisLock.class); private static final ThreadLocal<Map<String, RedisLockInfo>> LOCK_START_TIME = new ThreadLocal<Map<String, RedisLockInfo>>() { @Override protected Map<String, R...
Map<String, RedisLockInfo> startTimeMap = LOCK_START_TIME.get(); RedisLockInfo info = null; if (null != startTimeMap) { info = startTimeMap.remove(key); } // 如果实际执行时长超过租约时间则不需要主到释放锁 long useTime = System.currentTimeMillis() - info.getStartTime(); if (...
423
175
598
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/JedisClusterCacheManager.java
JedisClusterClient
mget
class JedisClusterClient implements IRedis { private final JedisCluster jedisCluster; private final AbstractRedisCacheManager cacheManager; public JedisClusterClient(JedisCluster jedisCluster, AbstractRedisCacheManager cacheManager) { this.jedisCluster = jedisCluster; ...
RetryableJedisClusterPipeline retryableJedisClusterPipeline = new RetryableJedisClusterPipeline(jedisCluster) { @Override public void execute(JedisClusterPipeline pipeline) { JedisUtil.executeMGet(pipeline, keys); } }; ...
813
112
925
<methods>public void <init>(ISerializer<java.lang.Object>) ,public void delete(Set<com.jarvis.cache.to.CacheKeyTO>) throws com.jarvis.cache.exception.CacheCenterConnectionException,public Map<com.jarvis.cache.to.CacheKeyTO,CacheWrapper<java.lang.Object>> deserialize(Set<com.jarvis.cache.to.CacheKeyTO>, Collection<java....
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/JedisClusterPipeline.java
JedisClusterPipeline
innerSync
class JedisClusterPipeline extends PipelineBase implements Closeable { private final JedisClusterInfoCache clusterInfoCache; /** * 根据顺序存储每个命令对应的Client */ private final Queue<Client> clients; /** * 用于缓存连接 */ private final Map<JedisPool, Jedis> jedisMap; public JedisClusterP...
try { Response<?> response; Object data; for (Client client : clients) { response = generateResponse(client.getOne()); if (null != formatted) { data = response.get(); formatted.add(data); ...
824
107
931
<methods>public void <init>() ,public Response<java.lang.Long> append(java.lang.String, java.lang.String) ,public Response<java.lang.Long> append(byte[], byte[]) ,public Response<java.lang.Long> bitcount(java.lang.String) ,public Response<java.lang.Long> bitcount(byte[]) ,public Response<java.lang.Long> bitcount(java.l...
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/JedisUtil.java
JedisUtil
executeMSet
class JedisUtil { private static final Logger log = LoggerFactory.getLogger(JedisUtil.class); public static void executeMSet(PipelineBase pipeline, AbstractRedisCacheManager manager, Collection<MSetParam> params) throws Exception {<FILL_FUNCTION_BODY>} public static void executeMGet(PipelineBase pipe...
CacheKeyTO cacheKeyTO; String cacheKey; String hfield; CacheWrapper<Object> result; byte[] key; byte[] val; for (MSetParam param : params) { if(null == param){ continue; } cacheKeyTO = param.getCacheKey(); ...
490
364
854
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/RetryableJedisClusterPipeline.java
RetryableJedisClusterPipeline
syncAndReturnAll
class RetryableJedisClusterPipeline { /** * 部分字段没有对应的获取方法,只能采用反射来做 * 也可以去继承JedisCluster和JedisSlotBasedConnectionHandler来提供访问接口 **/ private static final Field FIELD_CONNECTION_HANDLER; private static final Field FIELD_CACHE; private static final Logger log = LoggerFactory.getLogger(JedisU...
try { JedisClusterPipeline pipeline = new JedisClusterPipeline(clusterInfoCache); execute(pipeline); return pipeline.syncAndReturnAll(); } catch (JedisMovedDataException jre) { // if MOVED redirection occurred, rebuilds cluster's slot cache, /...
806
155
961
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/ShardedJedisCacheManager.java
ShardedJedisClient
delete
class ShardedJedisClient implements IRedis { private static final Logger LOGGER = LoggerFactory.getLogger(ShardedJedisClient.class); private final ShardedJedis shardedJedis; private final AbstractRedisCacheManager cacheManager; public ShardedJedisClient(ShardedJedis shardedJedis, Abs...
ShardedJedisPipeline pipeline = new ShardedJedisPipeline(); pipeline.setShardedJedis(shardedJedis); JedisUtil.executeDelete(pipeline, keys); pipeline.sync();
842
61
903
<methods>public void <init>(ISerializer<java.lang.Object>) ,public void delete(Set<com.jarvis.cache.to.CacheKeyTO>) throws com.jarvis.cache.exception.CacheCenterConnectionException,public Map<com.jarvis.cache.to.CacheKeyTO,CacheWrapper<java.lang.Object>> deserialize(Set<com.jarvis.cache.to.CacheKeyTO>, Collection<java....
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-lettuce/src/main/java/com/jarvis/cache/redis/LettuceRedisCacheManager.java
LettuceRedisClient
delete
class LettuceRedisClient implements IRedis { private final StatefulRedisConnection<byte[], byte[]> connection; private final AbstractRedisCacheManager cacheManager; public LettuceRedisClient(StatefulRedisConnection<byte[], byte[]> connection, AbstractRedisCacheManager cacheManager) { ...
// 为了提升性能,开启pipeline this.connection.setAutoFlushCommands(false); RedisAsyncCommands<byte[], byte[]> asyncCommands = connection.async(); try { for (CacheKeyTO cacheKeyTO : keys) { String cacheKey = cacheKeyTO.getCacheKey(); ...
791
264
1,055
<methods>public void <init>(ISerializer<java.lang.Object>) ,public void delete(Set<com.jarvis.cache.to.CacheKeyTO>) throws com.jarvis.cache.exception.CacheCenterConnectionException,public Map<com.jarvis.cache.to.CacheKeyTO,CacheWrapper<java.lang.Object>> deserialize(Set<com.jarvis.cache.to.CacheKeyTO>, Collection<java....
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-lettuce/src/main/java/com/jarvis/cache/redis/LettuceRedisClusterCacheManager.java
LettuceRedisClusterClient
delete
class LettuceRedisClusterClient implements IRedis { private final StatefulRedisClusterConnection<byte[], byte[]> connection; private final AbstractRedisCacheManager cacheManager; public LettuceRedisClusterClient(StatefulRedisClusterConnection<byte[], byte[]> connection, AbstractRedisCacheMana...
// 为了提升性能,开启pipeline this.connection.setAutoFlushCommands(false); RedisAdvancedClusterAsyncCommands<byte[], byte[]> asyncCommands = connection.async(); try { for (CacheKeyTO cacheKeyTO : keys) { String cacheKey = cacheKeyTO.getCacheKey...
805
273
1,078
<methods>public void <init>(ISerializer<java.lang.Object>) ,public void delete(Set<com.jarvis.cache.to.CacheKeyTO>) throws com.jarvis.cache.exception.CacheCenterConnectionException,public Map<com.jarvis.cache.to.CacheKeyTO,CacheWrapper<java.lang.Object>> deserialize(Set<com.jarvis.cache.to.CacheKeyTO>, Collection<java....
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-lettuce/src/main/java/com/jarvis/cache/redis/LettuceRedisUtil.java
LettuceRedisUtil
executeMGet
class LettuceRedisUtil { public static void executeMSet(AbstractRedisAsyncCommands<byte[], byte[]> pipeline, AbstractRedisCacheManager manager, Collection<MSetParam> params) throws Exception { CacheKeyTO cacheKeyTO; String cacheKey; String hfield; CacheWrapper<Object> result; ...
String hfield; String cacheKey; byte[] key; RedisFuture<byte[]>[] futures = new RedisFuture[keys.size()]; try { // 为了提升性能,开启pipeline connection.setAutoFlushCommands(false); int i = 0; for (CacheKeyTO cacheKeyTO : keys) { ...
501
449
950
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-memcache/src/main/java/com/jarvis/cache/memcache/MemcachedCacheManager.java
MemcachedCacheManager
get
class MemcachedCacheManager implements ICacheManager { private MemcachedClient memcachedClient; public MemcachedCacheManager() { } @Override public void setCache(final CacheKeyTO cacheKeyTO, final CacheWrapper<Object> result, final Method method) throws CacheCenterConnectionException { if...
if (null == cacheKeyTO) { return null; } String cacheKey = cacheKeyTO.getCacheKey(); if (null == cacheKey || cacheKey.isEmpty()) { return null; } String hfield = cacheKeyTO.getHfield(); if (null != hfield && hfield.length() > 0) { ...
1,025
131
1,156
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-manager/autoload-cache-manager-redis/src/main/java/com/jarvis/cache/redis/AbstractRedisCacheManager.java
AbstractRedisCacheManager
setCache
class AbstractRedisCacheManager implements ICacheManager { public static final StringSerializer KEY_SERIALIZER = new StringSerializer(); private static final Logger log = LoggerFactory.getLogger(AbstractRedisCacheManager.class); /** * Hash的缓存时长:等于0时永久缓存;大于0时,主要是为了防止一些已经不用的缓存占用内存;hashExpire小于0时,则...
if (null == cacheKeyTO) { return; } String cacheKey = cacheKeyTO.getCacheKey(); if (null == cacheKey || cacheKey.isEmpty()) { return; } try (IRedis redis = getRedis()) { String hfield = cacheKeyTO.getHfield(); byte[] key = ...
1,232
337
1,569
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-script/autoload-cache-script-js/src/main/java/com/jarvis/cache/script/JavaScriptParser.java
JavaScriptParser
addFunction
class JavaScriptParser extends AbstractScriptParser { private final ScriptEngineManager manager = new ScriptEngineManager(); private final ConcurrentHashMap<String, CompiledScript> expCache = new ConcurrentHashMap<String, CompiledScript>(); private final StringBuffer funcs = new StringBuffer(); priv...
try { String clsName = method.getDeclaringClass().getName(); String methodName = method.getName(); funcs.append("function " + name + "(obj){return " + clsName + "." + methodName + "(obj);}"); } catch (Exception e) { e.printStackTrace(); }
487
88
575
<methods>public non-sealed void <init>() ,public abstract void addFunction(java.lang.String, java.lang.reflect.Method) ,public java.lang.String getDefinedCacheKey(java.lang.String, java.lang.Object, java.lang.Object[], java.lang.Object, boolean) throws java.lang.Exception,public abstract T getElValue(java.lang.String, ...
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-script/autoload-cache-script-ognl/src/main/java/com/jarvis/cache/script/OgnlParser.java
OgnlParser
getElValue
class OgnlParser extends AbstractScriptParser { private final ConcurrentHashMap<String, Object> EXPRESSION_CACHE = new ConcurrentHashMap<String, Object>(); private final ConcurrentHashMap<String, Class<?>> funcs = new ConcurrentHashMap<String, Class<?>>(8); public OgnlParser() { } @Override ...
if (valueType.equals(String.class)) { if (exp.indexOf("#") == -1 && exp.indexOf("@") == -1 && exp.indexOf("'") == -1) {// 如果不是表达式,直接返回字符串 return (T) exp; } } Object object = EXPRESSION_CACHE.get(exp); if (null == object) { String class...
202
454
656
<methods>public non-sealed void <init>() ,public abstract void addFunction(java.lang.String, java.lang.reflect.Method) ,public java.lang.String getDefinedCacheKey(java.lang.String, java.lang.Object, java.lang.Object[], java.lang.Object, boolean) throws java.lang.Exception,public abstract T getElValue(java.lang.String, ...
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-script/autoload-cache-script-springel/src/main/java/com/jarvis/cache/script/SpringELParser.java
SpringELParser
getElValue
class SpringELParser extends AbstractScriptParser { /** * # 号 */ private static final String POUND = "#"; /** * 撇号 */ private static final String apostrophe = "'"; private final ExpressionParser parser = new SpelExpressionParser(); private final ConcurrentHashMap<String, ...
if (valueType.equals(String.class)) { // 如果不是表达式,直接返回字符串 if (keySpEL.indexOf(POUND) == -1 && keySpEL.indexOf("'") == -1) { return (T) keySpEL; } } StandardEvaluationContext context = new StandardEvaluationContext(); context.registerFu...
409
302
711
<methods>public non-sealed void <init>() ,public abstract void addFunction(java.lang.String, java.lang.reflect.Method) ,public java.lang.String getDefinedCacheKey(java.lang.String, java.lang.Object, java.lang.Object[], java.lang.Object, boolean) throws java.lang.Exception,public abstract T getElValue(java.lang.String, ...
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-api/src/main/java/com/jarvis/cache/clone/Cloning.java
Cloning
deepClone
class Cloning implements ICloner { private final Cloner cloner = new Cloner(); @Override public Object deepClone(Object obj, final Type type) throws Exception {<FILL_FUNCTION_BODY>} @Override public Object[] deepCloneMethodArgs(Method method, Object[] args) throws Exception { if (null == ...
if (null == obj) { return null; } Class<?> clazz = obj.getClass(); if (BeanUtil.isPrimitive(obj) || clazz.isEnum() || obj instanceof Class || clazz.isAnnotation() || clazz.isSynthetic()) {// 常见不会被修改的数据类型 return obj; } if (obj insta...
254
301
555
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-api/src/main/java/com/jarvis/cache/compress/CommonsCompressor.java
CommonsCompressor
compress
class CommonsCompressor implements ICompressor { private static final int BUFFER = 1024; private static final CompressorStreamFactory FACTORY = new CompressorStreamFactory(); private String name; public CommonsCompressor(String name) { this.name = name; } @Override public byte[]...
ByteArrayOutputStream baos = new ByteArrayOutputStream(); CompressorOutputStream cos = FACTORY.createCompressorOutputStream(name, baos); int len; byte buf[] = new byte[BUFFER]; while ((len = bais.read(buf, 0, BUFFER)) != -1) { cos.write(buf, 0, len); } ...
284
148
432
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-api/src/main/java/com/jarvis/cache/serializer/CompressorSerializer.java
CompressorSerializer
serialize
class CompressorSerializer implements ISerializer<Object> { private static final int DEFAULT_COMPRESSION_THRESHOLD = 16384; private int compressionThreshold = DEFAULT_COMPRESSION_THRESHOLD; private final ISerializer<Object> serializer; private final ICompressor compressor; public CompressorSeri...
if (null == obj) { return null; } byte[] data = serializer.serialize(obj); byte flag = 0; if (data.length > compressionThreshold) { data = compressor.compress(new ByteArrayInputStream(data)); flag = 1; } byte[] out = new byte[d...
633
130
763
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-api/src/main/java/com/jarvis/cache/serializer/StringSerializer.java
StringSerializer
deepClone
class StringSerializer implements ISerializer<String> { private final Charset charset; public StringSerializer() { this(StandardCharsets.UTF_8); } public StringSerializer(Charset charset) { this.charset = charset; } @Override public String deserialize(byte[] bytes, Type r...
if (null == obj) { return obj; } String str = (String) obj; return String.copyValueOf(str.toCharArray());
224
45
269
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-fastjson/src/main/java/com/jarvis/cache/serializer/FastjsonSerializer.java
FastjsonSerializer
deepCloneMethodArgs
class FastjsonSerializer implements ISerializer<Object> { private final Charset charset; private static final SerializerFeature[] FEATURES = {SerializerFeature.DisableCircularReferenceDetect}; private static final Map<Type, ParameterizedTypeImpl> TYPE_CACHE = new ConcurrentHashMap<>(1024); public Fa...
if (null == args || args.length == 0) { return args; } Type[] genericParameterTypes = method.getGenericParameterTypes(); if (args.length != genericParameterTypes.length) { throw new Exception("the length of " + method.getDeclaringClass().getName() + "." + method....
1,174
300
1,474
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-hessian/src/main/java/com/jarvis/cache/serializer/HessianSerializer.java
HessianSerializer
deepCloneMethodArgs
class HessianSerializer implements ISerializer<Object> { private static final SerializerFactory SERIALIZER_FACTORY = new SerializerFactory(); static { SERIALIZER_FACTORY.addFactory(new HessionBigDecimalSerializerFactory()); SERIALIZER_FACTORY.addFactory(new HessionSoftReferenceSerializerFactor...
if (null == args || args.length == 0) { return args; } Type[] genericParameterTypes = method.getGenericParameterTypes(); if (args.length != genericParameterTypes.length) { throw new Exception("the length of " + method.getDeclaringClass().getName() + "." + method....
655
167
822
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-hessian/src/main/java/com/jarvis/cache/serializer/hession/SoftReferenceDeserializer.java
SoftReferenceDeserializer
readObject
class SoftReferenceDeserializer extends AbstractMapDeserializer { @Override public Object readObject(AbstractHessianInput in, Object[] fields) throws IOException {<FILL_FUNCTION_BODY>} protected SoftReference<Object> instantiate() throws Exception { Object obj = new Object(); return new So...
try { SoftReference<Object> obj = instantiate(); in.addRef(obj); Object value = in.readObject(); obj = null; return new SoftReference<Object>(value); } catch (IOException e) { throw e; } catch (Exception e) { th...
93
92
185
<methods>public void <init>() ,public Class#RAW getType() ,public java.lang.Object readObject(com.caucho.hessian.io.AbstractHessianInput) throws java.io.IOException<variables>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-hessian/src/main/java/com/jarvis/cache/serializer/hession/SoftReferenceSerializer.java
SoftReferenceSerializer
writeObject
class SoftReferenceSerializer extends AbstractSerializer implements ObjectSerializer { @Override public Serializer getObjectSerializer() { return this; } @Override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException {<FILL_FUNCTION_BODY>} }
if (out.addRef(obj)) { return; } @SuppressWarnings("unchecked") SoftReference<Object> data = (SoftReference<Object>) obj; int refV = out.writeObjectBegin(SoftReference.class.getName()); if (refV == -1) { out.writeInt(1); out.writeStr...
74
188
262
<methods>public void <init>() ,public void writeObject(java.lang.Object, com.caucho.hessian.io.AbstractHessianOutput) throws java.io.IOException<variables>public static final com.caucho.hessian.io.AbstractSerializer.NullSerializer NULL,protected static final java.util.logging.Logger log
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-hessian/src/main/java/com/jarvis/cache/serializer/hession/WeakReferenceDeserializer.java
WeakReferenceDeserializer
readObject
class WeakReferenceDeserializer extends AbstractMapDeserializer { @Override public Object readObject(AbstractHessianInput in, Object[] fields) throws IOException {<FILL_FUNCTION_BODY>} protected WeakReference<Object> instantiate() throws Exception { Object obj = new Object(); return new We...
try { WeakReference<Object> obj = instantiate(); in.addRef(obj); Object value = in.readObject(); obj = null; return new WeakReference<Object>(value); } catch (IOException e) { throw e; } catch (Exception e) { th...
96
94
190
<methods>public void <init>() ,public Class#RAW getType() ,public java.lang.Object readObject(com.caucho.hessian.io.AbstractHessianInput) throws java.io.IOException<variables>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-hessian/src/main/java/com/jarvis/cache/serializer/hession/WeakReferenceSerializer.java
WeakReferenceSerializer
writeObject
class WeakReferenceSerializer extends AbstractSerializer implements ObjectSerializer { @Override public Serializer getObjectSerializer() { return this; } @Override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException {<FILL_FUNCTION_BODY>} }
if (out.addRef(obj)) { return; } @SuppressWarnings("unchecked") WeakReference<Object> data = (WeakReference<Object>) obj; int refV = out.writeObjectBegin(WeakReference.class.getName()); if (refV == -1) { out.writeInt(1); out.writeStr...
75
192
267
<methods>public void <init>() ,public void writeObject(java.lang.Object, com.caucho.hessian.io.AbstractHessianOutput) throws java.io.IOException<variables>public static final com.caucho.hessian.io.AbstractSerializer.NullSerializer NULL,protected static final java.util.logging.Logger log
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-jackson-msgpack/src/main/java/com/jarvis/cache/serializer/JacksonMsgpackSerializer.java
JacksonMsgpackSerializer
deepClone
class JacksonMsgpackSerializer implements ISerializer<Object> { private static final ObjectMapper MAPPER = new ObjectMapper(new MessagePackFactory()); @Override public byte[] serialize(Object obj) throws Exception { if (obj == null) { return null; } return MAPPER.writeV...
if (null == obj) { return null; } Class<?> clazz = obj.getClass(); if (BeanUtil.isPrimitive(obj) || clazz.isEnum() || obj instanceof Class || clazz.isAnnotation() || clazz.isSynthetic()) {// 常见不会被修改的数据类型 return obj; } if (obj insta...
610
714
1,324
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-jackson/src/main/java/com/jarvis/cache/serializer/JacksonJsonSerializer.java
NullValueSerializer
deepCloneMethodArgs
class NullValueSerializer extends StdSerializer<NullValue> { private static final long serialVersionUID = 1999052150548658808L; private final String classIdentifier; /** * @param classIdentifier can be {@literal null} and will be defaulted * to {@code ...
if (null == args || args.length == 0) { return args; } Type[] genericParameterTypes = method.getGenericParameterTypes(); if (args.length != genericParameterTypes.length) { throw new Exception("the length of " + method.getDeclaringClass().getName() + "." + method....
1,266
322
1,588
<no_super_class>
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-jdk/src/main/java/com/jarvis/cache/serializer/JdkSerializer.java
JdkSerializer
deserialize
class JdkSerializer implements ISerializer<Object> { @Override public Object deserialize(byte[] bytes, Type returnType) throws Exception {<FILL_FUNCTION_BODY>} @Override public byte[] serialize(Object obj) throws Exception { if (obj == null) { return new byte[0]; } ...
if (null == bytes || bytes.length == 0) { return null; } ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); ObjectInputStream input = new ObjectInputStream(inputStream); return input.readObject();
546
62
608
<no_super_class>
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
5