Package com.orientechnologies.orient.core.exception

Examples of com.orientechnologies.orient.core.exception.OStorageException


        return;

      addUser();

      if (!exists())
        throw new OStorageException("Can't open the storage '" + name + "' because it not exists in path: " + url);

      status = STATUS.OPEN;

      // OPEN BASIC SEGMENTS
      int pos;
      pos = registerDataSegment(new OStorageDataConfiguration(configuration, OStorage.DATA_DEFAULT_NAME));
      dataSegments[pos].open();

      pos = createClusterFromConfig(new OStoragePhysicalClusterConfiguration(configuration, OStorage.CLUSTER_INTERNAL_NAME,
          clusters.length));
      clusters[pos].open();

      configuration.load();

      pos = createClusterFromConfig(new OStoragePhysicalClusterConfiguration(configuration, OStorage.CLUSTER_INDEX_NAME,
          clusters.length));
      clusters[pos].open();

      defaultClusterId = createClusterFromConfig(new OStoragePhysicalClusterConfiguration(configuration,
          OStorage.CLUSTER_DEFAULT_NAME, clusters.length));
      clusters[defaultClusterId].open();

      // REGISTER DATA SEGMENT
      for (int i = 0; i < configuration.dataSegments.size(); ++i) {
        final OStorageDataConfiguration dataConfig = configuration.dataSegments.get(i);

        pos = registerDataSegment(dataConfig);
        if (pos == -1) {
          // CLOSE AND REOPEN TO BE SURE ALL THE FILE SEGMENTS ARE
          // OPENED
          dataSegments[i].close();
          dataSegments[i] = new ODataLocal(this, dataConfig, pos);
          dataSegments[i].open();
        } else
          dataSegments[pos].open();
      }

      // REGISTER CLUSTER
      for (int i = 0; i < configuration.clusters.size(); ++i) {
        final OStorageClusterConfiguration clusterConfig = configuration.clusters.get(i);

        if (clusterConfig != null) {
          pos = createClusterFromConfig(clusterConfig);

          if (pos == -1) {
            // CLOSE AND REOPEN TO BE SURE ALL THE FILE SEGMENTS ARE
            // OPENED
            clusters[i].close();
            clusters[i] = new OClusterLocal(this, (OStoragePhysicalClusterConfiguration) clusterConfig);
            clusterMap.put(clusters[i].getName(), clusters[i]);
            clusters[i].open();
          } else {
            if (clusterConfig.getName().equals(OStorage.CLUSTER_DEFAULT_NAME))
              defaultClusterId = pos;

            clusters[pos].open();
          }
        } else {
          clusters = Arrays.copyOf(clusters, clusters.length + 1);
          clusters[i] = null;
        }
      }

      loadVersion();

      txManager.open();

    } catch (Exception e) {
      close(true);
      throw new OStorageException("Can't open local storage: " + url + ", with mode=" + mode, e);
    } finally {
      lock.releaseExclusiveLock();

      OProfiler.getInstance().stopChrono("storage." + name + ".open", timer);
    }
View Full Code Here


    lock.acquireExclusiveLock();
    try {

      if (status != STATUS.CLOSED)
        throw new OStorageException("Can't create new storage " + name + " because it isn't closed");

      addUser();

      final File storageFolder = new File(storagePath);
      if (!storageFolder.exists())
        storageFolder.mkdir();

      if (exists())
        throw new OStorageException("Can't create new storage " + name + " because it already exists");

      status = STATUS.OPEN;

      addDataSegment(OStorage.DATA_DEFAULT_NAME);

      // ADD THE METADATA CLUSTER TO STORE INTERNAL STUFF
      addCluster(OStorage.CLUSTER_INTERNAL_NAME, OStorage.CLUSTER_TYPE.PHYSICAL);

      // ADD THE INDEX CLUSTER TO STORE, BY DEFAULT, ALL THE RECORDS OF
      // INDEXING
      addCluster(OStorage.CLUSTER_INDEX_NAME, OStorage.CLUSTER_TYPE.PHYSICAL);

      // ADD THE DEFAULT CLUSTER
      defaultClusterId = addCluster(OStorage.CLUSTER_DEFAULT_NAME, OStorage.CLUSTER_TYPE.PHYSICAL);

      configuration.create();

      txManager.create();
    } catch (OStorageException e) {
      close();
      throw e;
    } catch (IOException e) {
      close();
      throw new OStorageException("Error on creation of storage: " + name, e);

    } finally {
      lock.releaseExclusiveLock();

      OProfiler.getInstance().stopChrono("storage." + name + ".create", timer);
View Full Code Here

        // FORCE FINALIZATION TO COLLECT ALL THE PENDING BUFFERS
        OMemoryWatchDog.freeMemory(DELETE_WAIT_TIME);
      }

      throw new OStorageException("Can't delete database '" + name + "' located in: " + dbDir + ". Database files seems locked");

    } finally {
      lock.releaseExclusiveLock();

      OProfiler.getInstance().stopChrono("storage." + name + ".delete", timer);
View Full Code Here

    }
  }

  public long[] getClusterDataRange(final int iClusterId) {
    if (iClusterId == -1)
      throw new OStorageException("Cluster Id is invalid: " + iClusterId);

    checkOpeness();

    lock.acquireSharedLock();
    try {
View Full Code Here

    }
  }

  public long count(final int iClusterId) {
    if (iClusterId == -1)
      throw new OStorageException("Cluster Id is invalid: " + iClusterId);

    // COUNT PHYSICAL CLUSTER IF ANY
    checkOpeness();

    lock.acquireSharedLock();
View Full Code Here

      for (ODataLocal data : dataSegments)
        if (data != null)
          data.synch();

    } catch (IOException e) {
      throw new OStorageException("Error on synch", e);

    } finally {
      lock.releaseExclusiveLock();

      OProfiler.getInstance().stopChrono("storage." + name + ".synch", timer);
View Full Code Here

      close();
      throw e;

    } catch (IOException e) {
      close();
      throw new OStorageException("Error on creation of storage: " + name, e);

    } finally {
      lock.releaseExclusiveLock();
    }
  }
View Full Code Here

    lock.acquireExclusiveLock();
    try {

      if (!exists())
        throw new OStorageException("Can't open the storage '" + name + "' because it not exists in path: " + url);

      status = STATUS.OPEN;

    } finally {
      lock.releaseExclusiveLock();
View Full Code Here

      final OCluster cluster = getClusterById(iRid.clusterId);

      iRid.clusterPosition = cluster.addPhysicalPosition(0, offset, iRecordType);
      return iRid.clusterPosition;
    } catch (IOException e) {
      throw new OStorageException("Error on create record in cluster: " + iRid.clusterId, e);

    } finally {
      lock.releaseSharedLock();
      OProfiler.getInstance().stopChrono("OStorageMemory.createRecord", timer);
    }
View Full Code Here

      } finally {
        lockManager.releaseLock(Thread.currentThread(), iRid, LOCK.SHARED);
      }
    } catch (IOException e) {
      throw new OStorageException("Error on read record in cluster: " + iClusterSegment.getId(), e);

    } finally {
      lock.releaseSharedLock();
      OProfiler.getInstance().stopChrono("OStorageMemory.readRecord", timer);
    }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.exception.OStorageException

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.