• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TitanException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: execute

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
public static final<V> V execute(Callable<V> exe, Duration totalWaitTime) throws TitanException {
    try {
        return executeDirect(exe,totalWaitTime);
    } catch (BackendException e) {
        throw new TitanException("Could not execute operation due to backend exception",e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:BackendOperation.java


示例17: lock

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public void lock(Duration timeout) {
    boolean success = false;
    try {
        success = super.tryLock(timeout.toNanos(), TimeUnit.NANOSECONDS);
    } catch (InterruptedException e) {
        log.warn("Interrupted waiting for lock: {}",e);
    }
    if (!success) throw new TitanException("Possible dead lock detected. Waited for transaction lock without success");
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:11,代码来源:ReentrantTransactionLock.java


示例18: addIndexKey

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public void addIndexKey(final TitanGraphIndex index, final PropertyKey key, Parameter... parameters) {
    Preconditions.checkArgument(index != null && key != null && index instanceof TitanGraphIndexWrapper
            && !(key instanceof BaseKey), "Need to provide valid index and key");
    if (parameters == null) parameters = new Parameter[0];
    IndexType indexType = ((TitanGraphIndexWrapper) index).getBaseIndex();
    Preconditions.checkArgument(indexType instanceof MixedIndexType, "Can only add keys to an external index, not %s", index.name());
    Preconditions.checkArgument(indexType instanceof IndexTypeWrapper && key instanceof TitanSchemaVertex
            && ((IndexTypeWrapper) indexType).getSchemaBase() instanceof TitanSchemaVertex);

    TitanSchemaVertex indexVertex = (TitanSchemaVertex) ((IndexTypeWrapper) indexType).getSchemaBase();

    for (IndexField field : indexType.getFieldKeys())
        Preconditions.checkArgument(!field.getFieldKey().equals(key), "Key [%s] has already been added to index %s", key.name(), index.name());

    //Assemble parameters
    boolean addMappingParameter = !ParameterType.MAPPED_NAME.hasParameter(parameters);
    Parameter[] extendedParas = new Parameter[parameters.length + 1 + (addMappingParameter ? 1 : 0)];
    System.arraycopy(parameters, 0, extendedParas, 0, parameters.length);
    int arrPosition = parameters.length;
    if (addMappingParameter) extendedParas[arrPosition++] = ParameterType.MAPPED_NAME.getParameter(
            graph.getIndexSerializer().getDefaultFieldName(key, parameters, indexType.getBackingIndexName()));
    extendedParas[arrPosition++] = ParameterType.STATUS.getParameter(key.isNew() ? SchemaStatus.ENABLED : SchemaStatus.INSTALLED);

    addSchemaEdge(indexVertex, key, TypeDefinitionCategory.INDEX_FIELD, extendedParas);
    updateSchemaVertex(indexVertex);
    indexType.resetCache();
    //Check to see if the index supports this
    if (!graph.getIndexSerializer().supports((MixedIndexType) indexType, ParameterIndexField.of(key, parameters))) {
        throw new TitanException("Could not register new index field '" + key.name() + "' with index backend as the data type, cardinality or parameter combination is not supported.");
    }

    try {
        IndexSerializer.register((MixedIndexType) indexType, key, transaction.getTxHandle());
    } catch (BackendException e) {
        throw new TitanException("Could not register new index field with index backend", e);
    }
    if (!indexVertex.isNew()) updatedTypes.add(indexVertex);
    if (!key.isNew()) updateIndex(index, SchemaAction.REGISTER_INDEX);
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:41,代码来源:ManagementSystem.java


示例19: removeLogProcessor

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public synchronized boolean removeLogProcessor(String logIdentifier) {
    checkOpen();
    if (processorLogs.containsKey(logIdentifier)) {
        try {
            processorLogs.get(logIdentifier).close();
        } catch (BackendException e) {
            throw new TitanException("Could not close transaction log: "+ logIdentifier,e);
        }
        processorLogs.remove(logIdentifier);
        return true;
    } else return false;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:14,代码来源:StandardLogProcessorFramework.java


示例20: build

import com.thinkaurelius.titan.core.TitanException; //导入依赖的package包/类
@Override
public void build() {
    Preconditions.checkArgument(!processors.isEmpty(),"Must add at least one processor");
    ReadMarker readMarker;
    if (startTime==null && readMarkerName==null) {
        readMarker = ReadMarker.fromNow();
    } else if (readMarkerName==null) {
        readMarker = ReadMarker.fromTime(startTime);
    } else if (startTime==null) {
        readMarker = ReadMarker.fromIdentifierOrNow(readMarkerName);
    } else {
        readMarker = ReadMarker.fromIdentifierOrTime(readMarkerName, startTime);
    }
    synchronized (StandardLogProcessorFramework.this) {
        Preconditions.checkArgument(!processorLogs.containsKey(userLogName),
                "Processors have already been registered for user log: %s",userLogName);
        try {
            Log log = graph.getBackend().getUserLog(userLogName);
            log.registerReaders(readMarker,Iterables.transform(processors, new Function<ChangeProcessor, MessageReader>() {
                @Nullable
                @Override
                public MessageReader apply(@Nullable ChangeProcessor changeProcessor) {
                    return new MsgReaderConverter(userLogName, changeProcessor, retryAttempts);
                }
            }));
        } catch (BackendException e) {
            throw new TitanException("Could not open user transaction log for name: "+ userLogName,e);
        }
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:31,代码来源:StandardLogProcessorFramework.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GradiatedBackgroundProducer类代码示例发布时间:2022-05-22
下一篇:
Java FieldLabel类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap