当前位置: 首页>>代码示例>>Java>>正文


Java TitanException类代码示例

本文整理汇总了Java中com.thinkaurelius.titan.core.TitanException的典型用法代码示例。如果您正苦于以下问题:Java TitanException类的具体用法?Java TitanException怎么用?Java TitanException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TitanException类属于com.thinkaurelius.titan.core包,在下文中一共展示了TitanException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveWithRetry

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
static <E extends ZonableEntity> E saveWithRetry(final GraphGenericRepository<E> repository,
        final E zonableEntity, final int retryCount) throws TitanException {
    try {
        repository.save(zonableEntity);
    } catch (TitanException te) {
        if (te.getCause().getCause().getMessage().contains("Local lock") && retryCount > 0) {
            try {
                Thread.sleep(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            zonableEntity.setId(0L); // Repository does not reset the vertex Id, on commit failure. Clear.
            saveWithRetry(repository, zonableEntity, retryCount - 1);
        } else {
            throw te;
        }
    }
    return zonableEntity;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:20,代码来源:GraphResourceRepositoryTest.java

示例2: add

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public synchronized Future<Message> add(StaticBuffer content) {
    TestMessage msg = new TestMessage(content);
    FutureMessage<TestMessage> fmsg = new FutureMessage<TestMessage>(msg);

    if (failAdds) {
        System.out.println("Failed message add");
        throw new TitanException("Log unavailable");
    }

    if (readers.isEmpty()) {
        messageBacklog.add(fmsg);
    } else {
        process(fmsg);
    }
    return fmsg;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:18,代码来源:TestMockLog.java

示例3: testIDBlockAllocationTimeout

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Test
public void testIDBlockAllocationTimeout()
{
    config.set("ids.authority.wait-time", Duration.of(0L, ChronoUnit.NANOS));
    config.set("ids.renew-timeout", Duration.of(1L, ChronoUnit.MILLIS));
    close();
    TitanCleanup.clear(graph);
    open(config);
    try {
        graph.addVertex();
        fail();
    } catch (TitanException e) {

    }

    assertTrue(graph.isOpen());

    close(); // must be able to close cleanly

    // Must be able to reopen
    open(config);

    assertEquals(0L, (long)graph.traversal().V().count().next());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:25,代码来源:BerkeleyGraphTest.java

示例4: checkForOrCreateIndex

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
/**
 * If ES already contains this instance's target index, then do nothing.
 * Otherwise, create the index, then wait {@link #CREATE_SLEEP}.
 * <p>
 * The {@code client} field must point to a live, connected client.
 * The {@code indexName} field must be non-null and point to the name
 * of the index to check for existence or create.
 *
 * @param config the config for this ElasticSearchIndex
 * @throws java.lang.IllegalArgumentException if the index could not be created
 */
private void checkForOrCreateIndex(Configuration config) {
    Preconditions.checkState(null != client);

    //Create index if it does not already exist
    IndicesExistsResponse response = client.admin().indices().exists(new IndicesExistsRequest(indexName)).actionGet();
    if (!response.isExists()) {

        ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();

        ElasticSearchSetup.applySettingsFromTitanConf(settings, config, ES_CREATE_EXTRAS_NS);

        CreateIndexResponse create = client.admin().indices().prepareCreate(indexName)
                .setSettings(settings.build()).execute().actionGet();
        try {
            final long sleep = config.get(CREATE_SLEEP);
            log.debug("Sleeping {} ms after {} index creation returned from actionGet()", sleep, indexName);
            Thread.sleep(sleep);
        } 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);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:35,代码来源:ElasticSearchIndex.java

示例5: testErrorInBatch

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Test
public void testErrorInBatch() throws Exception {
    initialize("vertex");
    Multimap<String, Object> doc1 = HashMultimap.create();
    doc1.put(TIME, "not a time");

    add("vertex", "failing-doc", doc1, true);
    add("vertex", "non-failing-doc", getRandomDocument(), true);

    try {
        tx.commit();
        fail("Commit should not have succeeded.");
    } catch (TitanException e) {
        // Looking for a NumberFormatException since we tried to stick a string of text into a time field.
        if (!Throwables.getRootCause(e).getMessage().contains("NumberFormatException")) {
            throw e;
        }
    } finally {
        tx = null;
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:22,代码来源:ElasticSearchIndexTest.java

示例6: getSlice

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public EntryList getSlice(final KeySliceQuery query, final StoreTransaction txh) throws BackendException {
    incActionBy(1, CacheMetricsAction.RETRIEVAL,txh);
    if (isExpired(query)) {
        incActionBy(1, CacheMetricsAction.MISS,txh);
        return store.getSlice(query, unwrapTx(txh));
    }

    try {
        return cache.get(query,new Callable<EntryList>() {
            @Override
            public EntryList call() throws Exception {
                incActionBy(1, CacheMetricsAction.MISS,txh);
                return store.getSlice(query, unwrapTx(txh));
            }
        });
    } 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);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:23,代码来源:ExpirationKCVSCache.java

示例7: getStandaloneGlobalConfiguration

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
public static KCVSConfiguration getStandaloneGlobalConfiguration(final KeyColumnValueStoreManager manager,
                                                                 final Configuration config) {
    try {
        final StoreFeatures features = manager.getFeatures();
        return getGlobalConfiguration(new BackendOperation.TransactionalProvider() {
            @Override
            public StoreTransaction openTx() throws BackendException {
                return manager.beginTransaction(StandardBaseTransactionConfig.of(config.get(TIMESTAMP_PROVIDER),features.getKeyConsistentTxConfig()));
            }

            @Override
            public void close() throws BackendException {
                manager.close();
            }
        },manager.openDatabase(SYSTEM_PROPERTIES_STORE_NAME),config);
    } catch (BackendException e) {
        throw new TitanException("Could not open global configuration",e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:20,代码来源:Backend.java

示例8: shutdown

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public synchronized void shutdown() throws TitanException {
    if (!isOpen) return;
    isOpen = false;
    try {
        try {
            for (Log log : processorLogs.values()) {
                log.close();
            }
            processorLogs.clear();
        } finally {
        }
    } catch (BackendException e) {
        throw new TitanException(e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:17,代码来源:StandardLogProcessorFramework.java

示例9: writeObjectNotNullInternal

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
private DataOutput writeObjectNotNullInternal(Object object, boolean byteOrder) {
    Preconditions.checkNotNull(object);
    AttributeSerializer s = getSerializer(object.getClass());
    if (byteOrder) {
        Preconditions.checkArgument(s!=null && s instanceof OrderPreservingSerializer,"Invalid serializer for class: %s",object.getClass());
        ((OrderPreservingSerializer)s).writeByteOrder(this,object);
    } else {
        if (s!=null) s.write(this, object);
        else {
            try {
                getBackupSerializer().writeObjectNotNull(this,object);
            } catch (Exception e) {
                throw new TitanException("Serializer Restriction: Cannot serialize object of type: " + object.getClass(),e);
            }
        }
    }
    return this;
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:19,代码来源:StandardSerializer.java

示例10: testAllocationTimeout

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Test
public void testAllocationTimeout() {
    final MockIDAuthority idauth = new MockIDAuthority(10000, Integer.MAX_VALUE, 5000);
    StandardIDPool pool = new StandardIDPool(idauth, 1, 1, Integer.MAX_VALUE, Duration.ofMillis(4000), 0.1);
    try {
        pool.nextID();
        fail();
    } catch (TitanException e) {

    }

}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:13,代码来源:IDPoolTest.java

示例11: add

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public void add(StaticBuffer key, Entry cell) {
    try {
        kcvs.mutateEntries(key, Lists.newArrayList(cell), KCVSCache.NO_DELETIONS,tx);
    } catch (BackendException e) {
        throw new TitanException("Unexpected storage exception in log persistence against cache",e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:9,代码来源:ExternalCachePersistor.java

示例12: close

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public void close() {
    try {
        store.close();
        txProvider.close();
        IOUtils.closeQuietly(serializer);
    } catch (BackendException e) {
        throw new TitanException("Could not close configuration store",e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:11,代码来源:KCVSConfiguration.java

示例13: getSystemTxLog

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
public KCVSLog getSystemTxLog() {
    try {
        return txLogManager.openLog(SYSTEM_TX_LOG_NAME);
    } catch (BackendException e) {
        throw new TitanException("Could not re-open transaction log", e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:Backend.java

示例14: getSystemMgmtLog

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
public Log getSystemMgmtLog() {
    try {
        return mgmtLogManager.openLog(SYSTEM_MGMT_LOG_NAME);
    } catch (BackendException e) {
        throw new TitanException("Could not re-open management log", e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:Backend.java

示例15: getConfiguration

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
private static KCVSConfiguration getConfiguration(final BackendOperation.TransactionalProvider txProvider,
                                                        final KeyColumnValueStore store, final String identifier,
                                                        final Configuration config) {
    try {
        KCVSConfiguration kcvsConfig =
                new KCVSConfiguration(txProvider,config,store,identifier);
        kcvsConfig.setMaxOperationWaitTime(config.get(SETUP_WAITTIME));
        return kcvsConfig;
    } catch (BackendException e) {
        throw new TitanException("Could not open global configuration",e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:13,代码来源:Backend.java


注:本文中的com.thinkaurelius.titan.core.TitanException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。