-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1865 from emeroad/TraceV2/TraceFormatV2
#1819 extract deserializer
- Loading branch information
Showing
15 changed files
with
305 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...ons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/AnnotationBoDecoder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.navercorp.pinpoint.common.server.bo; | ||
|
||
import com.navercorp.pinpoint.common.buffer.Buffer; | ||
import com.navercorp.pinpoint.common.util.AnnotationTranscoder; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Woonduk Kang(emeroad) | ||
*/ | ||
public class AnnotationBoDecoder { | ||
|
||
private final AnnotationTranscoder transcoder = new AnnotationTranscoder(); | ||
|
||
|
||
public List<AnnotationBo> decode(Buffer buffer) { | ||
|
||
final int size = buffer.readVInt(); | ||
if (size == 0) { | ||
// don' fix return Collections.emptyList(); | ||
// exist outer add method | ||
return new ArrayList<>(); | ||
} | ||
|
||
List<AnnotationBo> annotationBoList = new ArrayList<>(size); | ||
for (int i = 0; i < size; i++) { | ||
|
||
AnnotationBo annotation = decodeAnnotation(buffer); | ||
annotationBoList.add(annotation); | ||
|
||
} | ||
|
||
return annotationBoList; | ||
} | ||
|
||
|
||
public AnnotationBo decodeAnnotation(Buffer buffer) { | ||
|
||
final AnnotationBo annotation = new AnnotationBo(); | ||
|
||
annotation.setVersion(buffer.readByte()); | ||
annotation.setKey(buffer.readSVInt()); | ||
|
||
byte valueType = buffer.readByte(); | ||
annotation.setValueType(valueType); | ||
|
||
byte[] byteValue = buffer.readPrefixedBytes(); | ||
annotation.setByteValue(byteValue); | ||
|
||
Object decodeObject = transcoder.decode(valueType, byteValue); | ||
annotation.setValue(decodeObject); | ||
|
||
return annotation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.