Package org.fusesource.hawtdb.api

Examples of org.fusesource.hawtdb.api.TxPageFile


        pff.open();
        try {
            if( setup!=null ) {
                setup.run(pff);
            }
            TxPageFile pf = pff.getTxPageFile();
            Benchmarker benchmark = new Benchmarker();
            benchmark.setSamples(samples);
            benchmark.setPeriod(period);
            benchmark.setName(action.getName());
            ArrayList<A> actors = createActors(pf, actorCount, action);
View Full Code Here


  //~--- methods --------------------------------------------------------

  public Map<String, Object> execute(String key) throws FrameworkException {

    TxPageFile logDb           = (TxPageFile) arguments.get("logDb");
    Map<String, Object> result = new HashMap<>();

    if (logDb != null) {

      Transaction tx                            = logDb.tx();
      MultiIndexFactory multiIndexFactory       = new MultiIndexFactory(tx);
      IndexFactory<String, Object> indexFactory = new BTreeIndexFactory<>();

      try {
View Full Code Here

  //~--- methods --------------------------------------------------------

  public void execute(String key, String... obj) throws FrameworkException {

    TxPageFile logDb = (TxPageFile) arguments.get("logDb");

    if (logDb != null) {

      if (key != null) {

        synchronized (logDb) {

          Transaction tx                            = logDb.tx();
          MultiIndexFactory multiIndexFactory       = new MultiIndexFactory(tx);
          IndexFactory<String, Object> indexFactory = new BTreeIndexFactory<>();
          SortedIndex<String, Object> index         = null;

          try {

            index = (SortedIndex<String, Object>) multiIndexFactory.openOrCreate(key, indexFactory);

          } catch (Throwable t) {

            t.printStackTrace();
           
            logger.log(Level.WARNING, "Could not open or create log db page for key {0}", key);

            index = (SortedIndex<String, Object>) multiIndexFactory.create(key, indexFactory);

          }

          String uuid  = UUID.randomUUID().toString().replaceAll("[\\-]+", "");

          index.put(uuid, obj);

          // disabled to avoid parameter evaluation
          // logger.log(Level.FINE, "Logged for key {0}: {1}", new Object[] { key, StringUtils.join((String[]) obj, ",") });
         
          tx.commit();
          logDb.flush();

        }

      }
    }
View Full Code Here

TOP

Related Classes of org.fusesource.hawtdb.api.TxPageFile

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.