/** * 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()); } }
public static DomainFenixFrameworkRoot getInstance() { return FenixFramework.getDomainRoot().getDomainFenixFrameworkRoot(); }
@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; } });
@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); }
/** * 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()); }