private void writeMemoryBarrier() { barrier.lazySet(true); }
void terminationExpected(final boolean terminationExpected) { context.terminationExpected.lazySet(terminationExpected); }
@Override public void logRollRequested(boolean lowReplication) { if (lowReplication) { lowReplicationHookCalled.lazySet(true); } } });
@Override public void clear() { try { parkForWriteAndCheckInterrupt(); identityCache.clear(); domainPrincipalMap.clear(); } finally { writing.lazySet(false); } }
@Override public void remove(Principal key) { try { if (parkForWriteAndCheckInterrupt()) { return; } if (identityCache.containsKey(key)) { domainPrincipalMap.remove(identityCache.remove(key).value().getRealmIdentityPrincipal()).forEach(identityCache::remove); } else if (domainPrincipalMap.containsKey(key)) { domainPrincipalMap.remove(key).forEach(identityCache::remove); } } finally { writing.lazySet(false); } }
private void recordAckMessageReferenceLocation(Location ackLocation, Location messageLocation) { Set<Integer> referenceFileIds = metadata.ackMessageFileMap.get(Integer.valueOf(ackLocation.getDataFileId())); if (referenceFileIds == null) { referenceFileIds = new HashSet<>(); referenceFileIds.add(messageLocation.getDataFileId()); metadata.ackMessageFileMap.put(ackLocation.getDataFileId(), referenceFileIds); metadata.ackMessageFileMapDirtyFlag.lazySet(true); } else { Integer id = Integer.valueOf(messageLocation.getDataFileId()); if (!referenceFileIds.contains(id)) { referenceFileIds.add(id); } } }
@SuppressWarnings("unchecked") private boolean recoverAckMessageFileMap() throws IOException { boolean requiresReplay = true; if (metadata.ackMessageFileMapLocation != null) { try { KahaAckMessageFileMapCommand audit = (KahaAckMessageFileMapCommand) load(metadata.ackMessageFileMapLocation); ObjectInputStream objectIn = new ObjectInputStream(audit.getAckMessageFileMap().newInput()); metadata.ackMessageFileMap = (Map<Integer, Set<Integer>>) objectIn.readObject(); metadata.ackMessageFileMapDirtyFlag.lazySet(true); requiresReplay = false; } catch (Exception e) { LOG.warn("Cannot recover ackMessageFileMap", e); } } // got no ackMessageFileMap stored so got to recreate via replay from start of the journal return requiresReplay; }
@Override public void put(Principal key, RealmIdentity newValue) { try { if (parkForWriteAndCheckInterrupt()) { return; } CacheEntry entry = identityCache.computeIfAbsent(key, principal -> { domainPrincipalMap.computeIfAbsent(newValue.getRealmIdentityPrincipal(), principal1 -> { Set<Principal> principals = new HashSet<>(); principals.add(key); return principals; }); return new CacheEntry(key, newValue, maxAge); }); if (entry != null) { domainPrincipalMap.get(entry.value().getRealmIdentityPrincipal()).add(key); } } finally { writing.lazySet(false); } }
@Override public void run() { while (!stop.get()) { if (!q.offer(1)) { fail.value++; } while (!consumerLock.compareAndSet(true, false)) { ; } if (q.poll() == null) { fail.value++; } consumerLock.lazySet(true); } } };
@Override public void run() { while (!stop.get()) { if (!q.offer(1)) { fail.value++; } while (!consumerLock.compareAndSet(true, false)) { ; } if (q.poll() == null) { fail.value++; } consumerLock.lazySet(true); } } };
public void stop() { if (!mStop.get()) { mStop.lazySet(true); if (mCallback != null) { // TODO Avoid new runnable final Callback finalCallback = mCallback; SimpleHandler.getInstance().post(new Runnable() { @Override public void run() { finalCallback.onCancel(); } }); } Status status = getStatus(); if (status == Status.PENDING) { cancel(false); } else if (status == Status.RUNNING) { // It is running, cancel call if it is created Call call = mCall.get(); if (call != null) { call.cancel(); } } // Clear mCallback = null; mEhConfig = null; mCall.lazySet(null); } }
metadata.ackMessageFileMapLocation = checkpointAckMessageFileMap(); metadata.ackMessageFileMapDirtyFlag.lazySet(false); Location[] inProgressTxRange = getInProgressTxLocationRange(); metadata.firstInProgressTransactionLocation = inProgressTxRange[0]; metadata.ackMessageFileMapDirtyFlag.lazySet(true); } else { if (LOG.isTraceEnabled()) { for (Set<Integer> ackFiles : metadata.ackMessageFileMap.values()) { ackMessageFileMapMod |= ackFiles.remove(candidate); metadata.ackMessageFileMapDirtyFlag.lazySet(true);
consumerLock.lazySet(true);
consumerLock.lazySet(true);
/** {@inheritDoc} */ @Override public boolean visit(boolean ignoreLastVisited, Visitor v) throws IgniteCheckedException { if (!visitGuard.compareAndSet(false, true)) return false; for (long meta = nextMeta(heads, 0); meta != 0L; meta = nextMeta(meta, 0)) { long valPtr = value(meta); long lastVisited = ignoreLastVisited ? 0 : lastVisitedValue(meta); if (valPtr != lastVisited) { long k = key(meta); v.onKey(k + 4, keySize(k)); lastVisitedValue(meta, valPtr); // Set it to the first value in chain. do { v.onValue(valPtr + 12, valueSize(valPtr)); valPtr = nextValue(valPtr); } while (valPtr != lastVisited); } } visitGuard.lazySet(false); return true; }
public void remove(String key) { try { if (parkForWriteAndCheckInterrupt()) { return; } cache.remove(key); } finally { writing.lazySet(false); } }
public void run() { nukleus.process(); inProcess.lazySet(false); } }
private void item_unlink_q(long addr) { int clsid = ItemUtil.getSlabsClsid(addr); AtomicBoolean lru_locks = JcacheContext.getLRU_Lock(clsid); while(!lru_locks.compareAndSet(false, true)){} try { do_item_unlink_q(addr); } finally { lru_locks.lazySet(false); } }
@Override public void onReadAddRecord(final RecordInfo info) throws Exception { checkID(info.id); hasData.lazySet(true); loadManager.addRecord(info); records.put(info.id, new JournalRecord(file, info.data.length + JournalImpl.SIZE_ADD_RECORD + 1)); }