Package com.persistit

Examples of com.persistit.Persistit


  }

  private void initPersistit() {
    try {
      tempDir = tempFolder.newDir("caches");
      persistit = new Persistit();
      persistit.setPersistitLogger(new Slf4jAdapter(LoggerFactory.getLogger("PERSISTIT")));
      Properties props = new Properties();
      props.setProperty("datapath", tempDir.getAbsolutePath());
      props.setProperty("logpath", "${datapath}/log");
      props.setProperty("logfile", "${logpath}/persistit_${timestamp}.log");
View Full Code Here


        properties.put("buffer.count.16384", bufferCount.toString());
        properties.put("volume.1", directory + File.separator + VOLUME_NAME
                + ",create,pageSize:16384,initialPages:1000,extensionPages:1000,maximumPages:1000000");

        try {
            db = new Persistit(properties);
            db.initialize();
        } catch (PersistitException ex) {
            throw new PermanentStorageException(ex);
        }
    }
View Full Code Here

            maxExchangeCacheSize = Integer.parseInt(configService.getProperty(MAX_EXCHANGE_CACHE_PROP_NAME));
        } catch (FileNotFoundException e) {
            throw new ConfigurationPropertiesLoadException ("Persistit Properties", e.getMessage());
        }

        Persistit tmpDB = new Persistit();
        tmpDB.setPersistitLogger(new Slf4jAdapter(LOG));
        try {
            tmpDB.setConfiguration(new Configuration(properties));
            tmpDB.initialize();
        } catch (PersistitException e1) {
            throw new PersistitAdapterException(e1);
        }

        ++instanceCount;
View Full Code Here

    }

    @Override
    public void visitStorage(final Session session, final TreeVisitor visitor,
            final String treeName) throws PersistitException {
        Persistit db = getDb();
        final Volume sysVol = db.getSystemVolume();
        for (final Volume volume : db.getVolumes()) {
            if (volume != sysVol) {
                final Tree tree = volume.getTree(treeName, false);
                if (tree != null) {
                    final Exchange exchange = getExchange(session, tree);
                    try {
View Full Code Here

{
    public static Exchange takeExchange(PersistitStore store, Session session, String treeName)
    {
        boolean success = false;
        try {
            Persistit persistit = store.getDb();
            TempVolumeState tempVolumeState = session.get(TEMP_VOLUME_STATE);
            if (tempVolumeState == null) {
                // Persistit creates a temp volume per "Persistit session", and these are currently one-to-one with threads.
                // Conveniently, server sessions and threads are also one-to-one. If either of these relationships ever
                // change, then the use of session resources and temp volumes will need to be revisited. But for now,
                // persistit.createTemporaryVolume creates a temp volume that is private to the persistit session and
                // therefore to the server session.
                Volume volume = persistit.createTemporaryVolume();
                tempVolumeState = new TempVolumeState(volume);
                session.put(TEMP_VOLUME_STATE, tempVolumeState);
            }
            tempVolumeState.acquire();
            if(injectIOException) {
View Full Code Here

TOP

Related Classes of com.persistit.Persistit

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.