Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/main/java/org/nustaq/serialization/FSTClazzInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void setDecoderAttached(Object decoderAttached) {
boolean isAsciiNameShortString = false;
boolean requiresInit = false;
boolean hasTransient;
FSTObjectSerializer ser;
volatile FSTObjectSerializer ser;
FSTFieldInfo fieldInfo[]; // serializable fields

Class clazz;
Expand Down Expand Up @@ -975,19 +975,21 @@ public String getName() {
* @return
*/
public FSTObjectSerializer getSer() {
if (ser == null) {
FSTObjectSerializer serializer = ser;
if (serializer == null) {
if (clazz == null) {
return null;
}
ser = getSerNoStore();
if (ser == null) {
serializer = getSerNoStore();
if (serializer == null) {
ser = FSTSerializerRegistry.NULL;
return null;
}
}
if (ser == FSTSerializerRegistry.NULL) {
ser = serializer;
} else if (serializer == FSTSerializerRegistry.NULL) {
return null;
}
return ser;
return serializer;
}

// no sideffecting lookup
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/nustaq/serialization/FSTObjectInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ public void close() throws IOException {
closed = true;
resetAndClearRefs();
conf.returnObject(objects);
objects = null;
getCodec().close();
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/nustaq/serialization/FSTObjectOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ public void flush() throws IOException {
public void close() throws IOException {
flush();
closed = true;
getCodec().close();
resetAndClearRefs();
getCodec().close();
conf.returnObject(objects);
objects = null;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FSTSerializerRegistry {

private FSTSerializerRegistryDelegate delegate;

public static FSTObjectSerializer NULL = new NULLSerializer();
public static final FSTObjectSerializer NULL = new NULLSerializer();

public void setDelegate(FSTSerializerRegistryDelegate delegate) {
this.delegate = delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ public void registerClass(Class possible) {
@Override
public void close() {
conf.returnObject(clnames);
clnames = null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public int getWritten() {
@Override
public void close() throws IOException {
conf.returnObject(clnames);
clnames = null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ public void registerClass(Class possible) {
@Override
public void close() {
conf.returnObject(clnames);
clnames = null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ public int getWritten() {
@Override
public void close() throws IOException {
buffout.close();
clnames.clear();
conf.returnObject(clnames);
clnames = null;
}

@Override
Expand Down