Created
December 5, 2011 18:34
-
-
Save sritchie/1434696 to your computer and use it in GitHub Desktop.
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
From 59418e2a9797edbb37b45a505ea3dd6dea4abad1 Mon Sep 17 00:00:00 2001 | |
From: Sam Ritchie <sritchie09@gmail.com> | |
Date: Mon, 5 Dec 2011 10:31:57 -0800 | |
Subject: [PATCH] Use array-maps explicitly for serializer collections. | |
This patch converts the {} reader macros on clojure-primitives | |
and java-primitives to use array-map explicitly. I think Clojure | |
uses array-maps by default for small maps; I'm not sure, though, | |
and if {} created a hash-map with different ordering when populating | |
two different instances of kryo, deserialization will fail. | |
--- | |
src/carbonite/serializer.clj | 10 ++++++---- | |
1 files changed, 6 insertions(+), 4 deletions(-) | |
diff --git a/src/carbonite/serializer.clj b/src/carbonite/serializer.clj | |
index 9aa8738..993c397 100644 | |
--- a/src/carbonite/serializer.clj | |
+++ b/src/carbonite/serializer.clj | |
@@ -136,19 +136,21 @@ | |
(def clojure-primitives | |
"Define a map of Clojure primitives and their serializers to install." | |
- {BigInt clojure-reader-serializer | |
+ (array-map | |
+ BigInt clojure-reader-serializer | |
Keyword clojure-reader-serializer | |
- Symbol clojure-reader-serializer}) | |
+ Symbol clojure-reader-serializer)) | |
(def java-primitives | |
- {BigDecimal (BigDecimalSerializer.) | |
+ (array-map | |
+ BigDecimal (BigDecimalSerializer.) | |
BigInteger (BigIntegerSerializer.) | |
Date (DateSerializer.) | |
Timestamp timestamp-serializer | |
java.sql.Date (sqldate-serializer java.sql.Date) | |
java.sql.Time (sqldate-serializer java.sql.Time) | |
URI uri-serializer | |
- UUID uuid-serializer}) | |
+ UUID uuid-serializer)) | |
(defn clojure-collections | |
[registry] | |
-- | |
1.7.4.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment