Java Code Examples for me.prettyprint.hector.api.beans.HCounterColumn#getValue()
The following examples show how to use
me.prettyprint.hector.api.beans.HCounterColumn#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Cassandra12xCounterDAO.java From cumulusrdf with Apache License 2.0 | 6 votes |
@Override public Long get(final K key) { final CounterQuery<K, String> counter = new ThriftCounterColumnQuery<K, String>(_keyspace, _serializer_k, STRING_SERIALIZER); counter.setColumnFamily(_cf_name).setKey(key).setName(COLUMN_NAME_AS_STRING); final HCounterColumn<String> c = counter.execute().get(); if (c == null) { if (_default_value != null) { return _default_value; } else { return null; } } else { return c.getValue(); } }
Example 2
Source File: OpsCiStateDao.java From oneops with Apache License 2.0 | 5 votes |
public Long getComponentStatesTimestamp(Long manifestIds) { CounterQuery<Long, String> query = HFactory.createCounterColumnQuery(keyspace, longSerializer, stringSerializer); query.setKey(manifestIds); query.setColumnFamily(SchemaBuilder.COMPONENT_STATE_CF); query.setName(COMPONENT_TIMESTAMP); QueryResult<HCounterColumn<String>> qResult = query.execute(); HCounterColumn<String> col = qResult.get(); if (col != null) { return col.getValue(); } else { return null; } }
Example 3
Source File: QueueManagerImpl.java From usergrid with Apache License 2.0 | 5 votes |
public AggregateCounterSet getAggregateCounters( UUID queueId, String category, String counterName, CounterResolution resolution, long start, long finish, boolean pad ) { start = resolution.round( start ); finish = resolution.round( finish ); long expected_time = start; Keyspace ko = cass.getApplicationKeyspace( applicationId ); SliceCounterQuery<String, Long> q = createCounterSliceQuery( ko, se, le ); q.setColumnFamily( APPLICATION_AGGREGATE_COUNTERS.getColumnFamily() ); q.setRange( start, finish, false, ALL_COUNT ); QueryResult<CounterSlice<Long>> r = q.setKey( counterUtils.getAggregateCounterRow( counterName, null, null, queueId, category, resolution ) ) .execute(); List<AggregateCounter> counters = new ArrayList<AggregateCounter>(); for ( HCounterColumn<Long> column : r.get().getColumns() ) { AggregateCounter count = new AggregateCounter( column.getName(), column.getValue() ); if ( pad && !( resolution == CounterResolution.ALL ) ) { while ( count.getTimestamp() != expected_time ) { counters.add( new AggregateCounter( expected_time, 0 ) ); expected_time = resolution.next( expected_time ); } expected_time = resolution.next( expected_time ); } counters.add( count ); } if ( pad && !( resolution == CounterResolution.ALL ) ) { while ( expected_time <= finish ) { counters.add( new AggregateCounter( expected_time, 0 ) ); expected_time = resolution.next( expected_time ); } } return new AggregateCounterSet( counterName, queueId, category, counters ); }