use of org.apache.cassandra.thrift.ConsistencyLevel in project cassandra-indexing by hmsonline.
the class CassandraIndexAspect method process.
@Around("execution(* org.apache.cassandra.thrift.CassandraServer.doInsert(..))")
public void process(ProceedingJoinPoint joinPoint) throws Throwable {
ConsistencyLevel consistency = (ConsistencyLevel) joinPoint.getArgs()[0];
@SuppressWarnings("unchecked") List<IMutation> mutations = (List<IMutation>) joinPoint.getArgs()[1];
Handler handler = new Handler(cluster, indexDao, configurationDao, mutations, consistency);
Future<?> future = executors.submit(handler);
future.get();
joinPoint.proceed(joinPoint.getArgs());
}
use of org.apache.cassandra.thrift.ConsistencyLevel in project eiger by wlloyd.
the class CounterColumn method sendToOtherReplica.
private static void sendToOtherReplica(DecoratedKey key, ColumnFamily cf) throws UnavailableException, TimeoutException, IOException {
RowMutation rm = new RowMutation(cf.metadata().ksName, key.key);
rm.add(cf);
final InetAddress local = FBUtilities.getBroadcastAddress();
String localDataCenter = DatabaseDescriptor.getEndpointSnitch().getDatacenter(local);
StorageProxy.performWrite(rm, ConsistencyLevel.ANY, localDataCenter, new StorageProxy.WritePerformer() {
@Override
public void apply(IMutation mutation, Collection<InetAddress> targets, IWriteResponseHandler responseHandler, String localDataCenter, ConsistencyLevel consistency_level) throws IOException, TimeoutException {
// We should only send to the remote replica, not the local one
targets.remove(local);
// Fake local response to be a good lad but we won't wait on the responseHandler
responseHandler.response(null);
StorageProxy.sendToHintedEndpoints((RowMutation) mutation, targets, responseHandler, localDataCenter, consistency_level);
}
});
// we don't wait for answers
}
Aggregations