@Override public DomainRoot getDomainRoot() { OgmOID rootId = OgmOID.ROOT_OBJECT_ID; DomainRoot domainRoot = fromOid(rootId); if (domainRoot == null) { domainRoot = new DomainRoot(); } return domainRoot; }
/** * Verifies that there is no existing {@link DomainFenixFrameworkRoot} object. * Throws an <code>Error</code> otherwise. Used in the constructor of a new {@link DomainFenixFrameworkRoot} object. * * @throws Error * if a {@link DomainFenixFrameworkRoot} object already * exists. */ private void checkIfIsSingleton() { DomainFenixFrameworkRoot root = FenixFramework.getDomainRoot().getDomainFenixFrameworkRoot(); if (root != null && root != this) { throw new Error("There can be only one instance of " + getClass().getSimpleName()); } }
@Atomic(mode = TxMode.WRITE) // in the core we will not be able to use Atomic. Must do begin/commit private void ensureFenixFrameworkDataExists() { FenixFrameworkData data = FenixFramework.getDomainRoot().getFenixFrameworkData(); if (data == null) { FenixFramework.getDomainRoot().setFenixFrameworkData(new FenixFrameworkData()); } }
@Atomic(mode = TxMode.WRITE) private void doAtomicReporting(final TransactionStatistics.Report stats) { TransactionStatisticsEntry entry; entry = new TransactionStatisticsEntry(server, numReport, stats.numReads, stats.numWrites, stats.numAborts, stats.numConflicts, SECONDS_BETWEEN_REPORTS, new DateTime(), stats.readOnlyReads, stats.readWriteReads, stats.readWriteWrites); FenixFrameworkData ffData = FenixFramework.getDomainRoot().getFenixFrameworkData(); ffData.addFFTxStatsEntry(entry); }
@Override public Void call() { InstallationData data = getDomainRoot().getInstallationData(); if (data == null) { data = new InstallationData(getDomainRoot()); } // In the future, automatic upgrade hooks may be invoked here data.updateModuleData(getProject()); return null; } });
/** * Creates a {@link DomainRoot} for the {@link DomainFenixFrameworkRoot} and then initializes the * {@link DomainFenixFrameworkRoot}. */ @Atomic public static void bootstrap() { if (getInstance() == null) { DomainFenixFrameworkRoot fenixFrameworkRoot = new DomainFenixFrameworkRoot(); FenixFramework.getDomainRoot().setDomainFenixFrameworkRoot(fenixFrameworkRoot); } getInstance().initialize(FenixFramework.getDomainModel()); }
@Atomic(mode = TxMode.WRITE) protected void createDomainRoot() { new DomainRoot(); }
public static DomainFenixFrameworkRoot getInstance() { return FenixFramework.getDomainRoot().getDomainFenixFrameworkRoot(); }
@Override public DomainRoot getDomainRoot() { DomainRoot root = fromOid(1L); if (root == null) { root = new DomainRoot(); // which automatically caches this instance, but does not // ensure that it is the first, as a concurrent request // might create another // so we get it again from the cache before returning it root = fromOid(1L); assert root != null; } return root; }
@Override public DomainRoot getDomainRoot() { DomainRoot root = fromOid(1L); if (root == null) { root = new DomainRoot(); // which automatically caches this instance, but does not // ensure that it is the first, as a concurrent request // might create another // so we get it again from the cache before returning if root = fromOid(1L); assert root != null; // there must be at least one } return root; }