Package com.thinkaurelius.titan.core

Examples of com.thinkaurelius.titan.core.TitanException


                }
            });
        } catch (Exception e) {
            if (e instanceof TitanException) throw (TitanException)e;
            else if (e.getCause() instanceof TitanException) throw (TitanException)e.getCause();
            else throw new TitanException(e);
        }
    }
View Full Code Here


    private HBaseAdmin getAdminInterface() {
        try {
            return new HBaseAdmin(hconf);
        } catch (IOException e) {
            throw new TitanException(e);
        }
    }
View Full Code Here

    public final Partitioner getPartitioner() {
        if (partitioner == null) {
            try {
                partitioner = Partitioner.getPartitioner(getCassandraPartitioner());
            } catch (StorageException e) {
                throw new TitanException("Could not connect to Cassandra to read partitioner information. Please check the connection", e);
            }
        }
        assert partitioner != null;
        return partitioner;
    }
View Full Code Here

        if (!response.isExists()) {
            CreateIndexResponse create = client.admin().indices().prepareCreate(indexName).execute().actionGet();
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                throw new TitanException("Interrupted while waiting for index to settle in", e);
            }
            if (!create.isAcknowledged()) throw new IllegalArgumentException("Could not create index: " + indexName);
        }
    }
View Full Code Here

                throw new TemporaryStorageException(msg);
            }
            log.debug("Cassandra process logged successful Thrift-port bind.");
        } catch (Exception e) {
            e.printStackTrace();
            throw new TitanException(e);
        }
    }
View Full Code Here

                Runtime.getRuntime().removeShutdownHook(cassandraKiller);
                cassandraKiller = null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new TitanException(e);
        }
    }
View Full Code Here

            } finally {
                systemConfig.close();
            }
            Preconditions.checkState(version != null, "Could not read version from storage backend");
            if (!TitanConstants.VERSION.equals(version) && !TitanConstants.COMPATIBLE_VERSIONS.contains(version)) {
                throw new TitanException("StorageBackend version is incompatible with current Titan version: " + version + " vs. " + TitanConstants.VERSION);
            }
        } catch (StorageException e) {
            throw new TitanException("Could not initialize backend", e);
        }
    }
View Full Code Here

                            doneSignal, failureCount, resultArray, i));
                }
                try {
                    doneSignal.await();
                } catch (InterruptedException e) {
                    throw new TitanException("Interrupted while waiting for multi-query to complete", e);
                }
                if (failureCount.get() > 0) {
                    throw new TitanException("Could not successfully complete multi-query. " + failureCount.get() + " individual queries failed.");
                }
                results = Arrays.asList(resultArray);
                assert keys.size() == results.size();
                for (List l : results) assert l != null;
            }
View Full Code Here

        do {
            try {
                return exe.call();
            } catch (StorageException e) {
                if (e instanceof TemporaryStorageException) lastException = e;
                else throw new TitanException("Permanent exception during backend operation",e); //Its permanent
            } catch (Throwable e) {
                throw new TitanException("Unexpected exception during backend operation",e);
            }
            //Wait and retry
            Preconditions.checkNotNull(lastException);
            if (System.currentTimeMillis()+waitTime<maxTime) {
                log.info("Temporary storage exception during backend operation. Attempting backoff retry",exe.toString(),lastException);
                try {
                    Thread.sleep(waitTime);
                } catch (InterruptedException r) {
                    throw new TitanException("Interrupted while waiting to retry failed storage operation", r);
                }
            }
            waitTime*=2; //Exponential backoff
        } while (System.currentTimeMillis()<maxTime);
        throw new TitanException("Could not successfully complete backend operation due to repeated temporary exceptions after "+maxTimeMS+" ms",lastException);
    }
View Full Code Here

        do {
            try {
                return exe.call();
            } catch (StorageException e) {
                if (e instanceof TemporaryStorageException) lastException = e;
                else throw new TitanException("Permanent exception during backend operation",e); //Its permanent
            } catch (Throwable e) {
                throw new TitanException("Unexpected exception during backend operation",e);
            }
            //Wait and retry
            retryAttempts++;
            Preconditions.checkNotNull(lastException);
            if (retryAttempts<maxRetryAttempts) {
                long waitTime = Math.round(retryWaittime+((Math.random()*WAITTIME_PERTURBATION_PERCENTAGE-WAITTIME_PERTURBATION_PERCENTAGE_HALF)*retryWaittime));
                Preconditions.checkArgument(waitTime>=0,"Invalid wait time: %s",waitTime);
                log.info("Temporary storage exception during backend operation [{}]. Attempting incremental retry",exe.toString(),lastException);
                try {
                    Thread.sleep(waitTime);
                } catch (InterruptedException r) {
                    throw new TitanException("Interrupted while waiting to retry failed backend operation", r);
                }
            }
        } while (retryAttempts<maxRetryAttempts);
        throw new TitanException("Could not successfully complete backend operation due to repeated temporary exceptions after "+maxRetryAttempts+" attempts",lastException);
    }
View Full Code Here

TOP

Related Classes of com.thinkaurelius.titan.core.TitanException

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.