@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; } }
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 protected void doReload() { logger.debug("Reload StandaloneVBox: {}", this.getId()); try { JVSTMBackEnd.getInstance().getRepository().reloadAttribute(this); } catch (PersistenceException e) { VBoxBody<E> body = getBody(Transaction.current().getNumber()); if (body != null && body.version == 0) { logger.debug("VBox is new. Setting null in body with version 0."); body.value = null; } else { String message = "BUG: After reload, body is " + (body == null ? "null" : "not null"); if (body != null) { message += ". version=" + body.version; } logger.error(message); throw e; } } }
public StandaloneVBox cache(StandaloneVBox vbox) { processQueue(); String key = vbox.getId(); CacheEntry newEntry = new CacheEntry(vbox, key, this.refQueue); return cacheNewEntry(newEntry, vbox); }
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; }
protected void synchronizeJvstmState(int serverId) { ActiveTransactionsRecord activeRecord = Transaction.getRecordForNewTransaction(); Transaction tx = new InitTransaction(activeRecord); tx.start(); VBox<Integer> initBox = StandaloneVBox.makeNew("SERVER" + serverId, false); initBox.put(serverId); tx.commitTx(true); logger.info("Set the last committed TX number to {}", Transaction.mostRecentCommittedRecord.transactionNumber); }
@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); }