本文整理汇总了Java中org.apache.cassandra.service.StorageProxy.mutate方法的典型用法代码示例。如果您正苦于以下问题:Java StorageProxy.mutate方法的具体用法?Java StorageProxy.mutate怎么用?Java StorageProxy.mutate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.service.StorageProxy
的用法示例。
在下文中一共展示了StorageProxy.mutate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mutate
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void mutate(List<org.apache.cassandra.db.Mutation> cmds, org.apache.cassandra.db.ConsistencyLevel clvl) throws BackendException {
try {
schedule(DatabaseDescriptor.getRpcTimeout());
try {
if (atomicBatch) {
StorageProxy.mutateAtomically(cmds, clvl);
} else {
StorageProxy.mutate(cmds, clvl);
}
} catch (RequestExecutionException e) {
throw new TemporaryBackendException(e);
} finally {
release();
}
} catch (TimeoutException ex) {
log.debug("Cassandra TimeoutException", ex);
throw new TemporaryBackendException(ex);
}
}
示例2: mutate
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void mutate(List<RowMutation> cmds, org.apache.cassandra.db.ConsistencyLevel clvl) throws BackendException {
try {
schedule(DatabaseDescriptor.getRpcTimeout());
try {
if (atomicBatch) {
StorageProxy.mutateAtomically(cmds, clvl);
} else {
StorageProxy.mutate(cmds, clvl);
}
} catch (RequestExecutionException e) {
throw new TemporaryBackendException(e);
} finally {
release();
}
} catch (TimeoutException ex) {
log.debug("Cassandra TimeoutException", ex);
throw new TemporaryBackendException(ex);
}
}
示例3: doInsert
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void doInsert(ConsistencyLevel consistency_level, List<? extends IMutation> mutations, boolean mutateAtomically)
throws UnavailableException, TimedOutException, org.apache.cassandra.exceptions.InvalidRequestException
{
org.apache.cassandra.db.ConsistencyLevel consistencyLevel = ThriftConversion.fromThrift(consistency_level);
//wso2
consistencyLevel.validateForWrite(state().getResolvedKeyspace());
if (mutations.isEmpty())
return;
schedule(DatabaseDescriptor.getWriteRpcTimeout());
try
{
if (mutateAtomically)
StorageProxy.mutateAtomically((List<RowMutation>) mutations, consistencyLevel);
else
StorageProxy.mutate(mutations, consistencyLevel);
}
catch (RequestExecutionException e)
{
ThriftConversion.rethrow(e);
}
finally
{
release();
}
}
示例4: doInsert
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void doInsert(ConsistencyLevel consistency_level, List<? extends IMutation> mutations, boolean mutateAtomically)
throws UnavailableException, TimedOutException, org.apache.cassandra.exceptions.InvalidRequestException
{
org.apache.cassandra.db.ConsistencyLevel consistencyLevel = ThriftConversion.fromThrift(consistency_level);
consistencyLevel.validateForWrite(state().getKeyspace());
if (mutations.isEmpty())
return;
schedule(DatabaseDescriptor.getWriteRpcTimeout());
try
{
if (mutateAtomically)
StorageProxy.mutateAtomically((List<RowMutation>) mutations, consistencyLevel);
else
StorageProxy.mutate(mutations, consistencyLevel);
}
catch (RequestExecutionException e)
{
ThriftConversion.rethrow(e);
}
finally
{
release();
}
}
示例5: testWriting
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private static void testWriting() throws Exception
{
// do some writing.
for (int i = 0; i < 100; i++)
{
RowMutation change = new RowMutation(KEYSPACE, ByteBufferUtil.bytes(("key" + i)));
ColumnPath cp = new ColumnPath(COLUMN_FAMILY).setColumn(("colb").getBytes());
change.add(new QueryPath(cp), ByteBufferUtil.bytes(("value" + i)), 0);
// don't call change.apply(). The reason is that is makes a static call into Table, which will perform
// local storage initialization, which creates local directories.
// change.apply();
StorageProxy.mutate(Arrays.asList(change), ConsistencyLevel.ONE);
System.out.println("wrote key" + i);
}
System.out.println("Done writing.");
}
示例6: doInsert
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void doInsert(ConsistencyLevel consistency_level,
List<? extends IMutation> mutations) throws UnavailableException,
TimedOutException, InvalidRequestException {
ThriftValidation.validateConsistencyLevel(state().getKeyspace(),
consistency_level);
try {
schedule();
try {
if (!mutations.isEmpty())
StorageProxy.mutate(mutations, consistency_level);
} catch (TimeoutException e) {
throw new TimedOutException();
}
} finally {
release();
}
}
示例7: mutateWithCatch
import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
static void mutateWithCatch(Mutation mutation)
{
try
{
StorageProxy.mutate(Collections.singletonList(mutation), ConsistencyLevel.ANY);
}
catch (OverloadedException e)
{
Tracing.logger.warn("Too many nodes are overloaded to save trace events");
}
}