Serialization optimization for UUID keys. #94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jan,
This is a change from a user who follows my clone of JDBM. I think it looks like a good change; you might want to consider merging it yourself.
Here is the diff ignoring whitespace changes:
diff --git a/src/main/java/org/apache/jdbm/Serialization.java b/src/main/java/org/apache/jdbm/Serialization.java
index b8fccce..0e1d56a 100644
--- a/src/main/java/org/apache/jdbm/Serialization.java
+++ b/src/main/java/org/apache/jdbm/Serialization.java
@@ -263,6 +263,10 @@ public class Serialization extends SerialClassInfo implements Serializer {
out.write(DATE);
out.writeLong(((Date) obj).getTime());
return;
@@ -407,6 +411,12 @@ public class Serialization extends SerialClassInfo implements Serializer {
}
private void serializeUUID(DataOutput out, UUID uuid) throws IOException
{
}
private void serializeMap(int header, DataOutput out, Object obj, FastArrayList objectStack) throws IOException {
Map l = (Map) obj;
out.write(header);
@@ -432,7 +442,6 @@ public class Serialization extends SerialClassInfo implements Serializer {
out.write(b);
}
@@ -824,6 +833,9 @@ public class Serialization extends SerialClassInfo implements Serializer {
case DATE:
ret = new Date(is.readLong());
break;
@@ -1068,6 +1080,11 @@ public class Serialization extends SerialClassInfo implements Serializer {
return ret;
}
private UUID deserializeUUID(DataInput is) throws IOException
{
}
private int[] deserializeArrayIntB255(DataInput is) throws IOException {
int size = is.readUnsignedByte();
if (size < 0)
diff --git a/src/main/java/org/apache/jdbm/SerializationHeader.java b/src/main/java/org/apache/jdbm/SerializationHeader.java
index e3ec45c..8e86836 100644
--- a/src/main/java/org/apache/jdbm/SerializationHeader.java
+++ b/src/main/java/org/apache/jdbm/SerializationHeader.java
@@ -120,6 +120,7 @@ final class SerializationHeader {
final static int CLASS = 126;
final static int DATE = 127;
static final int JDBMLINKEDLIST = 159;
diff --git a/src/test/java/org/apache/jdbm/SerializationTest.java b/src/test/java/org/apache/jdbm/SerializationTest.java
index c61f743..57a58e7 100644
--- a/src/test/java/org/apache/jdbm/SerializationTest.java
+++ b/src/test/java/org/apache/jdbm/SerializationTest.java
@@ -399,6 +399,18 @@ public class SerializationTest extends TestCase {
assertEquals(d, ser.deserialize(ser.serialize(d)));
}
public void testLocale() throws Exception{
assertEquals(Locale.FRANCE, ser.deserialize(ser.serialize(Locale.FRANCE)));