Skip to content

Commit

Permalink
merge pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
RuedigerMoeller committed Jun 19, 2017
1 parent f2d7de4 commit a83b3e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>2.50</version>
<version>2.51</version>
<packaging>bundle</packaging>

<description>A fast java serialization drop in-replacement and some serialization based utils such as Structs and OffHeap Memory.</description>
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/org/nustaq/serialization/FSTObjectOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public class FSTObjectOutput implements ObjectOutput {
protected final FSTClazzInfo stringInfo;
protected boolean isCrossPlatform;

protected ThreadLocal<FSTClazzInfo.FSTFieldInfo[]> refsLocal = new ThreadLocal() {
@Override
protected Object initialValue() {
return new FSTClazzInfo.FSTFieldInfo[20];
}
};

FSTClazzInfo.FSTFieldInfo[] refs;
/**
* Creates a new FSTObjectOutput stream to write data to the specified
* underlying output stream.
Expand Down Expand Up @@ -286,10 +294,11 @@ public void writeObject(Object obj, Class... possibles) throws IOException {
writeObjectInternal(obj, null, possibles);
}

protected FSTClazzInfo.FSTFieldInfo refs[] = new FSTClazzInfo.FSTFieldInfo[20];

//avoid creation of dummy ref
protected FSTClazzInfo.FSTFieldInfo getCachedFI( Class... possibles ) {
if ( refs == null ) {
refs = refsLocal.get();
}
if ( curDepth >= refs.length ) {
return new FSTClazzInfo.FSTFieldInfo(possibles, null, true);
} else {
Expand Down

0 comments on commit a83b3e1

Please sign in to comment.