Skip to content

Instantly share code, notes, and snippets.

/**
* @author Prashant Deva
*/
public class ConnectionDataWriter
{
static class ConnectorHttpException extends HttpRequest.HttpRequestException
{
ConnectorHttpException(IOException cause)
{
super(cause);
class Foo
{
private boolean stop;
//called by thread 1
public void run()
{
while(!stop)
{
//do something
var GameSocket = (function () {
function GameSocket() {
this.wsInited = false;
}
GameSocket.onDataReceive = function (msg) {
var data = JSON.parse(msg.body);
var maxHeap = data.m;
var user = data.d.u;
var usedHeap = data.d.h;
private static Map<Long, Long> multiDataPointsToPerTxnSummedValue(List<MultiDataPoint> countsList)
{
Map<DateTime, Map<Long, Long>> timeStampToTxnIdToCountsMap = new HashMap<>();
for (MultiDataPoint multiDataPoint : countsList)
{
timeStampToTxnIdToCountsMap.put(multiDataPoint.getTimestamp(), convertToPerTxnData(multiDataPoint.getData()));
}
return timeStampToTxnIdToCountsMap.entrySet().stream()
static Filter createFilterForAllTxns(String metricName, ObjectId appId)
{
return new Filter()
.addAttribute("appid", appId.toString())
.addTag(metricName);
}
Interval tempInterval = new Interval(interval.getStart(), interval.getEnd().plusSeconds(1));
public static List<MultiDataPoint> convertValueResults(DruidValueResult[] results)
{
Map<DateTime, List<DruidValueResult>> timeStampToResults = Arrays.stream(results)
.collect(groupingBy(r -> DateTime.parse(r.timestamp)));
List<MultiDataPoint> multiDataPoints = timeStampToResults.entrySet()
.stream()
.map(e -> new MultiDataPoint(e.getKey(), e.getValue().stream()
.collect(toMap(r -> r.event.name, r -> r.event.value))))
@pdeva
pdeva / bf.java
Created September 15, 2014 05:09
import com.dripstat.billing.config.BillingConfig;
import net.billforward.exception.*;
import net.billforward.model.*;
import net.billforward.model.usage.Period;
import net.billforward.model.usage.Usage;
import net.billforward.model.usage.UsageSession;
import java.util.Date;
public class RealtimeUsagePriceCalculator
@pdeva
pdeva / spec.json
Last active August 29, 2015 14:06
[
{
"schema": {
"dataSource": "dripstat",
"aggregators": [
{
"type": "count",
"name": "count"
},
{
package com.dripstat.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Prashant Deva
*/
package com.dripstat.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Prashant Deva
*/