How to use the @bentley/imodeljs-backend.IModelHost.shutdown function in @bentley/imodeljs-backend

To help you get started, we’ve selected a few @bentley/imodeljs-backend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / DisplayPerfRpcImpl.ts View on Github external
public async finishTest() {
    IModelHost.shutdown();

    // Electron only
    if (app !== undefined) app.exit();

    // Browser only
    if (DisplayPerfRpcInterface.webServer) DisplayPerfRpcInterface.webServer.close();
    if (DisplayPerfRpcInterface.backendServer) DisplayPerfRpcInterface.backendServer.close();
    if (DisplayPerfRpcInterface.chrome) await DisplayPerfRpcInterface.chrome.kill();
  }
github imodeljs / imodeljs / presentation / testing / src / Helpers.ts View on Github external
export const terminate = (frontendApp = IModelApp) => {
  if (!isInitialized)
    return;

  // store directory that needs to be cleaned-up
  const tempDirectory = (PresentationBackend.initProps && PresentationBackend.initProps.id)
    ? path.join(KnownLocations.tmpdir, "ecpresentation", PresentationBackend.initProps.id) : undefined;

  // terminate backend
  PresentationBackend.terminate();
  IModelHost.shutdown();
  if (tempDirectory)
    rimraf.sync(tempDirectory);

  // terminate frontend
  PresentationFrontend.terminate();
  frontendApp.shutdown();

  isInitialized = false;
  isFrontendAppInitialized = false;
};
github imodeljs / imodeljs / integration-tests / core / src / backend / RpcImpl.ts View on Github external
public async restartIModelHost(): Promise {
    IModelHost.shutdown();
    IModelHost.startup();
  }
github imodeljs / imodeljs / test-apps / imodel-from-geojson / src / Main.ts View on Github external
importer.import().then(() => {
  process.stdout.write("IModel: " + argv.output + " Created for GeoJson: " + argv.input + "\n");
  IModelHost.shutdown();
}).catch(() => {
  process.stdout.write("Error occurred\n");
github imodeljs / imodeljs / test-apps / analysis-importer / src / Main.ts View on Github external
import { AnalysisImporter } from "./AnalysisImporter";
import * as path from "path";
import * as fs from "fs";

IModelHost.startup();
Logger.initializeToConsole();

const outputDir = path.join(__dirname, "output");
const dbName = path.join(outputDir, "AnalysisExample.bim");
fs.mkdir(outputDir, ((_err) => { }));
fs.unlink(dbName, ((_err) => { }));

const importer = new AnalysisImporter(dbName);
importer.import();

IModelHost.shutdown();
github imodeljs / imodeljs / test-apps / imodel-from-reality-model / src / Main.ts View on Github external
.string("name")
  .describe("name", "Name (displayed in GUI and tool tip)")
  .demandOption(["input", "output"])
  .argv;

IModelHost.startup();
Logger.initializeToConsole();

const creator = new RealityModelContextIModelCreator(argv.output as string, argv.input as string, argv.name as string);
creator.create().then(() => {
  process.stdout.write("IModel: " + argv.output + " Created for Reality Model: " + argv.input);
}).catch(() => {
  process.stdout.write("Error occurred creating IModel\n");
});

IModelHost.shutdown();
github imodeljs / imodeljs / test-apps / testbed / backend / index.ts View on Github external
TestRpcImpl2.instantiate();
    event.returnValue = true;
  } else if (msg.name === CONSTANTS.REPLACE_TEST_RPCIMPL2_INSTANCE_MESSAGE) {
    TestRpcImpl2.instantiate();
    event.returnValue = true;
  } else if (msg.name === CONSTANTS.UNREGISTER_TEST_RPCIMPL2_CLASS_MESSAGE) {
    TestRpcImpl2.unregister();
    event.returnValue = true;
  } else if (msg.name === CONSTANTS.SET_INCOMPATIBLE_INTERFACE_VERSION) {
    IModelReadRpcInterface.version = "0.0.0";
    event.returnValue = true;
  } else if (msg.name === CONSTANTS.RESTORE_COMPATIBLE_INTERFACE_VERSION) {
    IModelReadRpcInterface.version = compatibleVersion;
    event.returnValue = true;
  } else if (msg.name === CONSTANTS.RESTART_BACKEND) {
    IModelHost.shutdown();
    IModelHost.startup();
    event.returnValue = true;
  } else if (msg.name === CONSTANTS.RESET_OP8_INITIALIZER) {
    resetOp8Initializer();
    event.returnValue = true;
  }
}