Package io.sentry.protocol
Class SentryThread
- java.lang.Object
-
- io.sentry.protocol.SentryThread
-
- All Implemented Interfaces:
JsonSerializable,JsonUnknown
public final class SentryThread extends java.lang.Object implements JsonUnknown, JsonSerializable
A process thread of an event.The Threads Interface specifies threads that were running at the time an event happened. These threads can also contain stack traces.
An event may contain one or more threads in an attribute named `threads`.
The following example illustrates the threads part of the event payload and omits other attributes for simplicity.
```json { "threads": { "values": [ { "id": "0", "name": "main", "crashed": true, "stacktrace": {} } ] } } ```
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSentryThread.Deserializerstatic classSentryThread.JsonKeys
-
Constructor Summary
Constructors Constructor Description SentryThread()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable java.lang.LonggetId()Gets the Id of the thread.@Nullable java.lang.StringgetName()Gets the name of the thread.@Nullable java.lang.IntegergetPriority()Gets the priority of the thread.@Nullable SentryStackTracegetStacktrace()Gets the stacktrace of the thread.@Nullable java.lang.StringgetState()Gets the state of the thread.@Nullable java.util.Map<java.lang.String,java.lang.Object>getUnknown()@Nullable java.lang.BooleanisCrashed()Gets whether the crash happened on this thread.@Nullable java.lang.BooleanisCurrent()Get an optional flag to indicate that the thread was in the foreground.@Nullable java.lang.BooleanisDaemon()Gets if this thread is a daemon thread.voidserialize(@NotNull JsonObjectWriter writer, @NotNull ILogger logger)voidsetCrashed(@Nullable java.lang.Boolean crashed)Sets whether the crash happened on this thread.voidsetCurrent(@Nullable java.lang.Boolean current)Sets an optional flag to indicate that the thread was in the foreground.voidsetDaemon(@Nullable java.lang.Boolean daemon)Sets if this is a daemon thread.voidsetId(@Nullable java.lang.Long id)Sets the Id of the thread.voidsetName(@Nullable java.lang.String name)Sets the name of the thread.voidsetPriority(@Nullable java.lang.Integer priority)Sets the priority of the thread.voidsetStacktrace(@Nullable SentryStackTrace stacktrace)Sets the stacktrace of the thread.voidsetState(@Nullable java.lang.String state)Sets the state of the thread.voidsetUnknown(@Nullable java.util.Map<java.lang.String,java.lang.Object> unknown)
-
-
-
Method Detail
-
getId
@Nullable public @Nullable java.lang.Long getId()
Gets the Id of the thread.- Returns:
- the thread id.
-
setId
public void setId(@Nullable @Nullable java.lang.Long id)Sets the Id of the thread.- Parameters:
id- the thread id.
-
getName
@Nullable public @Nullable java.lang.String getName()
Gets the name of the thread.- Returns:
- the name of the thread.
-
setName
public void setName(@Nullable @Nullable java.lang.String name)Sets the name of the thread.- Parameters:
name- the name of the thread.
-
isCrashed
@Nullable public @Nullable java.lang.Boolean isCrashed()
Gets whether the crash happened on this thread.- Returns:
- whether it was the crashed thread.
-
setCrashed
public void setCrashed(@Nullable @Nullable java.lang.Boolean crashed)Sets whether the crash happened on this thread.- Parameters:
crashed- whether it was the crashed thread.
-
isCurrent
@Nullable public @Nullable java.lang.Boolean isCurrent()
Get an optional flag to indicate that the thread was in the foreground.- Returns:
- whether the thread was in the foreground.
-
setCurrent
public void setCurrent(@Nullable @Nullable java.lang.Boolean current)Sets an optional flag to indicate that the thread was in the foreground.- Parameters:
current- whether the thread was in the foreground.
-
getStacktrace
@Nullable public @Nullable SentryStackTrace getStacktrace()
Gets the stacktrace of the thread.- Returns:
- the thread stacktrace.
-
setStacktrace
public void setStacktrace(@Nullable @Nullable SentryStackTrace stacktrace)Sets the stacktrace of the thread.- Parameters:
stacktrace- the thread stacktrace.
-
getPriority
@Nullable public @Nullable java.lang.Integer getPriority()
Gets the priority of the thread.- Returns:
- the thread priority.
-
setPriority
public void setPriority(@Nullable @Nullable java.lang.Integer priority)Sets the priority of the thread.- Parameters:
priority- of the thread.
-
isDaemon
@Nullable public @Nullable java.lang.Boolean isDaemon()
Gets if this thread is a daemon thread.- Returns:
- if this is a daemon thread.
-
setDaemon
public void setDaemon(@Nullable @Nullable java.lang.Boolean daemon)Sets if this is a daemon thread.- Parameters:
daemon- true if the thread is daemon thread. Otherwise false.
-
getState
@Nullable public @Nullable java.lang.String getState()
Gets the state of the thread.- Returns:
- the state of the thread.
-
setState
public void setState(@Nullable @Nullable java.lang.String state)Sets the state of the thread.- Parameters:
state- the state of the thread.
-
getUnknown
@Nullable public @Nullable java.util.Map<java.lang.String,java.lang.Object> getUnknown()
- Specified by:
getUnknownin interfaceJsonUnknown
-
setUnknown
public void setUnknown(@Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> unknown)- Specified by:
setUnknownin interfaceJsonUnknown
-
serialize
public void serialize(@NotNull @NotNull JsonObjectWriter writer, @NotNull @NotNull ILogger logger) throws java.io.IOException- Specified by:
serializein interfaceJsonSerializable- Throws:
java.io.IOException
-
-