Package com.orientechnologies.orient.core.db.document

Examples of com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool


    if (OGlobalConfiguration.ENVIRONMENT_DUMP_CFG_AT_STARTUP.getValueAsBoolean()) {
      System.out.println("Dumping environment after server startup...");
      OGlobalConfiguration.dumpConfiguration(System.out);
    }

    dbPool = new ODatabaseDocumentPool();
    dbPool.setup(contextConfiguration.getValueAsInteger(OGlobalConfiguration.DB_POOL_MIN),
        contextConfiguration.getValueAsInteger(OGlobalConfiguration.DB_POOL_MAX),
        contextConfiguration.getValueAsLong(OGlobalConfiguration.DB_POOL_IDLE_TIMEOUT),
        contextConfiguration.getValueAsLong(OGlobalConfiguration.DB_POOL_IDLE_CHECK_DELAY));
View Full Code Here


  private DatabasePoolImpl createPool(final String name) {
    // TODO: refine more control over how pool settings are configured per-database or globally

    String uri = connectionUri(name);
    ODatabaseDocumentPool underlying = new ODatabaseDocumentPool(uri, SYSTEM_USER, SYSTEM_PASSWORD);
    underlying.setName(String.format("%s-database-pool", name));
    underlying.setup(1, 25);

    // TODO: Do not allow shared pool() to be closed by users, only by ourselves
    DatabasePoolImpl pool = new DatabasePoolImpl(underlying, name);
    Lifecycles.start(pool);
    return pool;
View Full Code Here

  }

  public void testThreaded(int numthreads, TXTYPE txtype) throws InterruptedException {

    // create document pool
    ODatabaseDocumentPool pool = new ODatabaseDocumentPool(DBURI, DBUSR, DBPWD);
    pool.setup(100, 200);

    // create the schema for the test class if it doesn't exist
    ODatabaseDocumentTx db = pool.acquire();
    try {
      OSchema schema = db.getMetadata().getSchema();
      if (!schema.existsClass(CLASSNAME)) {
        OClass oc = schema.createClass(CLASSNAME);
        oc.createProperty(PROPKEY, OType.STRING);
        oc.setStrictMode(true);
        schema.save();
      }
    } finally {
      db.close();
    }

    // create threads and execute
    try {
      // create threads, put into list
      ArrayList<RunTest> threads = new ArrayList<RunTest>(1000);
      for (int numth = 0; numth < numthreads; numth++) {
        threads.add(new RunTest(pool, txtype));
      }
      // run test: start each thread and wait for all threads to complete with join
      long a = System.currentTimeMillis();
      for (RunTest t : threads) {
        t.start();
      }
      for (RunTest t : threads) {
        t.join();
      }
      long b = System.currentTimeMillis();

      // collect from each thread
      int savesum = 0;
      int txnsum = 0;
      for (RunTest t : threads) {
        t.printStats();
        savesum += t.getTotalSaves();
        txnsum += t.getTotalTxns();
      }

      // print out cummulative stats
      double secs = 1.0E-3D * (b - a);
      System.out.printf("TOTAL: [%4.2f secs %d tx, %d save] %.2f tx/sec %.2f save/sec \n", secs, txnsum, savesum, txnsum / secs,
          savesum / secs);
    } finally {
      pool.close();
    }
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.