public StandaloneVBox cache(StandaloneVBox vbox) { processQueue(); String key = vbox.getId(); CacheEntry newEntry = new CacheEntry(vbox, key, this.refQueue); return cacheNewEntry(newEntry, vbox); }
public synchronized void incWrites(StatisticsCapableTransaction tx) { numWriteTxs++; readWriteReads.addNewValue(tx.getNumBoxReads()); readWriteWrites.addNewValue(tx.getNumBoxWrites()); }
@Override protected boolean validateCommit() { applyRemoteCommits(this.activeTxRecord); return super.validateCommit(); }
private static VBox allocateVBox(String vboxId) { // try an owned vbox first in case the id is valid. VBox vbox = OwnedVBox.fromId(vboxId); if (vbox == null) { // make a standalone one logger.debug("Allocating a StandaloneVBox for id {}", vboxId); vbox = StandaloneVBox.makeNew(vboxId, true); // cache vbox and return the canonical vbox vbox = VBoxCache.getCache().cache((StandaloneVBox) vbox); } return vbox; }
@Override public VBox lookupCachedVBox(String vboxId) { VBox vbox = StandaloneVBox.lookupCachedVBox(vboxId); if (vbox != null) { return vbox; } // It may be an owned VBox return OwnedVBox.lookupCachedVBox(vboxId); }
public static <T> StandaloneVBox<T> makeNew(String vboxId, boolean allocateOnly) { if (allocateOnly) { // when a box is allocated, it is safe to say that the version number is 0 return new StandaloneVBox<T>(vboxId, VBox.<T> notLoadedBody()); } else { StandaloneVBox<T> vbox = new StandaloneVBox<T>(vboxId); vbox.put(null); // this is required to add the vbox to the writeset return vbox; } }
public static String getServerName() { final String hostAddress = getHostAddress(); final String username = getUsername(); final String appName = getAppName(); return username + "@" + hostAddress + ":" + appName + ":" + uidString; }
@Override public Transaction makeNestedTransaction(boolean readOnly) { if (!txAllowsWrite() && !readOnly) { throw new WriteOnReadError(); } // create a RW nested transaction, because we need its read-set NonPersistentNestedTransaction nested = new NonPersistentNestedTransaction(this); if (readOnly) { nested.setReadOnly(); } return nested; }
public synchronized void incReads(StatisticsCapableTransaction tx) { // don't count empty transactions if (tx.getNumBoxReads() == 0) { return; } numReadTxs++; readOnlyReads.addNewValue(tx.getNumBoxReads()); }
public synchronized Report getReportAndReset() { Report report = new Report(numReadTxs, numWriteTxs, numAborts, numConflicts, readOnlyReads.getAndReset(), readWriteReads.getAndReset(), readWriteWrites.getAndReset()); numReadTxs = 0; numWriteTxs = 0; numAborts = 0; numConflicts = 0; return report; }
private void reportStatistics() { final TransactionStatistics.Report stats = TransactionStatistics.STATISTICS.getReportAndReset(); numReport++; doAtomicReporting(stats); }
public StatisticsThread() { this.server = Util.getServerName(); setDaemon(true); }
public LocalCommitOnlyTransaction(CommitRequest commitRequest, LockFreeTransaction tx) { super(tx.getActiveTxRecord(), commitRequest); this.decoratedTransaction = tx; // this.commitRequest = commitRequest; this.writeSet = this.decoratedTransaction.makeWriteSet(); }
@Override public void run() { while (true) { try { sleep(SECONDS_BETWEEN_REPORTS * 1000); } catch (InterruptedException ie) { // ignore exception } reportStatistics(); } }
private static void addNewInfo(Map<Class<? extends AbstractDomainObject>, DomainClassInfo> map, ArrayList<DomainClassInfo> array, DomainClassInfo info) { addNewInfoToMap(map, info); addNewInfoToArray(array, info); }
/** * Get the vbox with the given id from the cache. * * @param vboxId * @return The OwnedVBox if it is cached or <code>null</code> when either (1) the vboxId is not a valid {@link OwnedVBox} id * or (2) the owner is not cached. */ public static OwnedVBox lookupCachedVBox(String vboxId) { return tryGet(vboxId, true); }
@Override public jvstm.Transaction makeReadOnlyTopLevelTransaction(jvstm.ActiveTransactionsRecord record) { return new NonPersistentTopLevelReadOnlyTransaction(record); } });
@Override public String getId() { String id = this.id; if (id == null) { id = this.id = makeId(slotName, ownerObj); } return id; }
private static VBox allocateVBox(String vboxId) { // try an owned vbox first in case the id is valid. VBox vbox = OwnedVBox.fromId(vboxId); if (vbox == null) { // make a standalone one logger.debug("Allocating a StandaloneVBox for id {}", vboxId); vbox = StandaloneVBox.makeNew(vboxId, true); // cache vbox and return the canonical vbox vbox = VBoxCache.getCache().cache((StandaloneVBox) vbox); } return vbox; }
@Override public VBox lookupCachedVBox(String vboxId) { VBox vbox = StandaloneVBox.lookupCachedVBox(vboxId); if (vbox != null) { return vbox; } // It may be an owned VBox return OwnedVBox.lookupCachedVBox(vboxId); }