ThreadResource supports JSON serde at present.
The goal of this task is to add Thrift annotations so that in the future we can use Thrift serde.
*/
package com.facebook.presto.server;
+import com.facebook.drift.annotations.ThriftConstructor;
+import com.facebook.drift.annotations.ThriftField;
+import com.facebook.drift.annotations.ThriftStruct;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
@@ -74,6 +77,7 @@ public class ThreadResource
return builder.build();
}
+ @ThriftStruct
public static class Info
{
private final long id;
@@ -82,6 +86,7 @@ public class ThreadResource
private final Long lockOwnerId;
private final List<StackLine> stackTrace;
+ @ThriftConstructor
@JsonCreator
public Info(
@JsonProperty("id") long id,
@@ -97,30 +102,35 @@ public class ThreadResource
this.stackTrace = stackTrace;
}
+ @ThriftField(1)
@JsonProperty
public long getId()
{
return id;
}
+ @ThriftField(2)
@JsonProperty
public String getName()
{
return name;
}
+ @ThriftField(3)
@JsonProperty
public String getState()
{
return state;
}
+ @ThriftField(4)
@JsonProperty
public Long getLockOwnerId()
{
return lockOwnerId;
}
+ @ThriftField(5)
@JsonProperty
public List<StackLine> getStackTrace()
{
@@ -140,6 +150,7 @@ public class ThreadResource
}
}
+ @ThriftStruct
public static class StackLine
{
private final String file;
@@ -147,6 +158,7 @@ public class ThreadResource
private final String className;
private final String method;
+ @ThriftConstructor
@JsonCreator
public StackLine(
@JsonProperty("file") String file,
@@ -160,24 +172,28 @@ public class ThreadResource
this.method = method;
}
+ @ThriftField(1)
@JsonProperty
public String getFile()
{
return file;
}
+ @ThriftField(2)
@JsonProperty
public int getLine()
{
return line;
}
+ @ThriftField(3)
@JsonProperty
public String getClassName()
{
return className;
}
+ @ThriftField(4)
@JsonProperty
public String getMethod()
{
