Skip to content

Commit 402fefd

Browse files
committed
Add javadoc to Subsegment.close() method.
This method should not be used to end subsegments for segments using multiple threads as this can result in a deadlock. See #318 for details.
1 parent 3692320 commit 402fefd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities

aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities/Subsegment.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static Subsegment noOp(Segment parent, AWSXRayRecorder recorder) {
8787
/**
8888
* Serializes the subsegment as a standalone String with enough information for the subsegment to be streamed on its own.
8989
* @return
90-
* the string representation of the subsegment with enouogh information for it to be streamed
90+
* the string representation of the subsegment with enough information for it to be streamed
9191
*/
9292
String streamSerialize();
9393

@@ -96,10 +96,16 @@ static Subsegment noOp(Segment parent, AWSXRayRecorder recorder) {
9696
* own. Only used for debugging.
9797
*
9898
* @return
99-
* the pretty string representation of the subsegment with enouogh information for it to be streamed
99+
* the pretty string representation of the subsegment with enough information for it to be streamed
100100
*/
101101
String prettyStreamSerialize();
102102

103+
/**
104+
* Implements the {@link AutoCloseable} interface.
105+
*
106+
* <p>Warning. Avoid using this to end subsegments in asynchronous methods or other threads as this can cause
107+
* deadlocks. Instead, use {@link com.amazonaws.xray.AWSXRay#endSubsegment(Subsegment)}.
108+
*/
103109
@Override
104110
void close();
105111
}

0 commit comments

Comments
 (0)