code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public void setSigma(double sigma)
{
if(sigma <= 0)
throw new IllegalArgumentException("Sigma must be a positive constant, not " + sigma);
this.sigma = sigma;
this.sigmaSqrd2Inv = 0.5/(sigma*sigma);
} | java |
public void setMean(double mean)
{
if(Double.isInfinite(mean) || Double.isNaN(mean))
throw new ArithmeticException("Mean must be a real number, not " + mean);
((Normal)getDistribution()).setMean(mean);
} | java |
public void setStandardDeviations(double devs)
{
if(devs <= 0 || Double.isInfinite(devs) || Double.isNaN(devs))
throw new ArithmeticException("The stnd devs must be a positive value");
((Normal)getDistribution()).setStndDev(devs);
} | java |
@Override
protected void registerCurrencies() throws Exception {
parseCurrencies(loadFromFile("/org/joda/money/CurrencyData.csv"));
parseCountries(loadFromFile("/org/joda/money/CountryData.csv"));
parseCurrencies(loadFromFiles("META-INF/org/joda/money/CurrencyDataExtension.csv"));
... | java |
private void parseCurrencies(List<String> content) throws Exception {
for (String line : content) {
Matcher matcher = CURRENCY_REGEX_LINE.matcher(line);
if (matcher.matches()) {
String currencyCode = matcher.group(1);
int numericCode = Integer.parseIn... | java |
private void parseCountries(List<String> content) throws Exception {
for (String line : content) {
Matcher matcher = COUNTRY_REGEX_LINE.matcher(line);
if (matcher.matches()) {
String countryCode = matcher.group(1);
String currencyCode = matcher.group(... | java |
public MoneyAmountStyle withGroupingSize(Integer groupingSize) {
int sizeVal = (groupingSize == null ? -1 : groupingSize);
if (groupingSize != null && sizeVal <= 0) {
throw new IllegalArgumentException("Grouping size must be greater than zero");
}
if (sizeVal == this.gro... | java |
public MoneyAmountStyle withExtendedGroupingSize(Integer extendedGroupingSize) {
int sizeVal = (extendedGroupingSize == null ? -1 : extendedGroupingSize);
if (extendedGroupingSize != null && sizeVal < 0) {
throw new IllegalArgumentException("Extended grouping size must not be negative");
... | java |
public MoneyAmountStyle withGroupingStyle(GroupingStyle groupingStyle) {
MoneyFormatter.checkNotNull(groupingStyle, "groupingStyle");
if (this.groupingStyle == groupingStyle) {
return this;
}
return new MoneyAmountStyle(
zeroCharacter,
p... | java |
public MoneyAmountStyle withForcedDecimalPoint(boolean forceDecimalPoint) {
if (this.forceDecimalPoint == forceDecimalPoint) {
return this;
}
return new MoneyAmountStyle(
zeroCharacter,
positiveCharacter, negativeCharacter,
decim... | java |
private BigMoney checkCurrencyEqual(BigMoneyProvider moneyProvider) {
BigMoney money = of(moneyProvider);
if (isSameCurrency(money) == false) {
throw new CurrencyMismatchException(getCurrencyUnit(), money.getCurrencyUnit());
}
return money;
} | java |
@Override
public int compareTo(BigMoneyProvider other) {
BigMoney otherMoney = of(other);
if (currency.equals(otherMoney.currency) == false) {
throw new CurrencyMismatchException(getCurrencyUnit(), otherMoney.getCurrencyUnit());
}
return amount.compareTo(otherMoney.... | java |
void mergeChild(MoneyParseContext child) {
setLocale(child.getLocale());
setText(child.getText());
setIndex(child.getIndex());
setErrorIndex(child.getErrorIndex());
setCurrency(child.getCurrency());
setAmount(child.getAmount());
} | java |
public ParsePosition toParsePosition() {
ParsePosition pp = new ParsePosition(textIndex);
pp.setErrorIndex(textErrorIndex);
return pp;
} | java |
@Override
public Iterator<Entry<K,V>> iterator() {
checkClosed();
final Iterator<K> _keyIterator = cache.keys().iterator();
return new Iterator<Entry<K, V>>() {
CacheEntry<K, V> entry;
@Override
public boolean hasNext() {
while(_keyIterator.hasNext()) {
entry = cache.... | java |
public static CacheManager getInstance() {
ClassLoader _defaultClassLoader = PROVIDER.getDefaultClassLoader();
return PROVIDER.getManager(_defaultClassLoader, PROVIDER.getDefaultManagerName(_defaultClassLoader));
} | java |
public static CacheManager getInstance(ClassLoader cl) {
return PROVIDER.getManager(cl, PROVIDER.getDefaultManagerName(cl));
} | java |
public static CacheManager getInstance(ClassLoader cl, String managerName) {
return PROVIDER.getManager(cl, managerName);
} | java |
public static <K,T> Cache2kBuilder<K,T> of(Class<K> _keyType, Class<T> _valueType) {
return new Cache2kBuilder<K, T>(CacheTypeCapture.of(_keyType), CacheTypeCapture.of(_valueType));
} | java |
public static <K,T> Cache2kBuilder<K, T> of(Cache2kConfiguration<K, T> c) {
Cache2kBuilder<K,T> cb = new Cache2kBuilder<K, T>(c);
return cb;
} | java |
public final Cache2kBuilder<K, V> manager(CacheManager manager) {
if (this.manager != null) {
throw new IllegalStateException("manager() must be first operation on builder.");
}
this.manager = manager;
return this;
} | java |
@SuppressWarnings("unchecked")
public final <T2> Cache2kBuilder<K, T2> valueType(CacheType<T2> t) {
Cache2kBuilder<K, T2> me = (Cache2kBuilder<K, T2>) this;
me.config().setValueType(t);
return me;
} | java |
public final Cache2kBuilder<K, V> name(Class<?> _class) {
config().setName(_class.getName());
return this;
} | java |
private static <T> CustomizationReferenceSupplier<T> wrapCustomizationInstance(T obj) {
if (obj == null) { return null; }
return new CustomizationReferenceSupplier<T>(obj);
} | java |
@SuppressWarnings("unchecked")
public final Cache2kBuilder<K, V> wrappingLoader(AdvancedCacheLoader<K, LoadDetail<V>> l) {
config().setAdvancedLoader((
CustomizationSupplier<AdvancedCacheLoader<K, V>>) (Object) wrapCustomizationInstance(l));
return this;
} | java |
public final Cache2kBuilder<K, V> writer(CacheWriter<K, V> w) {
config().setWriter(wrapCustomizationInstance(w));
return this;
} | java |
public final Cache2kBuilder<K, V> addCacheClosedListener(CacheClosedListener listener) {
config().getCacheClosedListeners().add(wrapCustomizationInstance(listener));
return this;
} | java |
public final Cache2kBuilder<K, V> addListener(CacheEntryOperationListener<K,V> listener) {
config().getListeners().add(wrapCustomizationInstance(listener));
return this;
} | java |
public final Cache2kBuilder<K,V> addAsyncListener(CacheEntryOperationListener<K,V> listener) {
config().getAsyncListeners().add(wrapCustomizationInstance(listener));
return this;
} | java |
public final Cache2kBuilder<K, V> expiryPolicy(ExpiryPolicy<K, V> c) {
config().setExpiryPolicy(wrapCustomizationInstance(c));
return this;
} | java |
public final Cache2kBuilder<K, V> maxRetryInterval(long v, TimeUnit u) {
config().setMaxRetryInterval(u.toMillis(v));
return this;
} | java |
public final Cache2kBuilder<K, V> with(ConfigurationSectionBuilder<? extends ConfigurationSection>... sectionBuilders) {
for (ConfigurationSectionBuilder<? extends ConfigurationSection> b : sectionBuilders) {
config().getSections().add(b.buildConfigurationSection());
}
return this;
} | java |
public final Cache2kBuilder<K,V> asyncListenerExecutor(Executor v) {
config().setAsyncListenerExecutor(new CustomizationReferenceSupplier<Executor>(v));
return this;
} | java |
public final Cache2kBuilder<K, V> timeReference(TimeReference v) {
config().setTimeReference(new CustomizationReferenceSupplier<TimeReference>(v));
return this;
} | java |
static long limitExpiryToMaxLinger(long now, long _maxLinger, long _requestedExpiryTime, boolean _sharpExpiryEnabled) {
if (_sharpExpiryEnabled && _requestedExpiryTime > ExpiryPolicy.REFRESH && _requestedExpiryTime < ExpiryPolicy.ETERNAL) {
_requestedExpiryTime = -_requestedExpiryTime;
}
return Expiry... | java |
@Override
public String getDefaultManagerName(ClassLoader cl) {
ConfigurationContext ctx = classLoader2config.get(cl);
if (ctx == null) {
ctx = createContext(cl, null, DEFAULT_CONFIGURATION_FILE);
Map<ClassLoader, ConfigurationContext> m2 = new HashMap<ClassLoader, ConfigurationContext>(classLoade... | java |
private ConfigurationContext getManagerContext(final CacheManager mgr) {
ConfigurationContext ctx = manager2defaultConfig.get(mgr);
if (ctx != null) {
return ctx;
}
synchronized (this) {
ctx = manager2defaultConfig.get(mgr);
if (ctx != null) {
return ctx;
}
if (mgr.... | java |
void apply(final ConfigurationContext ctx, final ParsedConfiguration _parsedCfg, final Object cfg) {
ParsedConfiguration _templates = ctx.getTemplates();
ConfigurationTokenizer.Property _include = _parsedCfg.getPropertyMap().get("include");
if (_include != null) {
for (String _template : _include.getV... | java |
private boolean handleBean(
final ConfigurationContext ctx,
final Class<?> _type,
final Object cfg,
final ParsedConfiguration _parsedCfg) {
String _containerName = _parsedCfg.getContainer();
BeanPropertyMutator m = provideMutator(cfg.getClass());
Class<?> _targetType = m.getType(_containerNa... | java |
private boolean handleSection(
final ConfigurationContext ctx,
final Class<?> _type,
final ConfigurationWithSections cfg,
final ParsedConfiguration sc) {
String _containerName = sc.getContainer();
if (!"sections".equals(_containerName)) {
return false;
}
@SuppressWarnings("unchecke... | java |
public void checkKeepOrRemove() {
boolean _hasKeepAfterExpired = heapCache.isKeepAfterExpired();
if (expiry != 0 || remove || _hasKeepAfterExpired) {
mutationUpdateHeap();
return;
}
if (_hasKeepAfterExpired) {
expiredImmediatelyKeepData();
return;
}
expiredImmediatelyAndR... | java |
public void asyncOperationStarted() {
if (syncThread == Thread.currentThread()) {
synchronized (entry) {
while (entry.isProcessing()) {
try {
entry.wait();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
}
... | java |
private static void initializeLogFactory() {
ServiceLoader<LogFactory> loader = ServiceLoader.load(LogFactory.class);
for (LogFactory lf : loader) {
logFactory = lf;
log("New instance, using: " + logFactory.getClass().getName());
return;
}
try {
final org.slf4j.ILoggerFactory lf ... | java |
private static String readFile(String _name) throws IOException {
InputStream in = SingleProviderResolver.class.getClassLoader().getResourceAsStream(_name);
if (in == null) {
return null;
}
try {
LineNumberReader r = new LineNumberReader(new InputStreamReader(in));
String l = r.readLin... | java |
@SuppressWarnings("unchecked")
private static <S> Iterable<S> constructAllServiceImplementations(Class<S> _service) {
ClassLoader cl = CacheManagerImpl.class.getClassLoader();
ArrayList<S> li = new ArrayList<S>();
Iterator<S> it = ServiceLoader.load(_service, cl).iterator();
while (it.hasNext()) {
... | java |
public static void checkName(String s) {
for (char c : s.toCharArray()) {
if (c == '.' ||
c == '-' ||
c == '~' ||
c == ',' ||
c == '@' ||
c == ' ' ||
c == '(' ||
c == ')' ||
c == '+' ||
c == '!' ||
c == '\'' ||... | java |
@Override
public void close() {
if (isDefaultManager() && getClass().getClassLoader() == classLoader) {
log.info("Closing default CacheManager");
}
Iterable<Cache> _caches;
synchronized (lock) {
if (closing) {
return;
}
_caches = cachesCopy();
closing = true;
... | 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 &&
... | java |
private String getManagerId() {
return "name='" + name +
"', objectId=" + Integer.toString(System.identityHashCode(this), 36) +
", classloaderId=" + Integer.toString(System.identityHashCode(classLoader), 36) +
", default=" + defaultManager;
} | 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);
} | java |
private PiggyBack existingPiggyBackForInserting() {
Object _misc = misc;
if (_misc instanceof SimpleTimerTask) {
return new TaskPiggyBack((SimpleTimerTask) _misc, null);
}
return (PiggyBack) _misc;
} | java |
public void resetSuppressedLoadExceptionInformation() {
LoadExceptionPiggyBack inf = getPiggyBack(LoadExceptionPiggyBack.class);
if (inf != null) {
inf.info = null;
}
} | 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... | 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 & ... | 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... | java |
private void eventuallyExpand(int _segmentIndex) {
long[] _stamps = lockAll();
try {
long _size = segmentSize[_segmentIndex].get();
if (_size <= segmentMaxFill) {
return;
}
rehash();
} finally {
unlockAll(_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;
} | 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]);
}
} | 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++) {
... | java |
public <T> T runTotalLocked(Job<T> j) {
long[] _stamps = lockAll();
try {
return j.call();
} finally {
unlockAll(_stamps);
}
} | java |
public long calcEntryCount() {
long _count = 0;
for (Entry e : entries) {
while (e != null) {
_count++;
e = e.another;
}
}
return _count;
} | java |
private static JCacheJmxSupport findJCacheJmxSupportInstance() {
for (CacheLifeCycleListener l : CacheManagerImpl.getCacheLifeCycleListeners()) {
if (l instanceof JCacheJmxSupport) {
return (JCacheJmxSupport) l;
}
}
throw new LinkageError("JCacheJmxSupport not loaded");
} | java |
public Cache resolveCacheWrapper(org.cache2k.Cache _c2kCache) {
synchronized (getLockObject()) {
return c2k2jCache.get(_c2kCache);
}
} | 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--;
}
} | 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 += _... | 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) {
... | java |
@SuppressWarnings("unchecked")
public static <V> LoadDetail<V> wrapRefreshedTime(V value, long refreshedTimeInMillis) {
return new RefreshedTimeWrapper<V>(value, refreshedTimeInMillis);
} | 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) {
... | 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... | 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... | 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... | 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);
}
}
} | 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) {
... | java |
private static Object getLockObject(Object key) {
int hc = key.hashCode();
return KEY_LOCKS[hc & KEY_LOCKS_MASK];
} | 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);
}
... | 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... | 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()... | 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... | java |
public void setName(String n) {
if (n == null) {
n = this.getClass().getSimpleName() + "#" + cacheCnt++;
}
name = n;
} | java |
protected CacheEntry<K, V> returnEntry(final ExaminationEntry<K, V> e) {
if (e == null) {
return null;
}
return returnCacheEntry(e);
} | 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);
}
} | 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... | java |
final protected Entry<K, V> peekEntryInternal(K key) {
int hc = modifiedHash(key.hashCode());
return peekEntryInternal(key, hc, extractIntKeyValue(key, hc));
} | 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.... | 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;
}
... | 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;
... | 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;
} | 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);
} | 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... | java |
private void expireAndRemoveEventually(final Entry e) {
if (isKeepAfterExpired() || e.isProcessing()) {
metrics.expiredKept();
} else {
removeEntry(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));
}
}
... | 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() + ",... | java |
@Override
public boolean add(final CustomizationSupplier<T> entry) {
if (list.contains(entry)) {
throw new IllegalArgumentException("duplicate entry");
}
return list.add(entry);
} | java |
public static OptimisticLock newOptimistic() {
if (optimisticLockImplementation == null) {
initializeOptimisticLock();
}
try {
return optimisticLockImplementation.newInstance();
} catch (Exception ex) {
throw new Error(ex);
}
} | java |
private Entry<K, V> returnEntry(final Entry<K, V> e) {
touchEntry(e.getKey());
return e;
} | 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;
} | java |
public Map<K, V> loadAll(Iterable<? extends K> keys, Executor executor) throws Exception {
throw new UnsupportedOperationException();
} | java |
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 setupExceptionPropagator() {
if (cache2kConfiguration.getExceptionPropagator() != null) {
return;
}
cache2kConfiguration.setExceptionPropagator(
new CustomizationReferenceSupplier<ExceptionPropagator<K>>(new ExceptionPropagator<K>() {
@Override
public RuntimeException pr... | 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() {
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.