Package io.sentry.protocol
Class SentryThread
java.lang.Object
io.sentry.protocol.SentryThread
- All Implemented Interfaces:
JsonSerializable,JsonUnknown
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 ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Map<String,SentryLockReason> Gets locks held by this thread.@Nullable LonggetId()Gets the Id of the thread.@Nullable StringgetName()Gets the name of the thread.@Nullable IntegerGets the priority of the thread.@Nullable SentryStackTraceGets the stacktrace of the thread.@Nullable StringgetState()Gets the state of the thread.@Nullable BooleanGets whether the crash happened on this thread.@Nullable BooleanGet an optional flag to indicate that the thread was in the foreground.@Nullable BooleanisDaemon()Gets if this thread is a daemon thread.@Nullable BooleanisMain()If applicable, a flag indicating whether the thread was responsible for rendering the user interface.voidserialize(@NotNull ObjectWriter writer, @NotNull ILogger logger) voidsetCrashed(@Nullable Boolean crashed) Sets whether the crash happened on this thread.voidsetCurrent(@Nullable Boolean current) Sets an optional flag to indicate that the thread was in the foreground.voidSets if this is a daemon thread.voidsetHeldLocks(@Nullable Map<String, SentryLockReason> heldLocks) Sets locks held by this thread.voidSets the Id of the thread.voidIf applicable, a flag indicating whether the thread was responsible for rendering the user interface.voidSets the name of the thread.voidsetPriority(@Nullable Integer priority) Sets the priority of the thread.voidsetStacktrace(@Nullable SentryStackTrace stacktrace) Sets the stacktrace of the thread.voidSets the state of the thread.voidsetUnknown(@Nullable Map<String, Object> unknown)
-
Constructor Details
-
SentryThread
public SentryThread()
-
-
Method Details
-
getId
Gets the Id of the thread.- Returns:
- the thread id.
-
setId
Sets the Id of the thread.- Parameters:
id- the thread id.
-
getName
Gets the name of the thread.- Returns:
- the name of the thread.
-
setName
Sets the name of the thread.- Parameters:
name- the name of the thread.
-
isCrashed
Gets whether the crash happened on this thread.- Returns:
- whether it was the crashed thread.
-
setCrashed
Sets whether the crash happened on this thread.- Parameters:
crashed- whether it was the crashed thread.
-
isCurrent
Get an optional flag to indicate that the thread was in the foreground.- Returns:
- whether the thread was in the foreground.
-
setCurrent
Sets an optional flag to indicate that the thread was in the foreground.- Parameters:
current- whether the thread was in the foreground.
-
getStacktrace
Gets the stacktrace of the thread.- Returns:
- the thread stacktrace.
-
setStacktrace
Sets the stacktrace of the thread.- Parameters:
stacktrace- the thread stacktrace.
-
getPriority
Gets the priority of the thread.- Returns:
- the thread priority.
-
setPriority
Sets the priority of the thread.- Parameters:
priority- of the thread.
-
isDaemon
Gets if this thread is a daemon thread.- Returns:
- if this is a daemon thread.
-
setDaemon
Sets if this is a daemon thread.- Parameters:
daemon- true if the thread is daemon thread. Otherwise false.
-
isMain
If applicable, a flag indicating whether the thread was responsible for rendering the user interface. On mobile platforms this is oftentimes referred to as the "main thread" or "ui thread".- Returns:
- if its the main thread or not
-
setMain
If applicable, a flag indicating whether the thread was responsible for rendering the user interface. On mobile platforms this is oftentimes referred to as the "main thread" or "ui thread".- Parameters:
main- if its the main thread or not
-
getState
Gets the state of the thread.- Returns:
- the state of the thread.
-
setState
Sets the state of the thread.- Parameters:
state- the state of the thread.
-
getHeldLocks
Gets locks held by this thread.- Returns:
- locks held by this thread
-
setHeldLocks
Sets locks held by this thread.- Parameters:
heldLocks- list of locks held by this thread
-
getUnknown
- Specified by:
getUnknownin interfaceJsonUnknown
-
setUnknown
- Specified by:
setUnknownin interfaceJsonUnknown
-
serialize
public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException - Specified by:
serializein interfaceJsonSerializable- Throws:
IOException
-