Package com.orientechnologies.orient.core.exception

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


    if (iException instanceof OException)
      // RE-THROW IT
      throw (OException) iException;

    if (!(iException instanceof IOException))
      throw new OStorageException(iMessage, iException);

    if (status != STATUS.OPEN)
      // STORAGE CLOSED: DON'T HANDLE RECONNECTION
      return;

    final long lostConnectionTime = System.currentTimeMillis();

    final int currentMaxRetry;
    final int currentRetryDelay;
    if (clusterConfiguration != null) {
      // IN CLUSTER: NO RETRY AND 0 SLEEP TIME BETWEEN NODES
      currentMaxRetry = 1;
      currentRetryDelay = 0;
    } else {
      currentMaxRetry = connectionRetry;
      currentRetryDelay = connectionRetryDelay;
    }

    for (int retry = 0; retry < currentMaxRetry; ++retry) {
      // WAIT THE DELAY BEFORE TO RETRY
      if (currentRetryDelay > 0)
        try {
          Thread.sleep(currentRetryDelay);
        } catch (InterruptedException e) {
        }

      try {
        if (OLogManager.instance().isDebugEnabled())
          OLogManager.instance().debug(this, "Retrying to connect to remote server #" + retry + "/" + currentMaxRetry + "...");

        openRemoteDatabase();

        OLogManager.instance().info(this,
            "Connection re-acquired in transparent way after %dms and %d retries: no errors will be thrown at application level",
            System.currentTimeMillis() - lostConnectionTime, retry + 1);

        // RECONNECTED!
        return;

      } catch (Throwable t) {
        // DO NOTHING BUT CONTINUE IN THE LOOP
      }

      if (clusterConfiguration != null) {

      }
    }

    // RECONNECTION FAILED: THROW+LOG THE ORIGINAL EXCEPTION
    throw new OStorageException(iMessage, iException);
  }
View Full Code Here


    try {
      final Class<RuntimeException> excClass = (Class<RuntimeException>) Class.forName(iClassName);
      c = excClass.getConstructor(String.class);
    } catch (Exception e) {
      // UNABLE TO REPRODUCE THE SAME SERVER-SIZE EXCEPTION: THROW A STORAGE EXCEPTION
      rootException = new OStorageException(iMessage, null);
    }

    if (c != null)
      try {
        rootException = (RuntimeException) c.newInstance(iMessage);
View Full Code Here

      if (e instanceof OException)
        // PASS THROUGH
        throw (OException) e;
      else
        throw new OStorageException("Can't open the remote storage: " + name, e);

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

    if (iException instanceof OException)
      // RE-THROW IT
      throw (OException) iException;

    if (!(iException instanceof IOException))
      throw new OStorageException(iMessage, iException);

    while (retry < connectionRetry) {
      // WAIT THE DELAY BEFORE TO RETRY
      try {
        Thread.sleep(connectionRetryDelay);
      } catch (InterruptedException e) {
      }

      try {
        if (OLogManager.instance().isDebugEnabled())
          OLogManager.instance().debug(this, "Retrying to connect to remote server #" + retry + "/" + connectionRetry + "...");

        openRemoteDatabase(null, null);

        retry = 0;

        OLogManager.instance().info(this,
            "Connection re-acquired in transparent way: no errors will be thrown at application level");

        return;
      } catch (Throwable t) {
        ++retry;
      }
    }

    retry = 0;

    // RECONNECTION FAILED: THROW+LOG THE ORIGINAL EXCEPTION
    throw new OStorageException(iMessage, iException);
  }
View Full Code Here

        close();

      if (e instanceof OException)
        throw (OException) e;
      else
        throw new OStorageException("Can't open the remote storage: " + name, e);

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

    if (iException instanceof OException)
      // RE-THROW IT
      throw (OException) iException;

    if (!(iException instanceof IOException))
      throw new OStorageException(iMessage, iException);

    while (retry < connectionRetry) {
      // WAIT THE DELAY BEFORE TO RETRY
      try {
        Thread.sleep(connectionRetryDelay);
      } catch (InterruptedException e) {
      }

      try {
        if (OLogManager.instance().isDebugEnabled())
          OLogManager.instance().debug(this, "Retrying to connect to remote server #" + retry + "/" + connectionRetry + "...");

        openRemoteDatabase(null, null);

        retry = 0;

        OLogManager.instance().info(this,
            "Connection re-acquired in transparent way: no errors will be thrown at application level");

        return;
      } catch (Throwable t) {
        ++retry;
      }
    }

    retry = 0;

    // RECONNECTION FAILED: THROW+LOG THE ORIGINAL EXCEPTION
    throw new OStorageException(iMessage, iException);
  }
View Full Code Here

      if (c == null)
        c = excClass.getConstructor(String.class);

    } catch (Exception e) {
      // UNABLE TO REPRODUCE THE SAME SERVER-SIZE EXCEPTION: THROW A STORAGE EXCEPTION
      rootException = new OStorageException(iMessage, iPrevious);
    }

    if (c != null)
      try {
        if (c.getParameterTypes().length > 1)
View Full Code Here

        return;

      addUser();

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

      level2cache.startup();
      open = true;

      // 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
      OStorageDataConfiguration dataConfig;
      for (int i = 0; i < configuration.dataSegments.size(); ++i) {
        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
      OStorageClusterConfiguration clusterConfig;
      for (int i = 0; i < configuration.clusters.size(); ++i) {
        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();
          }
        }
      }

      loadVersion();

      txManager.open();

    } catch (Exception e) {
      open = false;
      dataSegments = new ODataLocal[0];
      clusters = new OCluster[0];
      clusterMap.clear();
      throw new OStorageException("Can't open local storage: " + url + ", with mode=" + mode, e);
    } finally {
      lock.releaseExclusiveLock(locked);

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

    final boolean locked = lock.acquireExclusiveLock();

    try {
      if (open)
        throw new OStorageException("Can't create new storage " + name + " because it isn't closed");

      addUser();
      level2cache.startup();

      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");

      open = true;

      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(locked);

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

          Thread.sleep(DELETE_WAIT_TIME);
        } catch (InterruptedException e) {
        }
      }

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

    } finally {
      lock.releaseExclusiveLock(locked);

      OProfiler.getInstance().stopChrono("storage." + name + ".delete", 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.