本文整理汇总了Java中org.apache.cassandra.exceptions.AlreadyExistsException类的典型用法代码示例。如果您正苦于以下问题:Java AlreadyExistsException类的具体用法?Java AlreadyExistsException怎么用?Java AlreadyExistsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlreadyExistsException类属于org.apache.cassandra.exceptions包,在下文中一共展示了AlreadyExistsException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: maybeCreateKeyspace
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
private void maybeCreateKeyspace(RequiresKeyspace rk, RequiresColumnFamily rcf) {
logger.debug("RequiresKeyspace annotation has keyspace name: {}", rk.ksName());
List<CFMetaData> cfs = extractColumnFamily(rcf);
try {
MigrationManager
.announceNewKeyspace(KSMetaData.newKeyspace(rk.ksName(),
rk.strategy(), KSMetaData.optsWithRF(rk.replication()), false, cfs));
} catch (AlreadyExistsException aee) {
logger.info("using existing Keyspace for " + rk.ksName());
if ( cfs.size() > 0 ) {
maybeTruncateSafely(rcf);
}
} catch (Exception ex) {
throw new RuntimeException("Failure creating keyspace for " + rk.ksName(),ex);
}
}
开发者ID:Netflix,项目名称:staash,代码行数:17,代码来源:CassandraRunner.java
示例2: maybeCreateColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
private void maybeCreateColumnFamily(RequiresColumnFamily rcf) {
try {
CFMetaData cfMetaData;
if ( rcf.isCounter() ) {
cfMetaData = new CFMetaData(rcf.ksName(), rcf.cfName(),
ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null)
.replicateOnWrite(false).defaultValidator(CounterColumnType.instance);
} else {
cfMetaData = new CFMetaData(rcf.ksName(), rcf.cfName(),
ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null);
}
MigrationManager.announceNewColumnFamily(cfMetaData);
} catch(AlreadyExistsException aee) {
logger.info("CF already exists for " + rcf.cfName());
maybeTruncateSafely(rcf);
} catch (Exception ex) {
throw new RuntimeException("Could not create CF for: " + rcf.cfName(), ex);
}
}
开发者ID:Netflix,项目名称:staash,代码行数:20,代码来源:CassandraRunner.java
示例3: announceMigration
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
try
{
MigrationManager.announceNewColumnFamily(getCFMetaData(), isLocalOnly);
return true;
}
catch (AlreadyExistsException e)
{
if (ifNotExists)
return false;
throw e;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:CreateTableStatement.java
示例4: announceMigration
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
try
{
MigrationManager.announceNewKeyspace(attrs.asKSMetadata(name), isLocalOnly);
return true;
}
catch (AlreadyExistsException e)
{
if (ifNotExists)
return false;
throw e;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:CreateKeyspaceStatement.java
示例5: announceNewKeyspace
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewKeyspace(KSMetaData ksm, long timestamp, boolean announceLocally) throws ConfigurationException
{
ksm.validate();
if (Schema.instance.getKSMetaData(ksm.name) != null)
throw new AlreadyExistsException(ksm.name);
logger.info(String.format("Create new Keyspace: %s", ksm));
announce(ksm.toSchema(timestamp), announceLocally);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:MigrationManager.java
示例6: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm, boolean announceLocally) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getKSMetaData(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add column family '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new ColumnFamily: %s", cfm));
announce(addSerializedKeyspace(cfm.toSchema(FBUtilities.timestampMicros()), cfm.ksName), announceLocally);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:MigrationManager.java
示例7: announceMigration
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public void announceMigration() throws RequestValidationException
{
try
{
MigrationManager.announceNewColumnFamily(getCFMetaData());
}
catch (AlreadyExistsException e)
{
if (!ifNotExists)
throw e;
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:CreateTableStatement.java
示例8: announceMigration
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public void announceMigration() throws RequestValidationException
{
try
{
MigrationManager.announceNewKeyspace(attrs.asKSMetadata(name));
}
catch (AlreadyExistsException e)
{
if (!ifNotExists)
throw e;
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:CreateKeyspaceStatement.java
示例9: announceNewKeyspace
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewKeyspace(KSMetaData ksm, long timestamp) throws ConfigurationException
{
ksm.validate();
if (Schema.instance.getKSMetaData(ksm.name) != null)
throw new AlreadyExistsException(ksm.name);
logger.info(String.format("Create new Keyspace: %s", ksm));
announce(ksm.toSchema(timestamp));
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:11,代码来源:MigrationManager.java
示例10: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getKSMetaData(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add column family '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new ColumnFamily: %s", cfm));
announce(cfm.toSchema(FBUtilities.timestampMicros()));
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:14,代码来源:MigrationManager.java
示例11: announceNewKeyspace
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewKeyspace(KeyspaceMetadata ksm, long timestamp, boolean announceLocally) throws ConfigurationException
{
ksm.validate();
if (Schema.instance.getKSMetaData(ksm.name) != null)
throw new AlreadyExistsException(ksm.name);
logger.info(String.format("Create new Keyspace: %s", ksm));
announce(SchemaKeyspace.makeCreateKeyspaceMutation(ksm, timestamp), announceLocally);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:MigrationManager.java
示例12: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
private static void announceNewColumnFamily(CFMetaData cfm, boolean announceLocally, boolean throwOnDuplicate) throws ConfigurationException
{
cfm.validate();
KeyspaceMetadata ksm = Schema.instance.getKSMetaData(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add table '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
// If we have a table or a view which has the same name, we can't add a new one
else if (throwOnDuplicate && ksm.getTableOrViewNullable(cfm.cfName) != null)
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new table: %s", cfm));
announce(SchemaKeyspace.makeCreateTableMutation(ksm, cfm, FBUtilities.timestampMicros()), announceLocally);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:MigrationManager.java
示例13: announceNewView
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewView(ViewDefinition view, boolean announceLocally) throws ConfigurationException
{
view.metadata.validate();
KeyspaceMetadata ksm = Schema.instance.getKSMetaData(view.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add table '%s' to non existing keyspace '%s'.", view.viewName, view.ksName));
else if (ksm.getTableOrViewNullable(view.viewName) != null)
throw new AlreadyExistsException(view.ksName, view.viewName);
logger.info(String.format("Create new view: %s", view));
announce(SchemaKeyspace.makeCreateViewMutation(ksm, view, FBUtilities.timestampMicros()), announceLocally);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:MigrationManager.java
示例14: testCreateWithIdDuplicate
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
@Test(expected = AlreadyExistsException.class)
public void testCreateWithIdDuplicate() throws Throwable
{
createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY(a, b))");
UUID id = currentTableMetadata().cfId;
execute(String.format("CREATE TABLE %%s (a int, b int, c int, PRIMARY KEY(a, b)) WITH ID = %s", id));
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:DropRecreateAndRestoreTest.java
示例15: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm, boolean announceLocally) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getKSMetaData(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add table '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new table: %s", cfm));
announce(addSerializedKeyspace(cfm.toSchema(FBUtilities.timestampMicros()), cfm.ksName), announceLocally);
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:14,代码来源:MigrationManager.java
示例16: announceNewKeyspace
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewKeyspace(KSMetaData ksm, long timestamp) throws ConfigurationException
{
ksm.validate();
if (Schema.instance.getTableDefinition(ksm.name) != null)
throw new AlreadyExistsException(ksm.name);
logger.info(String.format("Create new Keyspace: %s", ksm));
announce(ksm.toSchema(timestamp));
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:11,代码来源:MigrationManager.java
示例17: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getTableDefinition(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add column family '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new ColumnFamily: %s", cfm));
announce(cfm.toSchema(FBUtilities.timestampMicros()));
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:14,代码来源:MigrationManager.java
示例18: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getTableDefinition(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add column family '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new ColumnFamily: %s", cfm));
announce(serializeKeyspace(cfm.toSchema(FBUtilities.timestampMicros()), cfm.ksName));
}
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:14,代码来源:MigrationManager.java
示例19: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getKSMetaData(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add column family '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new ColumnFamily: %s", cfm));
announce(addSerializedKeyspace(cfm.toSchema(FBUtilities.timestampMicros()), cfm.ksName));
}
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:14,代码来源:MigrationManager.java
示例20: announceNewColumnFamily
import org.apache.cassandra.exceptions.AlreadyExistsException; //导入依赖的package包/类
public static void announceNewColumnFamily(CFMetaData cfm) throws ConfigurationException
{
cfm.validate();
KSMetaData ksm = Schema.instance.getTableDefinition(cfm.ksName);
if (ksm == null)
throw new ConfigurationException(String.format("Cannot add column family '%s' to non existing keyspace '%s'.", cfm.cfName, cfm.ksName));
else if (ksm.cfMetaData().containsKey(cfm.cfName))
throw new AlreadyExistsException(cfm.ksName, cfm.cfName);
logger.info(String.format("Create new ColumnFamily: %s", cfm));
announce(addSerializedKeyspace(cfm.toSchema(FBUtilities.timestampMicros()), cfm.ksName));
}
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:14,代码来源:MigrationManager.java
注:本文中的org.apache.cassandra.exceptions.AlreadyExistsException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论