id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
53,200
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/CacheManagerImpl.java
CacheManagerImpl.eventuallyThrowException
static void eventuallyThrowException(List<Throwable> _suppressedExceptions) { if (_suppressedExceptions.isEmpty()) { return; } Throwable _error = null; for (Throwable t : _suppressedExceptions) { if (t instanceof Error) { _error = t; break; } if (t instanceof ExecutionException && ...
java
static void eventuallyThrowException(List<Throwable> _suppressedExceptions) { if (_suppressedExceptions.isEmpty()) { return; } Throwable _error = null; for (Throwable t : _suppressedExceptions) { if (t instanceof Error) { _error = t; break; } if (t instanceof ExecutionException && ...
[ "static", "void", "eventuallyThrowException", "(", "List", "<", "Throwable", ">", "_suppressedExceptions", ")", "{", "if", "(", "_suppressedExceptions", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Throwable", "_error", "=", "null", ";", "for", "...
During the shutdown of the cache manager multiple exceptions can happen from various caches. The list of exceptions gets examined to throw one exception. <p>If an error is present, the first found gets thrown as CacheInternalError. If no error is present the first normal exception gets thrown as CacheException. <p>Th...
[ "During", "the", "shutdown", "of", "the", "cache", "manager", "multiple", "exceptions", "can", "happen", "from", "various", "caches", ".", "The", "list", "of", "exceptions", "gets", "examined", "to", "throw", "one", "exception", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/CacheManagerImpl.java#L330-L351
53,201
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/CacheManagerImpl.java
CacheManagerImpl.getManagerId
private String getManagerId() { return "name='" + name + "', objectId=" + Integer.toString(System.identityHashCode(this), 36) + ", classloaderId=" + Integer.toString(System.identityHashCode(classLoader), 36) + ", default=" + defaultManager; }
java
private String getManagerId() { return "name='" + name + "', objectId=" + Integer.toString(System.identityHashCode(this), 36) + ", classloaderId=" + Integer.toString(System.identityHashCode(classLoader), 36) + ", default=" + defaultManager; }
[ "private", "String", "getManagerId", "(", ")", "{", "return", "\"name='\"", "+", "name", "+", "\"', objectId=\"", "+", "Integer", ".", "toString", "(", "System", ".", "identityHashCode", "(", "this", ")", ",", "36", ")", "+", "\", classloaderId=\"", "+", "In...
Relevant information to id a manager. Since there could be multiple cache managers for each class loader, better
[ "Relevant", "information", "to", "id", "a", "manager", ".", "Since", "there", "could", "be", "multiple", "cache", "managers", "for", "each", "class", "loader", "better" ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/CacheManagerImpl.java#L399-L404
53,202
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Entry.java
Entry.checkAndSwitchProcessingState
public boolean checkAndSwitchProcessingState(int ps0, int ps) { long rt = refreshTimeAndState; long _expect = withState(rt, ps0); long _update = withState(rt, ps); return STATE_UPDATER.compareAndSet(this, _expect, _update); }
java
public boolean checkAndSwitchProcessingState(int ps0, int ps) { long rt = refreshTimeAndState; long _expect = withState(rt, ps0); long _update = withState(rt, ps); return STATE_UPDATER.compareAndSet(this, _expect, _update); }
[ "public", "boolean", "checkAndSwitchProcessingState", "(", "int", "ps0", ",", "int", "ps", ")", "{", "long", "rt", "=", "refreshTimeAndState", ";", "long", "_expect", "=", "withState", "(", "rt", ",", "ps0", ")", ";", "long", "_update", "=", "withState", "...
Check and switch the processing state atomically.
[ "Check", "and", "switch", "the", "processing", "state", "atomically", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Entry.java#L315-L320
53,203
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Entry.java
Entry.existingPiggyBackForInserting
private PiggyBack existingPiggyBackForInserting() { Object _misc = misc; if (_misc instanceof SimpleTimerTask) { return new TaskPiggyBack((SimpleTimerTask) _misc, null); } return (PiggyBack) _misc; }
java
private PiggyBack existingPiggyBackForInserting() { Object _misc = misc; if (_misc instanceof SimpleTimerTask) { return new TaskPiggyBack((SimpleTimerTask) _misc, null); } return (PiggyBack) _misc; }
[ "private", "PiggyBack", "existingPiggyBackForInserting", "(", ")", "{", "Object", "_misc", "=", "misc", ";", "if", "(", "_misc", "instanceof", "SimpleTimerTask", ")", "{", "return", "new", "TaskPiggyBack", "(", "(", "SimpleTimerTask", ")", "_misc", ",", "null", ...
We want to add a new piggy back. Check for timer task and convert it to piggy back.
[ "We", "want", "to", "add", "a", "new", "piggy", "back", ".", "Check", "for", "timer", "task", "and", "convert", "it", "to", "piggy", "back", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Entry.java#L644-L650
53,204
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Entry.java
Entry.resetSuppressedLoadExceptionInformation
public void resetSuppressedLoadExceptionInformation() { LoadExceptionPiggyBack inf = getPiggyBack(LoadExceptionPiggyBack.class); if (inf != null) { inf.info = null; } }
java
public void resetSuppressedLoadExceptionInformation() { LoadExceptionPiggyBack inf = getPiggyBack(LoadExceptionPiggyBack.class); if (inf != null) { inf.info = null; } }
[ "public", "void", "resetSuppressedLoadExceptionInformation", "(", ")", "{", "LoadExceptionPiggyBack", "inf", "=", "getPiggyBack", "(", "LoadExceptionPiggyBack", ".", "class", ")", ";", "if", "(", "inf", "!=", "null", ")", "{", "inf", ".", "info", "=", "null", ...
If the entry carries information about a suppressed exception, clear it.
[ "If", "the", "entry", "carries", "information", "about", "a", "suppressed", "exception", "clear", "it", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Entry.java#L664-L669
53,205
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.lookup
public Entry<K,V> lookup(K key, int _hash, int _keyValue) { OptimisticLock[] _locks = locks; int si = _hash & LOCK_MASK; OptimisticLock l = _locks[si]; long _stamp = l.tryOptimisticRead(); Entry<K,V>[] tab = entries; if (tab == null) { throw new CacheClosedException(cache); } Entry...
java
public Entry<K,V> lookup(K key, int _hash, int _keyValue) { OptimisticLock[] _locks = locks; int si = _hash & LOCK_MASK; OptimisticLock l = _locks[si]; long _stamp = l.tryOptimisticRead(); Entry<K,V>[] tab = entries; if (tab == null) { throw new CacheClosedException(cache); } Entry...
[ "public", "Entry", "<", "K", ",", "V", ">", "lookup", "(", "K", "key", ",", "int", "_hash", ",", "int", "_keyValue", ")", "{", "OptimisticLock", "[", "]", "_locks", "=", "locks", ";", "int", "si", "=", "_hash", "&", "LOCK_MASK", ";", "OptimisticLock"...
Lookup the entry in the hash table and return it. First tries an optimistic read.
[ "Lookup", "the", "entry", "in", "the", "hash", "table", "and", "return", "it", ".", "First", "tries", "an", "optimistic", "read", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L109-L152
53,206
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.insertWithinLock
public Entry<K,V> insertWithinLock(Entry<K,V> e, int _hash, int _keyValue) { K key = e.getKeyObj(); int si = _hash & LOCK_MASK; Entry<K,V> f; Object ek; Entry<K,V>[] tab = entries; if (tab == null) { throw new CacheClosedException(cache); } int n = tab.length, _mask = n - 1, idx = _hash & ...
java
public Entry<K,V> insertWithinLock(Entry<K,V> e, int _hash, int _keyValue) { K key = e.getKeyObj(); int si = _hash & LOCK_MASK; Entry<K,V> f; Object ek; Entry<K,V>[] tab = entries; if (tab == null) { throw new CacheClosedException(cache); } int n = tab.length, _mask = n - 1, idx = _hash & ...
[ "public", "Entry", "<", "K", ",", "V", ">", "insertWithinLock", "(", "Entry", "<", "K", ",", "V", ">", "e", ",", "int", "_hash", ",", "int", "_keyValue", ")", "{", "K", "key", "=", "e", ".", "getKeyObj", "(", ")", ";", "int", "si", "=", "_hash"...
Insert an entry. Checks if an entry already exists.
[ "Insert", "an", "entry", ".", "Checks", "if", "an", "entry", "already", "exists", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L164-L183
53,207
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.remove
public boolean remove(Entry<K,V> e) { int _hash = modifiedHashCode(e.hashCode); OptimisticLock[] _locks = locks; int si = _hash & LOCK_MASK; OptimisticLock l = _locks[si]; long _stamp = l.writeLock(); try { Entry<K,V> f; Entry<K,V>[] tab = entries; if (tab == null) { throw ne...
java
public boolean remove(Entry<K,V> e) { int _hash = modifiedHashCode(e.hashCode); OptimisticLock[] _locks = locks; int si = _hash & LOCK_MASK; OptimisticLock l = _locks[si]; long _stamp = l.writeLock(); try { Entry<K,V> f; Entry<K,V>[] tab = entries; if (tab == null) { throw ne...
[ "public", "boolean", "remove", "(", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "int", "_hash", "=", "modifiedHashCode", "(", "e", ".", "hashCode", ")", ";", "OptimisticLock", "[", "]", "_locks", "=", "locks", ";", "int", "si", "=", "_hash", "...
Remove existing entry from the hash. @return true, if entry was found and removed.
[ "Remove", "existing", "entry", "from", "the", "hash", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L210-L241
53,208
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.eventuallyExpand
private void eventuallyExpand(int _segmentIndex) { long[] _stamps = lockAll(); try { long _size = segmentSize[_segmentIndex].get(); if (_size <= segmentMaxFill) { return; } rehash(); } finally { unlockAll(_stamps); } }
java
private void eventuallyExpand(int _segmentIndex) { long[] _stamps = lockAll(); try { long _size = segmentSize[_segmentIndex].get(); if (_size <= segmentMaxFill) { return; } rehash(); } finally { unlockAll(_stamps); } }
[ "private", "void", "eventuallyExpand", "(", "int", "_segmentIndex", ")", "{", "long", "[", "]", "_stamps", "=", "lockAll", "(", ")", ";", "try", "{", "long", "_size", "=", "segmentSize", "[", "_segmentIndex", "]", ".", "get", "(", ")", ";", "if", "(", ...
Acquire all segment locks and rehash, if really needed.
[ "Acquire", "all", "segment", "locks", "and", "rehash", "if", "really", "needed", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L272-L283
53,209
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.lockAll
private long[] lockAll() { OptimisticLock[] _locks = locks; int sn = _locks.length; long[] _stamps = new long[locks.length]; for (int i = 0; i < sn; i++) { OptimisticLock l = _locks[i]; _stamps[i] = l.writeLock(); } return _stamps; }
java
private long[] lockAll() { OptimisticLock[] _locks = locks; int sn = _locks.length; long[] _stamps = new long[locks.length]; for (int i = 0; i < sn; i++) { OptimisticLock l = _locks[i]; _stamps[i] = l.writeLock(); } return _stamps; }
[ "private", "long", "[", "]", "lockAll", "(", ")", "{", "OptimisticLock", "[", "]", "_locks", "=", "locks", ";", "int", "sn", "=", "_locks", ".", "length", ";", "long", "[", "]", "_stamps", "=", "new", "long", "[", "locks", ".", "length", "]", ";", ...
Acquire all segment locks and return an array with the lock stamps.
[ "Acquire", "all", "segment", "locks", "and", "return", "an", "array", "with", "the", "lock", "stamps", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L288-L297
53,210
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.unlockAll
private void unlockAll(long[] _stamps) { OptimisticLock[] _locks = locks; int sn = _locks.length; for (int i = 0; i < sn; i++) { _locks[i].unlockWrite(_stamps[i]); } }
java
private void unlockAll(long[] _stamps) { OptimisticLock[] _locks = locks; int sn = _locks.length; for (int i = 0; i < sn; i++) { _locks[i].unlockWrite(_stamps[i]); } }
[ "private", "void", "unlockAll", "(", "long", "[", "]", "_stamps", ")", "{", "OptimisticLock", "[", "]", "_locks", "=", "locks", ";", "int", "sn", "=", "_locks", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sn", ";", "i", ...
Release the all segment locks. @param _stamps array with the lock stamps.
[ "Release", "the", "all", "segment", "locks", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L304-L310
53,211
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.rehash
@SuppressWarnings("unchecked") void rehash() { Entry<K,V>[] src = entries; if (src == null) { throw new CacheClosedException(cache); } int i, sl = src.length, n = sl * 2, _mask = n - 1, idx; Entry<K,V>[] tab = new Entry[n]; long _count = 0; Entry _next, e; for (i = 0; i < sl; i++) { ...
java
@SuppressWarnings("unchecked") void rehash() { Entry<K,V>[] src = entries; if (src == null) { throw new CacheClosedException(cache); } int i, sl = src.length, n = sl * 2, _mask = n - 1, idx; Entry<K,V>[] tab = new Entry[n]; long _count = 0; Entry _next, e; for (i = 0; i < sl; i++) { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "rehash", "(", ")", "{", "Entry", "<", "K", ",", "V", ">", "[", "]", "src", "=", "entries", ";", "if", "(", "src", "==", "null", ")", "{", "throw", "new", "CacheClosedException", "(", "cache...
Double the hash table size and rehash the entries. Assumes total lock.
[ "Double", "the", "hash", "table", "size", "and", "rehash", "the", "entries", ".", "Assumes", "total", "lock", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L319-L338
53,212
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.runTotalLocked
public <T> T runTotalLocked(Job<T> j) { long[] _stamps = lockAll(); try { return j.call(); } finally { unlockAll(_stamps); } }
java
public <T> T runTotalLocked(Job<T> j) { long[] _stamps = lockAll(); try { return j.call(); } finally { unlockAll(_stamps); } }
[ "public", "<", "T", ">", "T", "runTotalLocked", "(", "Job", "<", "T", ">", "j", ")", "{", "long", "[", "]", "_stamps", "=", "lockAll", "(", ")", ";", "try", "{", "return", "j", ".", "call", "(", ")", ";", "}", "finally", "{", "unlockAll", "(", ...
Lock all segments and run the job.
[ "Lock", "all", "segments", "and", "run", "the", "job", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L351-L358
53,213
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Hash2.java
Hash2.calcEntryCount
public long calcEntryCount() { long _count = 0; for (Entry e : entries) { while (e != null) { _count++; e = e.another; } } return _count; }
java
public long calcEntryCount() { long _count = 0; for (Entry e : entries) { while (e != null) { _count++; e = e.another; } } return _count; }
[ "public", "long", "calcEntryCount", "(", ")", "{", "long", "_count", "=", "0", ";", "for", "(", "Entry", "e", ":", "entries", ")", "{", "while", "(", "e", "!=", "null", ")", "{", "_count", "++", ";", "e", "=", "e", ".", "another", ";", "}", "}"...
Count the entries in the hash table, by scanning through the hash table. This is used for integrity checks.
[ "Count", "the", "entries", "in", "the", "hash", "table", "by", "scanning", "through", "the", "hash", "table", ".", "This", "is", "used", "for", "integrity", "checks", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Hash2.java#L409-L418
53,214
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheManagerAdapter.java
JCacheManagerAdapter.findJCacheJmxSupportInstance
private static JCacheJmxSupport findJCacheJmxSupportInstance() { for (CacheLifeCycleListener l : CacheManagerImpl.getCacheLifeCycleListeners()) { if (l instanceof JCacheJmxSupport) { return (JCacheJmxSupport) l; } } throw new LinkageError("JCacheJmxSupport not loaded"); }
java
private static JCacheJmxSupport findJCacheJmxSupportInstance() { for (CacheLifeCycleListener l : CacheManagerImpl.getCacheLifeCycleListeners()) { if (l instanceof JCacheJmxSupport) { return (JCacheJmxSupport) l; } } throw new LinkageError("JCacheJmxSupport not loaded"); }
[ "private", "static", "JCacheJmxSupport", "findJCacheJmxSupportInstance", "(", ")", "{", "for", "(", "CacheLifeCycleListener", "l", ":", "CacheManagerImpl", ".", "getCacheLifeCycleListeners", "(", ")", ")", "{", "if", "(", "l", "instanceof", "JCacheJmxSupport", ")", ...
The JMX support is already created via the serviceloader
[ "The", "JMX", "support", "is", "already", "created", "via", "the", "serviceloader" ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheManagerAdapter.java#L52-L59
53,215
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheManagerAdapter.java
JCacheManagerAdapter.resolveCacheWrapper
public Cache resolveCacheWrapper(org.cache2k.Cache _c2kCache) { synchronized (getLockObject()) { return c2k2jCache.get(_c2kCache); } }
java
public Cache resolveCacheWrapper(org.cache2k.Cache _c2kCache) { synchronized (getLockObject()) { return c2k2jCache.get(_c2kCache); } }
[ "public", "Cache", "resolveCacheWrapper", "(", "org", ".", "cache2k", ".", "Cache", "_c2kCache", ")", "{", "synchronized", "(", "getLockObject", "(", ")", ")", "{", "return", "c2k2jCache", ".", "get", "(", "_c2kCache", ")", ";", "}", "}" ]
Return the JCache wrapper for a c2k cache.
[ "Return", "the", "JCache", "wrapper", "for", "a", "c2k", "cache", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheManagerAdapter.java#L302-L306
53,216
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/ClockProPlusEviction.java
ClockProPlusEviction.removeFromReplacementList
@Override protected void removeFromReplacementList(Entry e) { if (e.isHot()) { hotHits += e.hitCnt; handHot = Entry.removeFromCyclicList(handHot, e); hotSize--; } else { coldHits += e.hitCnt; handCold = Entry.removeFromCyclicList(handCold, e); coldSize--; } }
java
@Override protected void removeFromReplacementList(Entry e) { if (e.isHot()) { hotHits += e.hitCnt; handHot = Entry.removeFromCyclicList(handHot, e); hotSize--; } else { coldHits += e.hitCnt; handCold = Entry.removeFromCyclicList(handCold, e); coldSize--; } }
[ "@", "Override", "protected", "void", "removeFromReplacementList", "(", "Entry", "e", ")", "{", "if", "(", "e", ".", "isHot", "(", ")", ")", "{", "hotHits", "+=", "e", ".", "hitCnt", ";", "handHot", "=", "Entry", ".", "removeFromCyclicList", "(", "handHo...
Remove, expire or eviction of an entry happens. Remove the entry from the replacement list data structure. <p>Why don't generate ghosts here? If the entry is removed because of a programmatic remove or expiry we should not occupy any resources. Removing and expiry may also take place when no eviction is needed at all,...
[ "Remove", "expire", "or", "eviction", "of", "an", "entry", "happens", ".", "Remove", "the", "entry", "from", "the", "replacement", "list", "data", "structure", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/ClockProPlusEviction.java#L151-L162
53,217
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/ClockProPlusEviction.java
ClockProPlusEviction.findEvictionCandidate
@Override protected Entry findEvictionCandidate(Entry _previous) { coldRunCnt++; Entry _hand = handCold; int _scanCnt = 1; if (_hand == null) { _hand = refillFromHot(_hand); } if (_hand.hitCnt > 0) { _hand = refillFromHot(_hand); do { _scanCnt++; coldHits += _...
java
@Override protected Entry findEvictionCandidate(Entry _previous) { coldRunCnt++; Entry _hand = handCold; int _scanCnt = 1; if (_hand == null) { _hand = refillFromHot(_hand); } if (_hand.hitCnt > 0) { _hand = refillFromHot(_hand); do { _scanCnt++; coldHits += _...
[ "@", "Override", "protected", "Entry", "findEvictionCandidate", "(", "Entry", "_previous", ")", "{", "coldRunCnt", "++", ";", "Entry", "_hand", "=", "handCold", ";", "int", "_scanCnt", "=", "1", ";", "if", "(", "_hand", "==", "null", ")", "{", "_hand", "...
Runs cold hand an in turn hot hand to find eviction candidate.
[ "Runs", "cold", "hand", "an", "in", "turn", "hot", "hand", "to", "find", "eviction", "candidate", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/ClockProPlusEviction.java#L247-L276
53,218
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/IntHeapCache.java
IntHeapCache.createHashTable
@Override public Hash2<Integer, V> createHashTable() { return new Hash2<Integer, V>(this) { @Override protected int modifiedHashCode(final int hc) { return IntHeapCache.this.modifiedHash(hc); } @Override protected boolean keyObjIsEqual(final Integer key, final Entry e) { ...
java
@Override public Hash2<Integer, V> createHashTable() { return new Hash2<Integer, V>(this) { @Override protected int modifiedHashCode(final int hc) { return IntHeapCache.this.modifiedHash(hc); } @Override protected boolean keyObjIsEqual(final Integer key, final Entry e) { ...
[ "@", "Override", "public", "Hash2", "<", "Integer", ",", "V", ">", "createHashTable", "(", ")", "{", "return", "new", "Hash2", "<", "Integer", ",", "V", ">", "(", "this", ")", "{", "@", "Override", "protected", "int", "modifiedHashCode", "(", "final", ...
Modified hash table implementation. Rehash needs to calculate the correct hash code again.
[ "Modified", "hash", "table", "implementation", ".", "Rehash", "needs", "to", "calculate", "the", "correct", "hash", "code", "again", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/IntHeapCache.java#L58-L71
53,219
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/integration/Loaders.java
Loaders.wrapRefreshedTime
@SuppressWarnings("unchecked") public static <V> LoadDetail<V> wrapRefreshedTime(V value, long refreshedTimeInMillis) { return new RefreshedTimeWrapper<V>(value, refreshedTimeInMillis); }
java
@SuppressWarnings("unchecked") public static <V> LoadDetail<V> wrapRefreshedTime(V value, long refreshedTimeInMillis) { return new RefreshedTimeWrapper<V>(value, refreshedTimeInMillis); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "V", ">", "LoadDetail", "<", "V", ">", "wrapRefreshedTime", "(", "V", "value", ",", "long", "refreshedTimeInMillis", ")", "{", "return", "new", "RefreshedTimeWrapper", "<", "V", ">", ...
Wraps a loaded value to add the refreshed value. @see CacheLoader#load(Object) @see AdvancedCacheLoader#load(Object, long, CacheEntry) @see FunctionalCacheLoader#load(Object)
[ "Wraps", "a", "loaded", "value", "to", "add", "the", "refreshed", "value", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/integration/Loaders.java#L39-L42
53,220
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Cache2kCoreProviderImpl.java
Cache2kCoreProviderImpl.registerExtensions
private void registerExtensions() { Iterator<Cache2kExtensionProvider> it = ServiceLoader.load(Cache2kExtensionProvider.class, CacheManager.class.getClassLoader()).iterator(); while (it.hasNext()) { try { it.next().registerCache2kExtension(); } catch (ServiceConfigurationError ex) { ...
java
private void registerExtensions() { Iterator<Cache2kExtensionProvider> it = ServiceLoader.load(Cache2kExtensionProvider.class, CacheManager.class.getClassLoader()).iterator(); while (it.hasNext()) { try { it.next().registerCache2kExtension(); } catch (ServiceConfigurationError ex) { ...
[ "private", "void", "registerExtensions", "(", ")", "{", "Iterator", "<", "Cache2kExtensionProvider", ">", "it", "=", "ServiceLoader", ".", "load", "(", "Cache2kExtensionProvider", ".", "class", ",", "CacheManager", ".", "class", ".", "getClassLoader", "(", ")", ...
ignore load errors, so we can remove the serverSide or the xmlConfiguration code and cache2k core still works
[ "ignore", "load", "errors", "so", "we", "can", "remove", "the", "serverSide", "or", "the", "xmlConfiguration", "code", "and", "cache2k", "core", "still", "works" ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Cache2kCoreProviderImpl.java#L74-L84
53,221
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/Cache2kCoreProviderImpl.java
Cache2kCoreProviderImpl.removeManager
void removeManager(CacheManager cm) { synchronized (getLockObject()) { Map<String, CacheManager> _name2managers = loader2name2manager.get(cm.getClassLoader()); _name2managers = new HashMap<String, CacheManager>(_name2managers); Object _removed = _name2managers.remove(cm.getName()); Map<Class...
java
void removeManager(CacheManager cm) { synchronized (getLockObject()) { Map<String, CacheManager> _name2managers = loader2name2manager.get(cm.getClassLoader()); _name2managers = new HashMap<String, CacheManager>(_name2managers); Object _removed = _name2managers.remove(cm.getName()); Map<Class...
[ "void", "removeManager", "(", "CacheManager", "cm", ")", "{", "synchronized", "(", "getLockObject", "(", ")", ")", "{", "Map", "<", "String", ",", "CacheManager", ">", "_name2managers", "=", "loader2name2manager", ".", "get", "(", "cm", ".", "getClassLoader", ...
Called from the manager after a close. Removes the manager from the known managers.
[ "Called", "from", "the", "manager", "after", "a", "close", ".", "Removes", "the", "manager", "from", "the", "known", "managers", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/Cache2kCoreProviderImpl.java#L170-L184
53,222
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/WiredCache.java
WiredCache.loadAllWithAsyncLoader
private void loadAllWithAsyncLoader(final CacheOperationCompletionListener _listener, final Set<K> _keysToLoad) { final AtomicInteger _countDown = new AtomicInteger(_keysToLoad.size()); EntryAction.ActionCompletedCallback cb = new EntryAction.ActionCompletedCallback() { @Override public void entryAc...
java
private void loadAllWithAsyncLoader(final CacheOperationCompletionListener _listener, final Set<K> _keysToLoad) { final AtomicInteger _countDown = new AtomicInteger(_keysToLoad.size()); EntryAction.ActionCompletedCallback cb = new EntryAction.ActionCompletedCallback() { @Override public void entryAc...
[ "private", "void", "loadAllWithAsyncLoader", "(", "final", "CacheOperationCompletionListener", "_listener", ",", "final", "Set", "<", "K", ">", "_keysToLoad", ")", "{", "final", "AtomicInteger", "_countDown", "=", "new", "AtomicInteger", "(", "_keysToLoad", ".", "si...
Load the keys into the cache via the async path. The key set must always be non empty. The completion listener is called when all keys are loaded.
[ "Load", "the", "keys", "into", "the", "cache", "via", "the", "async", "path", ".", "The", "key", "set", "must", "always", "be", "non", "empty", ".", "The", "completion", "listener", "is", "called", "when", "all", "keys", "are", "loaded", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/WiredCache.java#L282-L298
53,223
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/WiredCache.java
WiredCache.peekAll
@Override public Map<K, V> peekAll(final Iterable<? extends K> keys) { Map<K, CacheEntry<K, V>> map = new HashMap<K, CacheEntry<K, V>>(); for (K k : keys) { CacheEntry<K, V> e = execute(k, SPEC.peekEntry(k)); if (e != null) { map.put(k, e); } } return heapCache.convertCacheEn...
java
@Override public Map<K, V> peekAll(final Iterable<? extends K> keys) { Map<K, CacheEntry<K, V>> map = new HashMap<K, CacheEntry<K, V>>(); for (K k : keys) { CacheEntry<K, V> e = execute(k, SPEC.peekEntry(k)); if (e != null) { map.put(k, e); } } return heapCache.convertCacheEn...
[ "@", "Override", "public", "Map", "<", "K", ",", "V", ">", "peekAll", "(", "final", "Iterable", "<", "?", "extends", "K", ">", "keys", ")", "{", "Map", "<", "K", ",", "CacheEntry", "<", "K", ",", "V", ">", ">", "map", "=", "new", "HashMap", "<"...
We need to deal with possible null values and exceptions. This is a simple placeholder implementation that covers it all by working on the entry.
[ "We", "need", "to", "deal", "with", "possible", "null", "values", "and", "exceptions", ".", "This", "is", "a", "simple", "placeholder", "implementation", "that", "covers", "it", "all", "by", "working", "on", "the", "entry", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/WiredCache.java#L515-L525
53,224
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/WiredCache.java
WiredCache.onEvictionFromHeap
@Override public void onEvictionFromHeap(final Entry<K, V> e) { CacheEntry<K,V> _currentEntry = heapCache.returnCacheEntry(e); if (syncEntryEvictedListeners != null) { for (CacheEntryEvictedListener<K, V> l : syncEntryEvictedListeners) { l.onEntryEvicted(this, _currentEntry); } } }
java
@Override public void onEvictionFromHeap(final Entry<K, V> e) { CacheEntry<K,V> _currentEntry = heapCache.returnCacheEntry(e); if (syncEntryEvictedListeners != null) { for (CacheEntryEvictedListener<K, V> l : syncEntryEvictedListeners) { l.onEntryEvicted(this, _currentEntry); } } }
[ "@", "Override", "public", "void", "onEvictionFromHeap", "(", "final", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "CacheEntry", "<", "K", ",", "V", ">", "_currentEntry", "=", "heapCache", ".", "returnCacheEntry", "(", "e", ")", ";", "if", "(", ...
Nothing done here. Will notify the storage about eviction in some future version.
[ "Nothing", "done", "here", ".", "Will", "notify", "the", "storage", "about", "eviction", "in", "some", "future", "version", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/WiredCache.java#L667-L675
53,225
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/expiry/Expiry.java
Expiry.mixTimeSpanAndPointInTime
public static long mixTimeSpanAndPointInTime(long loadTime, long refreshAfter, long pointInTime) { long _refreshTime = loadTime + refreshAfter; if (_refreshTime < 0) { _refreshTime = ETERNAL; } if (pointInTime == ETERNAL) { return _refreshTime; } if (pointInTime > _refreshTime) { ...
java
public static long mixTimeSpanAndPointInTime(long loadTime, long refreshAfter, long pointInTime) { long _refreshTime = loadTime + refreshAfter; if (_refreshTime < 0) { _refreshTime = ETERNAL; } if (pointInTime == ETERNAL) { return _refreshTime; } if (pointInTime > _refreshTime) { ...
[ "public", "static", "long", "mixTimeSpanAndPointInTime", "(", "long", "loadTime", ",", "long", "refreshAfter", ",", "long", "pointInTime", ")", "{", "long", "_refreshTime", "=", "loadTime", "+", "refreshAfter", ";", "if", "(", "_refreshTime", "<", "0", ")", "{...
Combine a refresh time span and an expiry at a specified point in time. <p>If the expiry time is far ahead of time the refresh time span takes precedence. If the point in time is close by this time takes precedence. If the refresh time is too close to the requested point an earlier refresh time is used to keep maximum...
[ "Combine", "a", "refresh", "time", "span", "and", "an", "expiry", "at", "a", "specified", "point", "in", "time", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/expiry/Expiry.java#L98-L118
53,226
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/event/AsyncDispatcher.java
AsyncDispatcher.getLockObject
private static Object getLockObject(Object key) { int hc = key.hashCode(); return KEY_LOCKS[hc & KEY_LOCKS_MASK]; }
java
private static Object getLockObject(Object key) { int hc = key.hashCode(); return KEY_LOCKS[hc & KEY_LOCKS_MASK]; }
[ "private", "static", "Object", "getLockObject", "(", "Object", "key", ")", "{", "int", "hc", "=", "key", ".", "hashCode", "(", ")", ";", "return", "KEY_LOCKS", "[", "hc", "&", "KEY_LOCKS_MASK", "]", ";", "}" ]
Simulate locking by key, use the hash code to spread and avoid lock contention. The additional locking we introduce here is currently run synchronously inside the entry mutation operation.
[ "Simulate", "locking", "by", "key", "use", "the", "hash", "code", "to", "spread", "and", "avoid", "lock", "contention", ".", "The", "additional", "locking", "we", "introduce", "here", "is", "currently", "run", "synchronously", "inside", "the", "entry", "mutati...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/event/AsyncDispatcher.java#L55-L58
53,227
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/event/AsyncDispatcher.java
AsyncDispatcher.queue
public void queue(final AsyncEvent<K> _event) { final K key = _event.getKey(); synchronized (getLockObject(key)) { Queue<AsyncEvent<K>> q = keyQueue.get(key); if (q != null) { q.add(_event); return; } q = new LinkedList<AsyncEvent<K>>(); keyQueue.put(key, q); } ...
java
public void queue(final AsyncEvent<K> _event) { final K key = _event.getKey(); synchronized (getLockObject(key)) { Queue<AsyncEvent<K>> q = keyQueue.get(key); if (q != null) { q.add(_event); return; } q = new LinkedList<AsyncEvent<K>>(); keyQueue.put(key, q); } ...
[ "public", "void", "queue", "(", "final", "AsyncEvent", "<", "K", ">", "_event", ")", "{", "final", "K", "key", "=", "_event", ".", "getKey", "(", ")", ";", "synchronized", "(", "getLockObject", "(", "key", ")", ")", "{", "Queue", "<", "AsyncEvent", "...
Immediately executes an event with the provided executor. If an event is already executing for the identical key, queue the event and execute the event with FIFO scheme, preserving the order of the arrival.
[ "Immediately", "executes", "an", "event", "with", "the", "provided", "executor", ".", "If", "an", "event", "is", "already", "executing", "for", "the", "identical", "key", "queue", "the", "event", "and", "execute", "the", "event", "with", "FIFO", "scheme", "p...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/event/AsyncDispatcher.java#L74-L92
53,228
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/event/AsyncDispatcher.java
AsyncDispatcher.runMoreOrStop
public void runMoreOrStop(AsyncEvent<K> _event) { for (;;) { try { _event.execute(); } catch (Throwable t) { cache.getLog().warn("Async event exception", t); } final K key = _event.getKey(); synchronized (getLockObject(key)) { Queue<AsyncEvent<K>> q = keyQueue.g...
java
public void runMoreOrStop(AsyncEvent<K> _event) { for (;;) { try { _event.execute(); } catch (Throwable t) { cache.getLog().warn("Async event exception", t); } final K key = _event.getKey(); synchronized (getLockObject(key)) { Queue<AsyncEvent<K>> q = keyQueue.g...
[ "public", "void", "runMoreOrStop", "(", "AsyncEvent", "<", "K", ">", "_event", ")", "{", "for", "(", ";", ";", ")", "{", "try", "{", "_event", ".", "execute", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "cache", ".", "getLog", "...
Run as long there is still an event for the key.
[ "Run", "as", "long", "there", "is", "still", "an", "event", "for", "the", "key", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/event/AsyncDispatcher.java#L97-L114
53,229
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/BaseCache.java
BaseCache.keys
@Override public Iterable<K> keys() { return new Iterable<K>() { @Override public Iterator<K> iterator() { final Iterator<CacheEntry<K,V>> it = BaseCache.this.iterator(); return new Iterator<K>() { @Override public boolean hasNext() { return it.hasNext()...
java
@Override public Iterable<K> keys() { return new Iterable<K>() { @Override public Iterator<K> iterator() { final Iterator<CacheEntry<K,V>> it = BaseCache.this.iterator(); return new Iterator<K>() { @Override public boolean hasNext() { return it.hasNext()...
[ "@", "Override", "public", "Iterable", "<", "K", ">", "keys", "(", ")", "{", "return", "new", "Iterable", "<", "K", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "K", ">", "iterator", "(", ")", "{", "final", "Iterator", "<", "Cach...
Key iteration on top of normal iterator.
[ "Key", "iteration", "on", "top", "of", "normal", "iterator", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/BaseCache.java#L65-L89
53,230
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.setCacheConfig
public void setCacheConfig(final Cache2kConfiguration c) { valueType = c.getValueType(); keyType = c.getKeyType(); if (name != null) { throw new IllegalStateException("already configured"); } setName(c.getName()); setFeatureBit(KEEP_AFTER_EXPIRED, c.isKeepDataAfterExpired()); setFeatur...
java
public void setCacheConfig(final Cache2kConfiguration c) { valueType = c.getValueType(); keyType = c.getKeyType(); if (name != null) { throw new IllegalStateException("already configured"); } setName(c.getName()); setFeatureBit(KEEP_AFTER_EXPIRED, c.isKeepDataAfterExpired()); setFeatur...
[ "public", "void", "setCacheConfig", "(", "final", "Cache2kConfiguration", "c", ")", "{", "valueType", "=", "c", ".", "getValueType", "(", ")", ";", "keyType", "=", "c", ".", "getKeyType", "(", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "throw...
called from CacheBuilder
[ "called", "from", "CacheBuilder" ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L252-L287
53,231
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.setName
public void setName(String n) { if (n == null) { n = this.getClass().getSimpleName() + "#" + cacheCnt++; } name = n; }
java
public void setName(String n) { if (n == null) { n = this.getClass().getSimpleName() + "#" + cacheCnt++; } name = n; }
[ "public", "void", "setName", "(", "String", "n", ")", "{", "if", "(", "n", "==", "null", ")", "{", "n", "=", "this", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\"#\"", "+", "cacheCnt", "++", ";", "}", "name", "=", "n", ";"...
Set the name and configure a logging, used within cache construction.
[ "Set", "the", "name", "and", "configure", "a", "logging", "used", "within", "cache", "construction", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L319-L324
53,232
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.returnEntry
protected CacheEntry<K, V> returnEntry(final ExaminationEntry<K, V> e) { if (e == null) { return null; } return returnCacheEntry(e); }
java
protected CacheEntry<K, V> returnEntry(final ExaminationEntry<K, V> e) { if (e == null) { return null; } return returnCacheEntry(e); }
[ "protected", "CacheEntry", "<", "K", ",", "V", ">", "returnEntry", "(", "final", "ExaminationEntry", "<", "K", ",", "V", ">", "e", ")", "{", "if", "(", "e", "==", "null", ")", "{", "return", "null", ";", "}", "return", "returnCacheEntry", "(", "e", ...
Wrap entry in a separate object instance. We can return the entry directly, however we lock on the entry object.
[ "Wrap", "entry", "in", "a", "separate", "object", "instance", ".", "We", "can", "return", "the", "entry", "directly", "however", "we", "lock", "on", "the", "entry", "object", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L556-L561
53,233
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.putValue
protected final void putValue(final Entry e, final V _value) { if (!isUpdateTimeNeeded()) { insertOrUpdateAndCalculateExpiry(e, _value, 0, 0, 0 , INSERT_STAT_PUT); } else { long t = clock.millis(); insertOrUpdateAndCalculateExpiry(e, _value, t, t, t, INSERT_STAT_PUT); } }
java
protected final void putValue(final Entry e, final V _value) { if (!isUpdateTimeNeeded()) { insertOrUpdateAndCalculateExpiry(e, _value, 0, 0, 0 , INSERT_STAT_PUT); } else { long t = clock.millis(); insertOrUpdateAndCalculateExpiry(e, _value, t, t, t, INSERT_STAT_PUT); } }
[ "protected", "final", "void", "putValue", "(", "final", "Entry", "e", ",", "final", "V", "_value", ")", "{", "if", "(", "!", "isUpdateTimeNeeded", "(", ")", ")", "{", "insertOrUpdateAndCalculateExpiry", "(", "e", ",", "_value", ",", "0", ",", "0", ",", ...
Update the value directly within entry lock. Since we did not start entry processing we do not need to notify any waiting threads.
[ "Update", "the", "value", "directly", "within", "entry", "lock", ".", "Since", "we", "did", "not", "start", "entry", "processing", "we", "do", "not", "need", "to", "notify", "any", "waiting", "threads", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L764-L771
53,234
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.replace
protected boolean replace(final K key, final boolean _compare, final V _oldValue, final V _newValue) { Entry e = lookupEntry(key); if (e == null) { metrics.peekMiss(); return false; } synchronized (e) { e.waitForProcessing(); if (e.isGone() || !e.hasFreshData(clock)) { re...
java
protected boolean replace(final K key, final boolean _compare, final V _oldValue, final V _newValue) { Entry e = lookupEntry(key); if (e == null) { metrics.peekMiss(); return false; } synchronized (e) { e.waitForProcessing(); if (e.isGone() || !e.hasFreshData(clock)) { re...
[ "protected", "boolean", "replace", "(", "final", "K", "key", ",", "final", "boolean", "_compare", ",", "final", "V", "_oldValue", ",", "final", "V", "_newValue", ")", "{", "Entry", "e", "=", "lookupEntry", "(", "key", ")", ";", "if", "(", "e", "==", ...
replace if value matches. if value not matches, return the existing entry or the dummy entry.
[ "replace", "if", "value", "matches", ".", "if", "value", "not", "matches", "return", "the", "existing", "entry", "or", "the", "dummy", "entry", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L786-L803
53,235
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.peekEntryInternal
final protected Entry<K, V> peekEntryInternal(K key) { int hc = modifiedHash(key.hashCode()); return peekEntryInternal(key, hc, extractIntKeyValue(key, hc)); }
java
final protected Entry<K, V> peekEntryInternal(K key) { int hc = modifiedHash(key.hashCode()); return peekEntryInternal(key, hc, extractIntKeyValue(key, hc)); }
[ "final", "protected", "Entry", "<", "K", ",", "V", ">", "peekEntryInternal", "(", "K", "key", ")", "{", "int", "hc", "=", "modifiedHash", "(", "key", ".", "hashCode", "(", ")", ")", ";", "return", "peekEntryInternal", "(", "key", ",", "hc", ",", "ext...
Return the entry, if it is in the cache, without invoking the cache source. <p>The cache storage is asked whether the entry is present. If the entry is not present, this result is cached in the local cache.
[ "Return", "the", "entry", "if", "it", "is", "in", "the", "cache", "without", "invoking", "the", "cache", "source", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L813-L816
53,236
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.removeIfEquals
@Override public boolean removeIfEquals(K key, V _value) { Entry e = lookupEntry(key); if (e == null) { metrics.peekMiss(); return false; } synchronized (e) { e.waitForProcessing(); if (e.isGone()) { metrics.peekMiss(); return false; } boolean f = e....
java
@Override public boolean removeIfEquals(K key, V _value) { Entry e = lookupEntry(key); if (e == null) { metrics.peekMiss(); return false; } synchronized (e) { e.waitForProcessing(); if (e.isGone()) { metrics.peekMiss(); return false; } boolean f = e....
[ "@", "Override", "public", "boolean", "removeIfEquals", "(", "K", "key", ",", "V", "_value", ")", "{", "Entry", "e", "=", "lookupEntry", "(", "key", ")", ";", "if", "(", "e", "==", "null", ")", "{", "metrics", ".", "peekMiss", "(", ")", ";", "retur...
Remove the object from the cache.
[ "Remove", "the", "object", "from", "the", "cache", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L968-L993
53,237
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.loadAndReplace
protected void loadAndReplace(K key) { Entry e; for (;;) { e = lookupOrNewEntry(key); synchronized (e) { e.waitForProcessing(); if (e.isGone()) { metrics.goneSpin(); continue; } e.startProcessing(Entry.ProcessingState.LOAD); break; } ...
java
protected void loadAndReplace(K key) { Entry e; for (;;) { e = lookupOrNewEntry(key); synchronized (e) { e.waitForProcessing(); if (e.isGone()) { metrics.goneSpin(); continue; } e.startProcessing(Entry.ProcessingState.LOAD); break; } ...
[ "protected", "void", "loadAndReplace", "(", "K", "key", ")", "{", "Entry", "e", ";", "for", "(", ";", ";", ")", "{", "e", "=", "lookupOrNewEntry", "(", "key", ")", ";", "synchronized", "(", "e", ")", "{", "e", ".", "waitForProcessing", "(", ")", ";...
Always fetch the value from the source. That is a copy of getEntryInternal without freshness checks.
[ "Always", "fetch", "the", "value", "from", "the", "source", ".", "That", "is", "a", "copy", "of", "getEntryInternal", "without", "freshness", "checks", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1198-L1219
53,238
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.checkForHashCodeChange
private void checkForHashCodeChange(Entry<K, V> e) { K key = extractKeyObj(e); if (extractIntKeyValue(key, modifiedHash(key.hashCode())) != e.hashCode) { if (keyMutationCnt == 0) { getLog().warn("Key mismatch! Key hashcode changed! keyClass=" + e.getKey().getClass().getName()); String s; ...
java
private void checkForHashCodeChange(Entry<K, V> e) { K key = extractKeyObj(e); if (extractIntKeyValue(key, modifiedHash(key.hashCode())) != e.hashCode) { if (keyMutationCnt == 0) { getLog().warn("Key mismatch! Key hashcode changed! keyClass=" + e.getKey().getClass().getName()); String s; ...
[ "private", "void", "checkForHashCodeChange", "(", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "K", "key", "=", "extractKeyObj", "(", "e", ")", ";", "if", "(", "extractIntKeyValue", "(", "key", ",", "modifiedHash", "(", "key", ".", "hashCode", "(",...
Check whether the key was modified during the stay of the entry in the cache. We only need to check this when the entry is removed, since we expect that if the key has changed, the stored hash code in the cache will not match any more and the item is evicted very fast.
[ "Check", "whether", "the", "key", "was", "modified", "during", "the", "stay", "of", "the", "entry", "in", "the", "cache", ".", "We", "only", "need", "to", "check", "this", "when", "the", "entry", "is", "removed", "since", "we", "expect", "that", "if", ...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1335-L1352
53,239
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.entryInRefreshProbationAccessed
private boolean entryInRefreshProbationAccessed(final Entry<K, V> e, final long now) { long nrt = e.getRefreshProbationNextRefreshTime(); if (nrt > now) { reviveRefreshedEntry(e, nrt); return true; } return false; }
java
private boolean entryInRefreshProbationAccessed(final Entry<K, V> e, final long now) { long nrt = e.getRefreshProbationNextRefreshTime(); if (nrt > now) { reviveRefreshedEntry(e, nrt); return true; } return false; }
[ "private", "boolean", "entryInRefreshProbationAccessed", "(", "final", "Entry", "<", "K", ",", "V", ">", "e", ",", "final", "long", "now", ")", "{", "long", "nrt", "=", "e", ".", "getRefreshProbationNextRefreshTime", "(", ")", ";", "if", "(", "nrt", ">", ...
Entry was refreshed before, reset timer and make entry visible again.
[ "Entry", "was", "refreshed", "before", "reset", "timer", "and", "make", "entry", "visible", "again", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1393-L1400
53,240
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.resiliencePolicyException
private void resiliencePolicyException(final Entry<K, V> e, final long t0, final long t, Throwable _exception) { ExceptionWrapper<K> _value = new ExceptionWrapper(extractKeyObj(e), _exception, t0, e); insert(e, (V) _value, t0, t, t0, INSERT_STAT_LOAD, 0); }
java
private void resiliencePolicyException(final Entry<K, V> e, final long t0, final long t, Throwable _exception) { ExceptionWrapper<K> _value = new ExceptionWrapper(extractKeyObj(e), _exception, t0, e); insert(e, (V) _value, t0, t, t0, INSERT_STAT_LOAD, 0); }
[ "private", "void", "resiliencePolicyException", "(", "final", "Entry", "<", "K", ",", "V", ">", "e", ",", "final", "long", "t0", ",", "final", "long", "t", ",", "Throwable", "_exception", ")", "{", "ExceptionWrapper", "<", "K", ">", "_value", "=", "new",...
Exception from the resilience policy. We have two exceptions now. One from the loader or the expiry policy, one from the resilience policy. We propagate the more severe one from the resilience policy.
[ "Exception", "from", "the", "resilience", "policy", ".", "We", "have", "two", "exceptions", "now", ".", "One", "from", "the", "loader", "or", "the", "expiry", "policy", "one", "from", "the", "resilience", "policy", ".", "We", "propagate", "the", "more", "s...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1445-L1448
53,241
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.refreshEntry
private void refreshEntry(final Entry<K, V> e) { synchronized (e) { e.waitForProcessing(); if (e.isGone()) { return; } e.startProcessing(Entry.ProcessingState.REFRESH); } boolean _finished = false; try { load(e); _finished = true; } catch (CacheClosedExcep...
java
private void refreshEntry(final Entry<K, V> e) { synchronized (e) { e.waitForProcessing(); if (e.isGone()) { return; } e.startProcessing(Entry.ProcessingState.REFRESH); } boolean _finished = false; try { load(e); _finished = true; } catch (CacheClosedExcep...
[ "private", "void", "refreshEntry", "(", "final", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "synchronized", "(", "e", ")", "{", "e", ".", "waitForProcessing", "(", ")", ";", "if", "(", "e", ".", "isGone", "(", ")", ")", "{", "return", ";", ...
Executed in loader thread. Load the entry again. After the load we copy the entry to the refresh hash and expire it in the main hash. The entry needs to stay in the main hash during the load, to block out concurrent reads.
[ "Executed", "in", "loader", "thread", ".", "Load", "the", "entry", "again", ".", "After", "the", "load", "we", "copy", "the", "entry", "to", "the", "refresh", "hash", "and", "expire", "it", "in", "the", "main", "hash", ".", "The", "entry", "needs", "to...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1565-L1589
53,242
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.expireAndRemoveEventually
private void expireAndRemoveEventually(final Entry e) { if (isKeepAfterExpired() || e.isProcessing()) { metrics.expiredKept(); } else { removeEntry(e); } }
java
private void expireAndRemoveEventually(final Entry e) { if (isKeepAfterExpired() || e.isProcessing()) { metrics.expiredKept(); } else { removeEntry(e); } }
[ "private", "void", "expireAndRemoveEventually", "(", "final", "Entry", "e", ")", "{", "if", "(", "isKeepAfterExpired", "(", ")", "||", "e", ".", "isProcessing", "(", ")", ")", "{", "metrics", ".", "expiredKept", "(", ")", ";", "}", "else", "{", "removeEn...
Remove expired from heap and increment statistics. The entry is not removed when there is processing going on in parallel. @see #expireAndRemoveEventuallyAfterProcessing(Entry)
[ "Remove", "expired", "from", "heap", "and", "increment", "statistics", ".", "The", "entry", "is", "not", "removed", "when", "there", "is", "processing", "going", "on", "in", "parallel", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1656-L1663
53,243
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.getAll
public Map<K, V> getAll(final Iterable<? extends K> _inputKeys) { Map<K, ExaminationEntry<K, V>> map = new HashMap<K, ExaminationEntry<K, V>>(); for (K k : _inputKeys) { Entry<K,V> e = getEntryInternal(k); if (e != null) { map.put(extractKeyObj(e), ReadOnlyCacheEntry.of(e)); } } ...
java
public Map<K, V> getAll(final Iterable<? extends K> _inputKeys) { Map<K, ExaminationEntry<K, V>> map = new HashMap<K, ExaminationEntry<K, V>>(); for (K k : _inputKeys) { Entry<K,V> e = getEntryInternal(k); if (e != null) { map.put(extractKeyObj(e), ReadOnlyCacheEntry.of(e)); } } ...
[ "public", "Map", "<", "K", ",", "V", ">", "getAll", "(", "final", "Iterable", "<", "?", "extends", "K", ">", "_inputKeys", ")", "{", "Map", "<", "K", ",", "ExaminationEntry", "<", "K", ",", "V", ">", ">", "map", "=", "new", "HashMap", "<", "K", ...
JSR107 bulk interface. The behaviour is compatible to the JSR107 TCK. We also need to be compatible to the exception handling policy, which says that the exception is to be thrown when most specific. So exceptions are only thrown, when the value which has produced an exception is requested from the map.
[ "JSR107", "bulk", "interface", ".", "The", "behaviour", "is", "compatible", "to", "the", "JSR107", "TCK", ".", "We", "also", "need", "to", "be", "compatible", "to", "the", "exception", "handling", "policy", "which", "says", "that", "the", "exception", "is", ...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1693-L1702
53,244
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.checkIntegrity
public final void checkIntegrity() { executeWithGlobalLock(new Job<Void>() { @Override public Void call() { IntegrityState is = getIntegrityState(); if (is.getStateFlags() > 0) { throw new Error( "cache2k integrity error: " + is.getStateDescriptor() + ",...
java
public final void checkIntegrity() { executeWithGlobalLock(new Job<Void>() { @Override public Void call() { IntegrityState is = getIntegrityState(); if (is.getStateFlags() > 0) { throw new Error( "cache2k integrity error: " + is.getStateDescriptor() + ",...
[ "public", "final", "void", "checkIntegrity", "(", ")", "{", "executeWithGlobalLock", "(", "new", "Job", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", ")", "{", "IntegrityState", "is", "=", "getIntegrityState", "(", ")", ...
Check internal data structures and throw and exception if something is wrong, used for unit testing
[ "Check", "internal", "data", "structures", "and", "throw", "and", "exception", "if", "something", "is", "wrong", "used", "for", "unit", "testing" ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1802-L1815
53,245
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/configuration/DefaultCustomizationCollection.java
DefaultCustomizationCollection.add
@Override public boolean add(final CustomizationSupplier<T> entry) { if (list.contains(entry)) { throw new IllegalArgumentException("duplicate entry"); } return list.add(entry); }
java
@Override public boolean add(final CustomizationSupplier<T> entry) { if (list.contains(entry)) { throw new IllegalArgumentException("duplicate entry"); } return list.add(entry); }
[ "@", "Override", "public", "boolean", "add", "(", "final", "CustomizationSupplier", "<", "T", ">", "entry", ")", "{", "if", "(", "list", ".", "contains", "(", "entry", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"duplicate entry\"", ")"...
Adds a customization to the collection. @return always {@code true} @throws IllegalArgumentException if the entry is already existing.
[ "Adds", "a", "customization", "to", "the", "collection", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/configuration/DefaultCustomizationCollection.java#L59-L65
53,246
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/concurrency/Locks.java
Locks.newOptimistic
public static OptimisticLock newOptimistic() { if (optimisticLockImplementation == null) { initializeOptimisticLock(); } try { return optimisticLockImplementation.newInstance(); } catch (Exception ex) { throw new Error(ex); } }
java
public static OptimisticLock newOptimistic() { if (optimisticLockImplementation == null) { initializeOptimisticLock(); } try { return optimisticLockImplementation.newInstance(); } catch (Exception ex) { throw new Error(ex); } }
[ "public", "static", "OptimisticLock", "newOptimistic", "(", ")", "{", "if", "(", "optimisticLockImplementation", "==", "null", ")", "{", "initializeOptimisticLock", "(", ")", ";", "}", "try", "{", "return", "optimisticLockImplementation", ".", "newInstance", "(", ...
Returns a new lock implementation depending on the platform support.
[ "Returns", "a", "new", "lock", "implementation", "depending", "on", "the", "platform", "support", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/concurrency/Locks.java#L37-L46
53,247
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/TouchyJCacheAdapter.java
TouchyJCacheAdapter.returnEntry
private Entry<K, V> returnEntry(final Entry<K, V> e) { touchEntry(e.getKey()); return e; }
java
private Entry<K, V> returnEntry(final Entry<K, V> e) { touchEntry(e.getKey()); return e; }
[ "private", "Entry", "<", "K", ",", "V", ">", "returnEntry", "(", "final", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "touchEntry", "(", "e", ".", "getKey", "(", ")", ")", ";", "return", "e", ";", "}" ]
Entry is accessed update expiry if needed.
[ "Entry", "is", "accessed", "update", "expiry", "if", "needed", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/TouchyJCacheAdapter.java#L499-L502
53,248
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/TouchyJCacheAdapter.java
TouchyJCacheAdapter.returnValue
private V returnValue(K key, V _value) { if (_value != null) { Duration d = expiryPolicy.getExpiryForAccess(); if (d != null) { c2kCache.expireAt(key, calculateExpiry(d)); } return _value; } return null; }
java
private V returnValue(K key, V _value) { if (_value != null) { Duration d = expiryPolicy.getExpiryForAccess(); if (d != null) { c2kCache.expireAt(key, calculateExpiry(d)); } return _value; } return null; }
[ "private", "V", "returnValue", "(", "K", "key", ",", "V", "_value", ")", "{", "if", "(", "_value", "!=", "null", ")", "{", "Duration", "d", "=", "expiryPolicy", ".", "getExpiryForAccess", "(", ")", ";", "if", "(", "d", "!=", "null", ")", "{", "c2kC...
Entry was accessed update expiry if value is non null.
[ "Entry", "was", "accessed", "update", "expiry", "if", "value", "is", "non", "null", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/TouchyJCacheAdapter.java#L507-L516
53,249
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/integration/CacheLoader.java
CacheLoader.loadAll
public Map<K, V> loadAll(Iterable<? extends K> keys, Executor executor) throws Exception { throw new UnsupportedOperationException(); }
java
public Map<K, V> loadAll(Iterable<? extends K> keys, Executor executor) throws Exception { throw new UnsupportedOperationException(); }
[ "public", "Map", "<", "K", ",", "V", ">", "loadAll", "(", "Iterable", "<", "?", "extends", "K", ">", "keys", ",", "Executor", "executor", ")", "throws", "Exception", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}" ]
Loads multiple values to the cache. <p>From inside this method it is illegal to call methods on the same cache. This may cause a deadlock. <p>The method is provided to complete the API. At the moment cache2k is not using it. Please see the road map. @param keys set of keys for the values to be loaded @param executor...
[ "Loads", "multiple", "values", "to", "the", "cache", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/integration/CacheLoader.java#L107-L109
53,250
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java
JCacheBuilder.setupTypes
private void setupTypes() { if (!cache2kConfigurationWasProvided) { cache2kConfiguration.setKeyType(config.getKeyType()); cache2kConfiguration.setValueType(config.getValueType()); } else { if (cache2kConfiguration.getKeyType() == null) { cache2kConfiguration.setKeyType(config.getKeyTyp...
java
private void setupTypes() { if (!cache2kConfigurationWasProvided) { cache2kConfiguration.setKeyType(config.getKeyType()); cache2kConfiguration.setValueType(config.getValueType()); } else { if (cache2kConfiguration.getKeyType() == null) { cache2kConfiguration.setKeyType(config.getKeyTyp...
[ "private", "void", "setupTypes", "(", ")", "{", "if", "(", "!", "cache2kConfigurationWasProvided", ")", "{", "cache2kConfiguration", ".", "setKeyType", "(", "config", ".", "getKeyType", "(", ")", ")", ";", "cache2kConfiguration", ".", "setValueType", "(", "confi...
If there is a cache2k configuration, we take the types from there.
[ "If", "there", "is", "a", "cache2k", "configuration", "we", "take", "the", "types", "from", "there", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java#L154-L174
53,251
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java
JCacheBuilder.setupExceptionPropagator
private void setupExceptionPropagator() { if (cache2kConfiguration.getExceptionPropagator() != null) { return; } cache2kConfiguration.setExceptionPropagator( new CustomizationReferenceSupplier<ExceptionPropagator<K>>(new ExceptionPropagator<K>() { @Override public RuntimeException pr...
java
private void setupExceptionPropagator() { if (cache2kConfiguration.getExceptionPropagator() != null) { return; } cache2kConfiguration.setExceptionPropagator( new CustomizationReferenceSupplier<ExceptionPropagator<K>>(new ExceptionPropagator<K>() { @Override public RuntimeException pr...
[ "private", "void", "setupExceptionPropagator", "(", ")", "{", "if", "(", "cache2kConfiguration", ".", "getExceptionPropagator", "(", ")", "!=", "null", ")", "{", "return", ";", "}", "cache2kConfiguration", ".", "setExceptionPropagator", "(", "new", "CustomizationRef...
If an exception propagator is configured, take this one, otherwise go with default that is providing JCache compatible behavior.
[ "If", "an", "exception", "propagator", "is", "configured", "take", "this", "one", "otherwise", "go", "with", "default", "that", "is", "providing", "JCache", "compatible", "behavior", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java#L190-L201
53,252
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java
JCacheBuilder.setupCacheThrough
private void setupCacheThrough() { if (config.getCacheLoaderFactory() != null) { final CacheLoader<K, V> clf = config.getCacheLoaderFactory().create(); cache2kConfiguration.setAdvancedLoader( new CustomizationReferenceSupplier<AdvancedCacheLoader<K, V>>( new CloseableLoader() { ...
java
private void setupCacheThrough() { if (config.getCacheLoaderFactory() != null) { final CacheLoader<K, V> clf = config.getCacheLoaderFactory().create(); cache2kConfiguration.setAdvancedLoader( new CustomizationReferenceSupplier<AdvancedCacheLoader<K, V>>( new CloseableLoader() { ...
[ "private", "void", "setupCacheThrough", "(", ")", "{", "if", "(", "config", ".", "getCacheLoaderFactory", "(", ")", "!=", "null", ")", "{", "final", "CacheLoader", "<", "K", ",", "V", ">", "clf", "=", "config", ".", "getCacheLoaderFactory", "(", ")", "."...
Configure loader and writer.
[ "Configure", "loader", "and", "writer", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java#L209-L267
53,253
cache2k/cache2k
cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringCache2kCacheManager.java
SpringCache2kCacheManager.getCache
@SuppressWarnings("unchecked") @Override public SpringCache2kCache getCache(final String name) { return name2cache.computeIfAbsent(name, n -> { if (!allowUnknownCache && !configuredCacheNames.contains(n)) { throw new IllegalArgumentException("Cache configuration missing for: " + n); } ...
java
@SuppressWarnings("unchecked") @Override public SpringCache2kCache getCache(final String name) { return name2cache.computeIfAbsent(name, n -> { if (!allowUnknownCache && !configuredCacheNames.contains(n)) { throw new IllegalArgumentException("Cache configuration missing for: " + n); } ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "SpringCache2kCache", "getCache", "(", "final", "String", "name", ")", "{", "return", "name2cache", ".", "computeIfAbsent", "(", "name", ",", "n", "->", "{", "if", "(", "!", "allo...
Returns an existing cache or retrieves and wraps a cache from cache2k.
[ "Returns", "an", "existing", "cache", "or", "retrieves", "and", "wraps", "a", "cache", "from", "cache2k", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringCache2kCacheManager.java#L98-L107
53,254
cache2k/cache2k
cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringCache2kCacheManager.java
SpringCache2kCacheManager.getCacheNames
@Override public Collection<String> getCacheNames() { Set<String> cacheNames = new HashSet<>(); for (org.cache2k.Cache<?,?> cache : manager.getActiveCaches()) { cacheNames.add(cache.getName()); } cacheNames.addAll(configuredCacheNames); return Collections.unmodifiableSet(cacheNames); }
java
@Override public Collection<String> getCacheNames() { Set<String> cacheNames = new HashSet<>(); for (org.cache2k.Cache<?,?> cache : manager.getActiveCaches()) { cacheNames.add(cache.getName()); } cacheNames.addAll(configuredCacheNames); return Collections.unmodifiableSet(cacheNames); }
[ "@", "Override", "public", "Collection", "<", "String", ">", "getCacheNames", "(", ")", "{", "Set", "<", "String", ">", "cacheNames", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "org", ".", "cache2k", ".", "Cache", "<", "?", ",", "?", "...
Get a list of known caches. Depending on the configuration, caches may be created dynamically without providing a configuration for a specific cache name. Because of this combine the known names from configuration and activated caches.
[ "Get", "a", "list", "of", "known", "caches", ".", "Depending", "on", "the", "configuration", "caches", "may", "be", "created", "dynamically", "without", "providing", "a", "configuration", "for", "a", "specific", "cache", "name", ".", "Because", "of", "this", ...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringCache2kCacheManager.java#L165-L173
53,255
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/generic/storeByValueSimulation/CopyCacheProxy.java
CopyCacheProxy.getConfiguration
@SuppressWarnings("unchecked") @Override public <C extends Configuration<K, T>> C getConfiguration(Class<C> clazz) { final C c = cache.getConfiguration(clazz); if (c instanceof CompleteConfiguration) { final CompleteConfiguration<K, T> cc = (CompleteConfiguration<K,T>) c; return (C) new Complete...
java
@SuppressWarnings("unchecked") @Override public <C extends Configuration<K, T>> C getConfiguration(Class<C> clazz) { final C c = cache.getConfiguration(clazz); if (c instanceof CompleteConfiguration) { final CompleteConfiguration<K, T> cc = (CompleteConfiguration<K,T>) c; return (C) new Complete...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "<", "C", "extends", "Configuration", "<", "K", ",", "T", ">", ">", "C", "getConfiguration", "(", "Class", "<", "C", ">", "clazz", ")", "{", "final", "C", "c", "=", "cache",...
Delegates to the wrapped cache. Wrap configuration and return true on store by value
[ "Delegates", "to", "the", "wrapped", "cache", ".", "Wrap", "configuration", "and", "return", "true", "on", "store", "by", "value" ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/generic/storeByValueSimulation/CopyCacheProxy.java#L48-L129
53,256
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/configuration/Cache2kConfiguration.java
Cache2kConfiguration.of
public static <K,V> Cache2kConfiguration<K, V> of(CacheType<K> keyType, CacheType<V> valueType) { Cache2kConfiguration<K,V> c = new Cache2kConfiguration<K,V>(); c.setKeyType(keyType); c.setValueType(valueType); return c; }
java
public static <K,V> Cache2kConfiguration<K, V> of(CacheType<K> keyType, CacheType<V> valueType) { Cache2kConfiguration<K,V> c = new Cache2kConfiguration<K,V>(); c.setKeyType(keyType); c.setValueType(valueType); return c; }
[ "public", "static", "<", "K", ",", "V", ">", "Cache2kConfiguration", "<", "K", ",", "V", ">", "of", "(", "CacheType", "<", "K", ">", "keyType", ",", "CacheType", "<", "V", ">", "valueType", ")", "{", "Cache2kConfiguration", "<", "K", ",", "V", ">", ...
Construct a config instance setting the type parameters and returning a proper generic type. @see Cache2kBuilder#keyType(CacheType) @see Cache2kBuilder#valueType(CacheType)
[ "Construct", "a", "config", "instance", "setting", "the", "type", "parameters", "and", "returning", "a", "proper", "generic", "type", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/configuration/Cache2kConfiguration.java#L159-L164
53,257
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/configuration/Cache2kConfiguration.java
Cache2kConfiguration.getListeners
public CustomizationCollection<CacheEntryOperationListener<K,V>> getListeners() { if (listeners == null) { listeners = new DefaultCustomizationCollection<CacheEntryOperationListener<K, V>>(); } return listeners; }
java
public CustomizationCollection<CacheEntryOperationListener<K,V>> getListeners() { if (listeners == null) { listeners = new DefaultCustomizationCollection<CacheEntryOperationListener<K, V>>(); } return listeners; }
[ "public", "CustomizationCollection", "<", "CacheEntryOperationListener", "<", "K", ",", "V", ">", ">", "getListeners", "(", ")", "{", "if", "(", "listeners", "==", "null", ")", "{", "listeners", "=", "new", "DefaultCustomizationCollection", "<", "CacheEntryOperati...
A set of listeners. Listeners added in this collection will be executed in a synchronous mode, meaning, further processing for an entry will stall until a registered listener is executed. The expiry will be always executed asynchronously. <p>A listener can be added by adding it to the collection. Duplicate (in terms o...
[ "A", "set", "of", "listeners", ".", "Listeners", "added", "in", "this", "collection", "will", "be", "executed", "in", "a", "synchronous", "mode", "meaning", "further", "processing", "for", "an", "entry", "will", "stall", "until", "a", "registered", "listener",...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/configuration/Cache2kConfiguration.java#L514-L519
53,258
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/util/TunableFactory.java
TunableFactory.reload
public static synchronized void reload() { map = new HashMap<Class<?>, Object>(); customProperties = loadFile(CUSTOM_TUNING_FILE_NAME); defaultProperties = loadFile(DEFAULT_TUNING_FILE_NAME); }
java
public static synchronized void reload() { map = new HashMap<Class<?>, Object>(); customProperties = loadFile(CUSTOM_TUNING_FILE_NAME); defaultProperties = loadFile(DEFAULT_TUNING_FILE_NAME); }
[ "public", "static", "synchronized", "void", "reload", "(", ")", "{", "map", "=", "new", "HashMap", "<", "Class", "<", "?", ">", ",", "Object", ">", "(", ")", ";", "customProperties", "=", "loadFile", "(", "CUSTOM_TUNING_FILE_NAME", ")", ";", "defaultProper...
Reload the tunable configuration from the system properties and the configuration file.
[ "Reload", "the", "tunable", "configuration", "from", "the", "system", "properties", "and", "the", "configuration", "file", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/util/TunableFactory.java#L61-L65
53,259
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/util/TunableFactory.java
TunableFactory.get
@SuppressWarnings("unchecked") public synchronized static <T extends TunableConstants> T get(Properties p, Class<T> c) { T cfg = getDefault(c); if (p != null && p.containsKey(TUNE_MARKER) && p.containsKey(cfg.getClass().getName() + ".tuning")) { cfg = (T) cfg.clone(); apply(p, cfg); ...
java
@SuppressWarnings("unchecked") public synchronized static <T extends TunableConstants> T get(Properties p, Class<T> c) { T cfg = getDefault(c); if (p != null && p.containsKey(TUNE_MARKER) && p.containsKey(cfg.getClass().getName() + ".tuning")) { cfg = (T) cfg.clone(); apply(p, cfg); ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "synchronized", "static", "<", "T", "extends", "TunableConstants", ">", "T", "get", "(", "Properties", "p", ",", "Class", "<", "T", ">", "c", ")", "{", "T", "cfg", "=", "getDefault", "(", "c",...
Provide tuning object with initialized information from the properties file. @param p Properties from the execution context @param c Tunable class @param <T> type of requested tunable class @return Created and initialized object
[ "Provide", "tuning", "object", "with", "initialized", "information", "from", "the", "properties", "file", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/util/TunableFactory.java#L91-L101
53,260
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/configuration/ConfigurationSectionContainer.java
ConfigurationSectionContainer.add
public boolean add(ConfigurationSection section) { if (section instanceof SingletonConfigurationSection) { if (getSection(section.getClass()) != null) { throw new IllegalArgumentException("Section of same type already inserted: " + section.getClass().getName()); } } return sections.add(...
java
public boolean add(ConfigurationSection section) { if (section instanceof SingletonConfigurationSection) { if (getSection(section.getClass()) != null) { throw new IllegalArgumentException("Section of same type already inserted: " + section.getClass().getName()); } } return sections.add(...
[ "public", "boolean", "add", "(", "ConfigurationSection", "section", ")", "{", "if", "(", "section", "instanceof", "SingletonConfigurationSection", ")", "{", "if", "(", "getSection", "(", "section", ".", "getClass", "(", ")", ")", "!=", "null", ")", "{", "thr...
Add a new configuration section to the container. @throws IllegalArgumentException if same type is already present and a singleton @return always {@code true}
[ "Add", "a", "new", "configuration", "section", "to", "the", "container", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/configuration/ConfigurationSectionContainer.java#L47-L54
53,261
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/configuration/ConfigurationSectionContainer.java
ConfigurationSectionContainer.getSection
@SuppressWarnings("unchecked") public <T extends ConfigurationSection> T getSection(Class<T> sectionType) { for (ConfigurationSection s : sections) { if (sectionType.equals(s.getClass())) { return (T) s; } } return null; }
java
@SuppressWarnings("unchecked") public <T extends ConfigurationSection> T getSection(Class<T> sectionType) { for (ConfigurationSection s : sections) { if (sectionType.equals(s.getClass())) { return (T) s; } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "ConfigurationSection", ">", "T", "getSection", "(", "Class", "<", "T", ">", "sectionType", ")", "{", "for", "(", "ConfigurationSection", "s", ":", "sections", ")", "{", "if",...
Retrieve a single section from the container.
[ "Retrieve", "a", "single", "section", "from", "the", "container", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/configuration/ConfigurationSectionContainer.java#L59-L67
53,262
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java
AsyncDispatcher.deliverAsyncEvent
void deliverAsyncEvent(final EntryEvent<K,V> _event) { if (asyncListenerByType.get(_event.getEventType()).isEmpty()) { return; } List<Listener<K,V>> _listeners = new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType())); if (_listeners.isEmpty()) { return; } ...
java
void deliverAsyncEvent(final EntryEvent<K,V> _event) { if (asyncListenerByType.get(_event.getEventType()).isEmpty()) { return; } List<Listener<K,V>> _listeners = new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType())); if (_listeners.isEmpty()) { return; } ...
[ "void", "deliverAsyncEvent", "(", "final", "EntryEvent", "<", "K", ",", "V", ">", "_event", ")", "{", "if", "(", "asyncListenerByType", ".", "get", "(", "_event", ".", "getEventType", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "return", ";", ...
If listeners are registered for this event type, run the listeners or queue the event, if already something is happening for this key.
[ "If", "listeners", "are", "registered", "for", "this", "event", "type", "run", "the", "listeners", "or", "queue", "the", "event", "if", "already", "something", "is", "happening", "for", "this", "key", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java#L118-L138
53,263
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java
AsyncDispatcher.runAllListenersInParallel
void runAllListenersInParallel(final EntryEvent<K, V> _event, List<Listener<K, V>> _listeners) { final AtomicInteger _countDown = new AtomicInteger(_listeners.size()); for (final Listener<K,V> l : _listeners) { Runnable r = new Runnable() { @Override public void run() { try { ...
java
void runAllListenersInParallel(final EntryEvent<K, V> _event, List<Listener<K, V>> _listeners) { final AtomicInteger _countDown = new AtomicInteger(_listeners.size()); for (final Listener<K,V> l : _listeners) { Runnable r = new Runnable() { @Override public void run() { try { ...
[ "void", "runAllListenersInParallel", "(", "final", "EntryEvent", "<", "K", ",", "V", ">", "_event", ",", "List", "<", "Listener", "<", "K", ",", "V", ">", ">", "_listeners", ")", "{", "final", "AtomicInteger", "_countDown", "=", "new", "AtomicInteger", "("...
Pass on runnables to the executor for all listeners. After each event is handled within the listener we check whether the event is processed by all listeners, by decrementing a countdown. In case the event is processed completely, we check whether more is queued up for this key meanwhile.
[ "Pass", "on", "runnables", "to", "the", "executor", "for", "all", "listeners", ".", "After", "each", "event", "is", "handled", "within", "the", "listener", "we", "check", "whether", "the", "event", "is", "processed", "by", "all", "listeners", "by", "decremen...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java#L146-L165
53,264
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java
AsyncDispatcher.runMoreOnKeyQueueOrStop
void runMoreOnKeyQueueOrStop(K key) { EntryEvent<K,V> _event; synchronized (getLockObject(key)) { Queue<EntryEvent<K,V>> q = keyQueue.get(key); if (q.isEmpty()) { keyQueue.remove(key); return; } _event = q.remove(); } List<Listener<K,V>> _listeners = new Arr...
java
void runMoreOnKeyQueueOrStop(K key) { EntryEvent<K,V> _event; synchronized (getLockObject(key)) { Queue<EntryEvent<K,V>> q = keyQueue.get(key); if (q.isEmpty()) { keyQueue.remove(key); return; } _event = q.remove(); } List<Listener<K,V>> _listeners = new Arr...
[ "void", "runMoreOnKeyQueueOrStop", "(", "K", "key", ")", "{", "EntryEvent", "<", "K", ",", "V", ">", "_event", ";", "synchronized", "(", "getLockObject", "(", "key", ")", ")", "{", "Queue", "<", "EntryEvent", "<", "K", ",", "V", ">", ">", "q", "=", ...
Check the event queue for this key and process the next event. If no more events are present remove the queue.
[ "Check", "the", "event", "queue", "for", "this", "key", "and", "process", "the", "next", "event", ".", "If", "no", "more", "events", "are", "present", "remove", "the", "queue", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java#L171-L188
53,265
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/AbstractEviction.java
AbstractEviction.calculateWeight
private long calculateWeight(final Entry e, final Object v) { long _weight; if (v instanceof ExceptionWrapper) { _weight = 1; } else { _weight = weigher.weigh(e.getKey(), v); } if (_weight < 0) { throw new IllegalArgumentException("weight must be positive."); } return _weig...
java
private long calculateWeight(final Entry e, final Object v) { long _weight; if (v instanceof ExceptionWrapper) { _weight = 1; } else { _weight = weigher.weigh(e.getKey(), v); } if (_weight < 0) { throw new IllegalArgumentException("weight must be positive."); } return _weig...
[ "private", "long", "calculateWeight", "(", "final", "Entry", "e", ",", "final", "Object", "v", ")", "{", "long", "_weight", ";", "if", "(", "v", "instanceof", "ExceptionWrapper", ")", "{", "_weight", "=", "1", ";", "}", "else", "{", "_weight", "=", "we...
Exceptions have the minimum weight.
[ "Exceptions", "have", "the", "minimum", "weight", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/AbstractEviction.java#L103-L114
53,266
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/AbstractEviction.java
AbstractEviction.updateWeight
@Override public void updateWeight(final Entry e) { if (!isWeigherPresent()) { return; } Entry[] _evictionChunk = null; synchronized (lock) { updateWeightInLock(e); _evictionChunk = fillEvictionChunk(); } evictChunk(_evictionChunk); int _processCount = 1; while (isEvi...
java
@Override public void updateWeight(final Entry e) { if (!isWeigherPresent()) { return; } Entry[] _evictionChunk = null; synchronized (lock) { updateWeightInLock(e); _evictionChunk = fillEvictionChunk(); } evictChunk(_evictionChunk); int _processCount = 1; while (isEvi...
[ "@", "Override", "public", "void", "updateWeight", "(", "final", "Entry", "e", ")", "{", "if", "(", "!", "isWeigherPresent", "(", ")", ")", "{", "return", ";", "}", "Entry", "[", "]", "_evictionChunk", "=", "null", ";", "synchronized", "(", "lock", ")"...
Update the weight in the entry and update the weight calculation in this eviction segment. Since the weight limit might be reached, try to evict until within limits again.
[ "Update", "the", "weight", "in", "the", "entry", "and", "update", "the", "weight", "calculation", "in", "this", "eviction", "segment", ".", "Since", "the", "weight", "limit", "might", "be", "reached", "try", "to", "evict", "until", "within", "limits", "again...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/AbstractEviction.java#L151-L169
53,267
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/AbstractEviction.java
AbstractEviction.reuseChunkArray
Entry[] reuseChunkArray() { Entry[] ea = evictChunkReuse; if (ea != null) { evictChunkReuse = null; } else { ea = new Entry[chunkSize]; } return ea; }
java
Entry[] reuseChunkArray() { Entry[] ea = evictChunkReuse; if (ea != null) { evictChunkReuse = null; } else { ea = new Entry[chunkSize]; } return ea; }
[ "Entry", "[", "]", "reuseChunkArray", "(", ")", "{", "Entry", "[", "]", "ea", "=", "evictChunkReuse", ";", "if", "(", "ea", "!=", "null", ")", "{", "evictChunkReuse", "=", "null", ";", "}", "else", "{", "ea", "=", "new", "Entry", "[", "chunkSize", ...
Safe GC overhead by reusing the chunk array.
[ "Safe", "GC", "overhead", "by", "reusing", "the", "chunk", "array", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/AbstractEviction.java#L172-L180
53,268
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java
InternalCache2kBuilder.configureViaSettersDirect
@SuppressWarnings("unchecked") private void configureViaSettersDirect(HeapCache<K,V> c) { if (config.getLoader() != null) { Object obj = c.createCustomization(config.getLoader()); if (obj instanceof CacheLoader) { final CacheLoader<K,V> _loader = (CacheLoader) obj; c.setAdvancedLoader...
java
@SuppressWarnings("unchecked") private void configureViaSettersDirect(HeapCache<K,V> c) { if (config.getLoader() != null) { Object obj = c.createCustomization(config.getLoader()); if (obj instanceof CacheLoader) { final CacheLoader<K,V> _loader = (CacheLoader) obj; c.setAdvancedLoader...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "configureViaSettersDirect", "(", "HeapCache", "<", "K", ",", "V", ">", "c", ")", "{", "if", "(", "config", ".", "getLoader", "(", ")", "!=", "null", ")", "{", "Object", "obj", "=", ...
The generic wiring code is not working on android. Explicitly call the wiring methods.
[ "The", "generic", "wiring", "code", "is", "not", "working", "on", "android", ".", "Explicitly", "call", "the", "wiring", "methods", "." ]
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java#L111-L142
53,269
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java
InternalCache2kBuilder.constructEviction
private Eviction constructEviction(HeapCache hc, HeapCacheListener l, Cache2kConfiguration config) { final boolean _strictEviction = config.isStrictEviction(); final int _availableProcessors = Runtime.getRuntime().availableProcessors(); final boolean _boostConcurrency = config.isBoostConcurrency(); fina...
java
private Eviction constructEviction(HeapCache hc, HeapCacheListener l, Cache2kConfiguration config) { final boolean _strictEviction = config.isStrictEviction(); final int _availableProcessors = Runtime.getRuntime().availableProcessors(); final boolean _boostConcurrency = config.isBoostConcurrency(); fina...
[ "private", "Eviction", "constructEviction", "(", "HeapCache", "hc", ",", "HeapCacheListener", "l", ",", "Cache2kConfiguration", "config", ")", "{", "final", "boolean", "_strictEviction", "=", "config", ".", "isStrictEviction", "(", ")", ";", "final", "int", "_avai...
Construct segmented or queued eviction. For the moment hard coded. If capacity is at least 1000 we use 2 segments if 2 or more CPUs are available. Segmenting the eviction only improves for lots of concurrent inserts or evictions, there is no effect on read performance.
[ "Construct", "segmented", "or", "queued", "eviction", ".", "For", "the", "moment", "hard", "coded", ".", "If", "capacity", "is", "at", "least", "1000", "we", "use", "2", "segments", "if", "2", "or", "more", "CPUs", "are", "available", ".", "Segmenting", ...
3c9ccff12608c598c387ec50957089784cc4b618
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java#L366-L389
53,270
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setTitle
public void setTitle(final String TITLE) { if (null == title) { _title = TITLE; fireUpdateEvent(REDRAW_EVENT); } else { title.set(TITLE); } }
java
public void setTitle(final String TITLE) { if (null == title) { _title = TITLE; fireUpdateEvent(REDRAW_EVENT); } else { title.set(TITLE); } }
[ "public", "void", "setTitle", "(", "final", "String", "TITLE", ")", "{", "if", "(", "null", "==", "title", ")", "{", "_title", "=", "TITLE", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "title", ".", "set", "(", "TITLE", "...
Defines the title of the clock. The title could be used to show for example the current city or timezone @param TITLE
[ "Defines", "the", "title", "of", "the", "clock", ".", "The", "title", "could", "be", "used", "to", "show", "for", "example", "the", "current", "city", "or", "timezone" ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L418-L425
53,271
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setText
public void setText(final String TEXT) { if (null == text) { _text = TEXT; fireUpdateEvent(REDRAW_EVENT); } else { text.set(TEXT); } }
java
public void setText(final String TEXT) { if (null == text) { _text = TEXT; fireUpdateEvent(REDRAW_EVENT); } else { text.set(TEXT); } }
[ "public", "void", "setText", "(", "final", "String", "TEXT", ")", "{", "if", "(", "null", "==", "text", ")", "{", "_text", "=", "TEXT", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "text", ".", "set", "(", "TEXT", ")", "...
Define the text for the clock. This text could be used for additional information. @param TEXT
[ "Define", "the", "text", "for", "the", "clock", ".", "This", "text", "could", "be", "used", "for", "additional", "information", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L449-L456
53,272
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setSectionsVisible
public void setSectionsVisible(final boolean VISIBLE) { if (null == sectionsVisible) { _sectionsVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { sectionsVisible.set(VISIBLE); } }
java
public void setSectionsVisible(final boolean VISIBLE) { if (null == sectionsVisible) { _sectionsVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { sectionsVisible.set(VISIBLE); } }
[ "public", "void", "setSectionsVisible", "(", "final", "boolean", "VISIBLE", ")", "{", "if", "(", "null", "==", "sectionsVisible", ")", "{", "_sectionsVisible", "=", "VISIBLE", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "sectionsVi...
Defines if the sections should be drawn in the clock. @param VISIBLE
[ "Defines", "if", "the", "sections", "should", "be", "drawn", "in", "the", "clock", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L596-L603
53,273
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setHighlightSections
public void setHighlightSections(final boolean HIGHLIGHT) { if (null == highlightSections) { _highlightSections = HIGHLIGHT; fireUpdateEvent(REDRAW_EVENT); } else { highlightSections.set(HIGHLIGHT); } }
java
public void setHighlightSections(final boolean HIGHLIGHT) { if (null == highlightSections) { _highlightSections = HIGHLIGHT; fireUpdateEvent(REDRAW_EVENT); } else { highlightSections.set(HIGHLIGHT); } }
[ "public", "void", "setHighlightSections", "(", "final", "boolean", "HIGHLIGHT", ")", "{", "if", "(", "null", "==", "highlightSections", ")", "{", "_highlightSections", "=", "HIGHLIGHT", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "...
Defines if sections should be highlighted in case they contain the current time. @param HIGHLIGHT
[ "Defines", "if", "sections", "should", "be", "highlighted", "in", "case", "they", "contain", "the", "current", "time", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L626-L633
53,274
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setAreas
public void setAreas(final List<TimeSection> AREAS) { areas.setAll(AREAS); Collections.sort(areas, new TimeSectionComparator()); fireUpdateEvent(SECTION_EVENT); }
java
public void setAreas(final List<TimeSection> AREAS) { areas.setAll(AREAS); Collections.sort(areas, new TimeSectionComparator()); fireUpdateEvent(SECTION_EVENT); }
[ "public", "void", "setAreas", "(", "final", "List", "<", "TimeSection", ">", "AREAS", ")", "{", "areas", ".", "setAll", "(", "AREAS", ")", ";", "Collections", ".", "sort", "(", "areas", ",", "new", "TimeSectionComparator", "(", ")", ")", ";", "fireUpdate...
Sets the areas to the given list of TimeSection objects. The sections will be used to colorize areas with a special meaning. Areas in the Medusa library usually are more eye-catching than Sections. @param AREAS
[ "Sets", "the", "areas", "to", "the", "given", "list", "of", "TimeSection", "objects", ".", "The", "sections", "will", "be", "used", "to", "colorize", "areas", "with", "a", "special", "meaning", ".", "Areas", "in", "the", "Medusa", "library", "usually", "ar...
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L660-L664
53,275
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.addArea
public void addArea(final TimeSection AREA) { if (null == AREA) return; areas.add(AREA); Collections.sort(areas, new TimeSectionComparator()); fireUpdateEvent(SECTION_EVENT); }
java
public void addArea(final TimeSection AREA) { if (null == AREA) return; areas.add(AREA); Collections.sort(areas, new TimeSectionComparator()); fireUpdateEvent(SECTION_EVENT); }
[ "public", "void", "addArea", "(", "final", "TimeSection", "AREA", ")", "{", "if", "(", "null", "==", "AREA", ")", "return", ";", "areas", ".", "add", "(", "AREA", ")", ";", "Collections", ".", "sort", "(", "areas", ",", "new", "TimeSectionComparator", ...
Adds the given TimeSection to the list of areas. Areas in the Medusa library usually are more eye-catching than Sections. @param AREA
[ "Adds", "the", "given", "TimeSection", "to", "the", "list", "of", "areas", ".", "Areas", "in", "the", "Medusa", "library", "usually", "are", "more", "eye", "-", "catching", "than", "Sections", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L679-L684
53,276
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.removeArea
public void removeArea(final TimeSection AREA) { if (null == AREA) return; areas.remove(AREA); Collections.sort(areas, new TimeSectionComparator()); fireUpdateEvent(SECTION_EVENT); }
java
public void removeArea(final TimeSection AREA) { if (null == AREA) return; areas.remove(AREA); Collections.sort(areas, new TimeSectionComparator()); fireUpdateEvent(SECTION_EVENT); }
[ "public", "void", "removeArea", "(", "final", "TimeSection", "AREA", ")", "{", "if", "(", "null", "==", "AREA", ")", "return", ";", "areas", ".", "remove", "(", "AREA", ")", ";", "Collections", ".", "sort", "(", "areas", ",", "new", "TimeSectionComparato...
Removes the given TimeSection from the list of areas. Areas in the Medusa library usually are more eye-catching than Sections. @param AREA
[ "Removes", "the", "given", "TimeSection", "from", "the", "list", "of", "areas", ".", "Areas", "in", "the", "Medusa", "library", "usually", "are", "more", "eye", "-", "catching", "than", "Sections", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L691-L696
53,277
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setAreasVisible
public void setAreasVisible(final boolean VISIBLE) { if (null == areasVisible) { _areasVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { areasVisible.set(VISIBLE); } }
java
public void setAreasVisible(final boolean VISIBLE) { if (null == areasVisible) { _areasVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { areasVisible.set(VISIBLE); } }
[ "public", "void", "setAreasVisible", "(", "final", "boolean", "VISIBLE", ")", "{", "if", "(", "null", "==", "areasVisible", ")", "{", "_areasVisible", "=", "VISIBLE", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "areasVisible", "....
Defines if the areas should be drawn in the clock. @param VISIBLE
[ "Defines", "if", "the", "areas", "should", "be", "drawn", "in", "the", "clock", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L714-L721
53,278
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setHighlightAreas
public void setHighlightAreas(final boolean HIGHLIGHT) { if (null == highlightAreas) { _highlightAreas = HIGHLIGHT; fireUpdateEvent(REDRAW_EVENT); } else { highlightAreas.set(HIGHLIGHT); } }
java
public void setHighlightAreas(final boolean HIGHLIGHT) { if (null == highlightAreas) { _highlightAreas = HIGHLIGHT; fireUpdateEvent(REDRAW_EVENT); } else { highlightAreas.set(HIGHLIGHT); } }
[ "public", "void", "setHighlightAreas", "(", "final", "boolean", "HIGHLIGHT", ")", "{", "if", "(", "null", "==", "highlightAreas", ")", "{", "_highlightAreas", "=", "HIGHLIGHT", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "highlight...
Defines if areas should be highlighted in case they contain the current time. @param HIGHLIGHT
[ "Defines", "if", "areas", "should", "be", "highlighted", "in", "case", "they", "contain", "the", "current", "time", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L744-L751
53,279
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setTitleVisible
public void setTitleVisible(final boolean VISIBLE) { if (null == titleVisible) { _titleVisible = VISIBLE; fireUpdateEvent(VISIBILITY_EVENT); } else { titleVisible.set(VISIBLE); } }
java
public void setTitleVisible(final boolean VISIBLE) { if (null == titleVisible) { _titleVisible = VISIBLE; fireUpdateEvent(VISIBILITY_EVENT); } else { titleVisible.set(VISIBLE); } }
[ "public", "void", "setTitleVisible", "(", "final", "boolean", "VISIBLE", ")", "{", "if", "(", "null", "==", "titleVisible", ")", "{", "_titleVisible", "=", "VISIBLE", ";", "fireUpdateEvent", "(", "VISIBILITY_EVENT", ")", ";", "}", "else", "{", "titleVisible", ...
Defines if the title of the clock will be drawn. @param VISIBLE
[ "Defines", "if", "the", "title", "of", "the", "clock", "will", "be", "drawn", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L903-L910
53,280
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setBackgroundPaint
public void setBackgroundPaint(final Paint PAINT) { if (null == backgroundPaint) { _backgroundPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { backgroundPaint.set(PAINT); } }
java
public void setBackgroundPaint(final Paint PAINT) { if (null == backgroundPaint) { _backgroundPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { backgroundPaint.set(PAINT); } }
[ "public", "void", "setBackgroundPaint", "(", "final", "Paint", "PAINT", ")", "{", "if", "(", "null", "==", "backgroundPaint", ")", "{", "_backgroundPaint", "=", "PAINT", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "backgroundPaint"...
Defines the Paint object that will be used to fill the clock background. This is usally a Color object. @param PAINT
[ "Defines", "the", "Paint", "object", "that", "will", "be", "used", "to", "fill", "the", "clock", "background", ".", "This", "is", "usally", "a", "Color", "object", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1092-L1099
53,281
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setBorderPaint
public void setBorderPaint(final Paint PAINT) { if (null == borderPaint) { _borderPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { borderPaint.set(PAINT); } }
java
public void setBorderPaint(final Paint PAINT) { if (null == borderPaint) { _borderPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { borderPaint.set(PAINT); } }
[ "public", "void", "setBorderPaint", "(", "final", "Paint", "PAINT", ")", "{", "if", "(", "null", "==", "borderPaint", ")", "{", "_borderPaint", "=", "PAINT", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "borderPaint", ".", "set"...
Defines the Paint object that will be used to draw the border of the clock. Usually this is a Color object. @param PAINT
[ "Defines", "the", "Paint", "object", "that", "will", "be", "used", "to", "draw", "the", "border", "of", "the", "clock", ".", "Usually", "this", "is", "a", "Color", "object", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1123-L1130
53,282
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setBorderWidth
public void setBorderWidth(final double WIDTH) { if (null == borderWidth) { _borderWidth = Helper.clamp(0.0, 50.0, WIDTH); fireUpdateEvent(REDRAW_EVENT); } else { borderWidth.set(WIDTH); } }
java
public void setBorderWidth(final double WIDTH) { if (null == borderWidth) { _borderWidth = Helper.clamp(0.0, 50.0, WIDTH); fireUpdateEvent(REDRAW_EVENT); } else { borderWidth.set(WIDTH); } }
[ "public", "void", "setBorderWidth", "(", "final", "double", "WIDTH", ")", "{", "if", "(", "null", "==", "borderWidth", ")", "{", "_borderWidth", "=", "Helper", ".", "clamp", "(", "0.0", ",", "50.0", ",", "WIDTH", ")", ";", "fireUpdateEvent", "(", "REDRAW...
Defines the width in pixels that will be used to draw the border of the clock. The value will be clamped between 0 and 50 pixels. @param WIDTH
[ "Defines", "the", "width", "in", "pixels", "that", "will", "be", "used", "to", "draw", "the", "border", "of", "the", "clock", ".", "The", "value", "will", "be", "clamped", "between", "0", "and", "50", "pixels", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1154-L1161
53,283
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setForegroundPaint
public void setForegroundPaint(final Paint PAINT) { if (null == foregroundPaint) { _foregroundPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { foregroundPaint.set(PAINT); } }
java
public void setForegroundPaint(final Paint PAINT) { if (null == foregroundPaint) { _foregroundPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { foregroundPaint.set(PAINT); } }
[ "public", "void", "setForegroundPaint", "(", "final", "Paint", "PAINT", ")", "{", "if", "(", "null", "==", "foregroundPaint", ")", "{", "_foregroundPaint", "=", "PAINT", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "foregroundPaint"...
Defines the Paint object that will be used to fill the foreground of the clock. This could be used to visualize glass effects etc. and is only rarely used. @param PAINT
[ "Defines", "the", "Paint", "object", "that", "will", "be", "used", "to", "fill", "the", "foreground", "of", "the", "clock", ".", "This", "could", "be", "used", "to", "visualize", "glass", "effects", "etc", ".", "and", "is", "only", "rarely", "used", "." ...
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1188-L1195
53,284
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setTitleColor
public void setTitleColor(final Color COLOR) { if (null == titleColor) { _titleColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { titleColor.set(COLOR); } }
java
public void setTitleColor(final Color COLOR) { if (null == titleColor) { _titleColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { titleColor.set(COLOR); } }
[ "public", "void", "setTitleColor", "(", "final", "Color", "COLOR", ")", "{", "if", "(", "null", "==", "titleColor", ")", "{", "_titleColor", "=", "COLOR", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "titleColor", ".", "set", ...
Defines the color that will be used to colorize the title of the clock @param COLOR
[ "Defines", "the", "color", "that", "will", "be", "used", "to", "colorize", "the", "title", "of", "the", "clock" ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1217-L1224
53,285
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setTextColor
public void setTextColor(final Color COLOR) { if (null == textColor) { _textColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { textColor.set(COLOR); } }
java
public void setTextColor(final Color COLOR) { if (null == textColor) { _textColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { textColor.set(COLOR); } }
[ "public", "void", "setTextColor", "(", "final", "Color", "COLOR", ")", "{", "if", "(", "null", "==", "textColor", ")", "{", "_textColor", "=", "COLOR", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "textColor", ".", "set", "(",...
Defines the color that will be used to colorize the text of the clock. @param COLOR
[ "Defines", "the", "color", "that", "will", "be", "used", "to", "colorize", "the", "text", "of", "the", "clock", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1246-L1253
53,286
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setDateColor
public void setDateColor(final Color COLOR) { if (null == dateColor) { _dateColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { dateColor.set(COLOR); } }
java
public void setDateColor(final Color COLOR) { if (null == dateColor) { _dateColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { dateColor.set(COLOR); } }
[ "public", "void", "setDateColor", "(", "final", "Color", "COLOR", ")", "{", "if", "(", "null", "==", "dateColor", ")", "{", "_dateColor", "=", "COLOR", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "dateColor", ".", "set", "(",...
Defines the color that will be used to colorize the date of the clock @param COLOR
[ "Defines", "the", "color", "that", "will", "be", "used", "to", "colorize", "the", "date", "of", "the", "clock" ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1275-L1282
53,287
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setMinuteTickMarkColor
public void setMinuteTickMarkColor(final Color COLOR) { if (null == minuteTickMarkColor) { _minuteTickMarkColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { minuteTickMarkColor.set(COLOR); } }
java
public void setMinuteTickMarkColor(final Color COLOR) { if (null == minuteTickMarkColor) { _minuteTickMarkColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { minuteTickMarkColor.set(COLOR); } }
[ "public", "void", "setMinuteTickMarkColor", "(", "final", "Color", "COLOR", ")", "{", "if", "(", "null", "==", "minuteTickMarkColor", ")", "{", "_minuteTickMarkColor", "=", "COLOR", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "minu...
Defines the color that will be used to colorize the minute tickmarks of the clock. @param COLOR
[ "Defines", "the", "color", "that", "will", "be", "used", "to", "colorize", "the", "minute", "tickmarks", "of", "the", "clock", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1333-L1340
53,288
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setTickLabelColor
public void setTickLabelColor(final Color COLOR) { if (null == tickLabelColor) { _tickLabelColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { tickLabelColor.set(COLOR); } }
java
public void setTickLabelColor(final Color COLOR) { if (null == tickLabelColor) { _tickLabelColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { tickLabelColor.set(COLOR); } }
[ "public", "void", "setTickLabelColor", "(", "final", "Color", "COLOR", ")", "{", "if", "(", "null", "==", "tickLabelColor", ")", "{", "_tickLabelColor", "=", "COLOR", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "tickLabelColor", ...
Defines the color that will be used to colorize the ticklabels of the clock. @param COLOR
[ "Defines", "the", "color", "that", "will", "be", "used", "to", "colorize", "the", "ticklabels", "of", "the", "clock", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1362-L1369
53,289
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setTickLabelsVisible
public void setTickLabelsVisible(final boolean VISIBLE) { if (null == tickLabelsVisible) { _tickLabelsVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { tickLabelsVisible.set(VISIBLE); } }
java
public void setTickLabelsVisible(final boolean VISIBLE) { if (null == tickLabelsVisible) { _tickLabelsVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { tickLabelsVisible.set(VISIBLE); } }
[ "public", "void", "setTickLabelsVisible", "(", "final", "boolean", "VISIBLE", ")", "{", "if", "(", "null", "==", "tickLabelsVisible", ")", "{", "_tickLabelsVisible", "=", "VISIBLE", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "tick...
Defines if the ticklabels will be drawn. @param VISIBLE
[ "Defines", "if", "the", "ticklabels", "will", "be", "drawn", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1476-L1483
53,290
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setSecondColor
public void setSecondColor(final Color COLOR) { if (null == secondColor) { _secondColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { secondColor.set(COLOR); } }
java
public void setSecondColor(final Color COLOR) { if (null == secondColor) { _secondColor = COLOR; fireUpdateEvent(REDRAW_EVENT); } else { secondColor.set(COLOR); } }
[ "public", "void", "setSecondColor", "(", "final", "Color", "COLOR", ")", "{", "if", "(", "null", "==", "secondColor", ")", "{", "_secondColor", "=", "COLOR", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "secondColor", ".", "set"...
Defines the color that will be used to colorize the second hand of the clock @param COLOR
[ "Defines", "the", "color", "that", "will", "be", "used", "to", "colorize", "the", "second", "hand", "of", "the", "clock" ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1562-L1569
53,291
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setLcdCrystalEnabled
public void setLcdCrystalEnabled(final boolean ENABLED) { if (null == lcdCrystalEnabled) { _lcdCrystalEnabled = ENABLED; fireUpdateEvent(VISIBILITY_EVENT); } else { lcdCrystalEnabled.set(ENABLED); } }
java
public void setLcdCrystalEnabled(final boolean ENABLED) { if (null == lcdCrystalEnabled) { _lcdCrystalEnabled = ENABLED; fireUpdateEvent(VISIBILITY_EVENT); } else { lcdCrystalEnabled.set(ENABLED); } }
[ "public", "void", "setLcdCrystalEnabled", "(", "final", "boolean", "ENABLED", ")", "{", "if", "(", "null", "==", "lcdCrystalEnabled", ")", "{", "_lcdCrystalEnabled", "=", "ENABLED", ";", "fireUpdateEvent", "(", "VISIBILITY_EVENT", ")", ";", "}", "else", "{", "...
Defines if the crystal effect of the LCD display will be drawn. This feature could decrease the performance if you run it on embedded devices because it will calculate a bitmap image where each pixel will be calculated. @param ENABLED
[ "Defines", "if", "the", "crystal", "effect", "of", "the", "LCD", "display", "will", "be", "drawn", ".", "This", "feature", "could", "decrease", "the", "performance", "if", "you", "run", "it", "on", "embedded", "devices", "because", "it", "will", "calculate",...
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1745-L1752
53,292
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setShadowsEnabled
public void setShadowsEnabled(final boolean ENABLED) { if (null == shadowsEnabled) { _shadowsEnabled = ENABLED; fireUpdateEvent(REDRAW_EVENT); } else { shadowsEnabled.set(ENABLED); } }
java
public void setShadowsEnabled(final boolean ENABLED) { if (null == shadowsEnabled) { _shadowsEnabled = ENABLED; fireUpdateEvent(REDRAW_EVENT); } else { shadowsEnabled.set(ENABLED); } }
[ "public", "void", "setShadowsEnabled", "(", "final", "boolean", "ENABLED", ")", "{", "if", "(", "null", "==", "shadowsEnabled", ")", "{", "_shadowsEnabled", "=", "ENABLED", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "shadowsEnable...
Defines if effects like shadows will be drawn. @param ENABLED
[ "Defines", "if", "effects", "like", "shadows", "will", "be", "drawn", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1773-L1780
53,293
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setLocale
public void setLocale(final Locale LOCALE) { if (null == locale) { _locale = LOCALE; fireUpdateEvent(REDRAW_EVENT); } else { locale.set(LOCALE); } }
java
public void setLocale(final Locale LOCALE) { if (null == locale) { _locale = LOCALE; fireUpdateEvent(REDRAW_EVENT); } else { locale.set(LOCALE); } }
[ "public", "void", "setLocale", "(", "final", "Locale", "LOCALE", ")", "{", "if", "(", "null", "==", "locale", ")", "{", "_locale", "=", "LOCALE", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ";", "}", "else", "{", "locale", ".", "set", "(", "LOCAL...
Defines the Locale that will be used to format the date in some ClockSkins. @param LOCALE
[ "Defines", "the", "Locale", "that", "will", "be", "used", "to", "format", "the", "date", "in", "some", "ClockSkins", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1836-L1843
53,294
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.setCustomFont
public void setCustomFont(final Font FONT) { if (null == customFont) { _customFont = FONT; fireUpdateEvent(RESIZE_EVENT); } else { customFont.set(FONT); } }
java
public void setCustomFont(final Font FONT) { if (null == customFont) { _customFont = FONT; fireUpdateEvent(RESIZE_EVENT); } else { customFont.set(FONT); } }
[ "public", "void", "setCustomFont", "(", "final", "Font", "FONT", ")", "{", "if", "(", "null", "==", "customFont", ")", "{", "_customFont", "=", "FONT", ";", "fireUpdateEvent", "(", "RESIZE_EVENT", ")", ";", "}", "else", "{", "customFont", ".", "set", "("...
Defines the custom font that can be used to render all text elements. To enable the custom font one has to set customFontEnabled = true @param FONT
[ "Defines", "the", "custom", "font", "that", "can", "be", "used", "to", "render", "all", "text", "elements", ".", "To", "enable", "the", "custom", "font", "one", "has", "to", "set", "customFontEnabled", "=", "true" ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L1978-L1985
53,295
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Clock.java
Clock.checkAlarms
private void checkAlarms(final ZonedDateTime TIME) { alarmsToRemove.clear(); for (Alarm alarm : alarms) { final ZonedDateTime ALARM_TIME = alarm.getTime(); switch (alarm.getRepetition()) { case ONCE: if (TIME.isAfter(ALARM_TIME)) { ...
java
private void checkAlarms(final ZonedDateTime TIME) { alarmsToRemove.clear(); for (Alarm alarm : alarms) { final ZonedDateTime ALARM_TIME = alarm.getTime(); switch (alarm.getRepetition()) { case ONCE: if (TIME.isAfter(ALARM_TIME)) { ...
[ "private", "void", "checkAlarms", "(", "final", "ZonedDateTime", "TIME", ")", "{", "alarmsToRemove", ".", "clear", "(", ")", ";", "for", "(", "Alarm", "alarm", ":", "alarms", ")", "{", "final", "ZonedDateTime", "ALARM_TIME", "=", "alarm", ".", "getTime", "...
Calling this method will check the current time against all Alarm objects in alarms. The Alarm object will fire events in case the time is after the alarm time. @param TIME
[ "Calling", "this", "method", "will", "check", "the", "current", "time", "against", "all", "Alarm", "objects", "in", "alarms", ".", "The", "Alarm", "object", "will", "fire", "events", "in", "case", "the", "time", "is", "after", "the", "alarm", "time", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Clock.java#L2004-L2063
53,296
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Gauge.java
Gauge.setMinValue
public void setMinValue(final double VALUE) { if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); } if (null == minValue) { if (VALUE > getMaxValue()) { setMaxValue(VALUE); } _minValue = Helper.clamp(-Double.MAX_VALUE, getMaxValue(), VALUE); s...
java
public void setMinValue(final double VALUE) { if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); } if (null == minValue) { if (VALUE > getMaxValue()) { setMaxValue(VALUE); } _minValue = Helper.clamp(-Double.MAX_VALUE, getMaxValue(), VALUE); s...
[ "public", "void", "setMinValue", "(", "final", "double", "VALUE", ")", "{", "if", "(", "Status", ".", "RUNNING", "==", "timeline", ".", "getStatus", "(", ")", ")", "{", "timeline", ".", "jumpTo", "(", "Duration", ".", "ONE", ")", ";", "}", "if", "(",...
Sets the minimum value of the gauge scale to the given value @param VALUE
[ "Sets", "the", "minimum", "value", "of", "the", "gauge", "scale", "to", "the", "given", "value" ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L876-L891
53,297
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Gauge.java
Gauge.setSubTitle
public void setSubTitle(final String SUBTITLE) { if (null == subTitle) { _subTitle = SUBTITLE; fireUpdateEvent(VISIBILITY_EVENT); fireUpdateEvent(REDRAW_EVENT); } else { subTitle.set(SUBTITLE); } }
java
public void setSubTitle(final String SUBTITLE) { if (null == subTitle) { _subTitle = SUBTITLE; fireUpdateEvent(VISIBILITY_EVENT); fireUpdateEvent(REDRAW_EVENT); } else { subTitle.set(SUBTITLE); } }
[ "public", "void", "setSubTitle", "(", "final", "String", "SUBTITLE", ")", "{", "if", "(", "null", "==", "subTitle", ")", "{", "_subTitle", "=", "SUBTITLE", ";", "fireUpdateEvent", "(", "VISIBILITY_EVENT", ")", ";", "fireUpdateEvent", "(", "REDRAW_EVENT", ")", ...
Sets the subtitle of the gauge. This subtitle will usually only be visible if it is not empty. @param SUBTITLE
[ "Sets", "the", "subtitle", "of", "the", "gauge", ".", "This", "subtitle", "will", "usually", "only", "be", "visible", "if", "it", "is", "not", "empty", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L1083-L1091
53,298
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Gauge.java
Gauge.setAreas
public void setAreas(final List<Section> AREAS) { areas.setAll(AREAS); Collections.sort(areas, new SectionComparator()); fireUpdateEvent(SECTION_EVENT); }
java
public void setAreas(final List<Section> AREAS) { areas.setAll(AREAS); Collections.sort(areas, new SectionComparator()); fireUpdateEvent(SECTION_EVENT); }
[ "public", "void", "setAreas", "(", "final", "List", "<", "Section", ">", "AREAS", ")", "{", "areas", ".", "setAll", "(", "AREAS", ")", ";", "Collections", ".", "sort", "(", "areas", ",", "new", "SectionComparator", "(", ")", ")", ";", "fireUpdateEvent", ...
Sets the sections to the given list of Section objects. The sections will be used to colorize areas with a special meaning such as the red area in a rpm gauge. Areas in the Medusa library usually are more eye-catching than Sections. @param AREAS
[ "Sets", "the", "sections", "to", "the", "given", "list", "of", "Section", "objects", ".", "The", "sections", "will", "be", "used", "to", "colorize", "areas", "with", "a", "special", "meaning", "such", "as", "the", "red", "area", "in", "a", "rpm", "gauge"...
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L1310-L1314
53,299
HanSolo/Medusa
src/main/java/eu/hansolo/medusa/Gauge.java
Gauge.addArea
public void addArea(final Section AREA) { if (null == AREA) return; areas.add(AREA); Collections.sort(areas, new SectionComparator()); fireUpdateEvent(SECTION_EVENT); }
java
public void addArea(final Section AREA) { if (null == AREA) return; areas.add(AREA); Collections.sort(areas, new SectionComparator()); fireUpdateEvent(SECTION_EVENT); }
[ "public", "void", "addArea", "(", "final", "Section", "AREA", ")", "{", "if", "(", "null", "==", "AREA", ")", "return", ";", "areas", ".", "add", "(", "AREA", ")", ";", "Collections", ".", "sort", "(", "areas", ",", "new", "SectionComparator", "(", "...
Adds the given Section to the list of areas. Areas in the Medusa library usually are more eye-catching than Sections. @param AREA
[ "Adds", "the", "given", "Section", "to", "the", "list", "of", "areas", ".", "Areas", "in", "the", "Medusa", "library", "usually", "are", "more", "eye", "-", "catching", "than", "Sections", "." ]
1321e4925dcde659028d4b296e49e316494c114c
https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L1332-L1337