You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2010/10/04 16:42:02 UTC
svn commit: r1004263 - in
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util:
BundleReader.java BundleWriter.java
Author: jukka
Date: Mon Oct 4 14:42:02 2010
New Revision: 1004263
URL: http://svn.apache.org/viewvc?rev=1004263&view=rev
Log:
JCR-2762: Optimize bundle serialization
Minor improvements, no changes to serialized bit patterns
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java?rev=1004263&r1=1004262&r2=1004263&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java Mon Oct 4 14:42:02 2010
@@ -126,7 +126,7 @@ class BundleReader {
// read modcount, since version 1.0
if (version >= BundleBinding.VERSION_1) {
- bundle.setModCount(readModCount());
+ bundle.setModCount(in.readShort());
}
// read shared set, since version 2.0
@@ -246,9 +246,9 @@ class BundleReader {
*/
private NodeId readNodeId() throws IOException {
if (in.readBoolean()) {
- byte[] bytes = new byte[16];
- in.readFully(bytes);
- return new NodeId(bytes);
+ long msb = in.readLong();
+ long lsb = in.readLong();
+ return new NodeId(msb, lsb);
} else {
return null;
}
@@ -282,16 +282,6 @@ class BundleReader {
}
/**
- * Deserializes a mod-count
- *
- * @return the mod count
- * @throws IOException in an I/O error occurs.
- */
- private short readModCount() throws IOException {
- return in.readShort();
- }
-
- /**
* Deserializes an indexed Name
*
* @return the qname
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java?rev=1004263&r1=1004262&r2=1004263&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java Mon Oct 4 14:42:02 2010
@@ -117,7 +117,7 @@ class BundleWriter {
writeNodeId(null);
// write mod count
- writeModCount(bundle.getModCount());
+ out.writeShort(bundle.getModCount());
// write shared set
for (NodeId nodeId: bundle.getSharedSet()) {
@@ -322,7 +322,8 @@ class BundleWriter {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
- out.write(id.getRawBytes());
+ out.writeLong(id.getMostSignificantBits());
+ out.writeLong(id.getLeastSignificantBits());
}
}
@@ -343,16 +344,6 @@ class BundleWriter {
}
/**
- * Sersializes a mod-count
- *
- * @param modCount the mod count
- * @throws IOException in an I/O error occurs.
- */
- private void writeModCount(short modCount) throws IOException {
- out.writeShort(modCount);
- }
-
- /**
* Serializes a Name
*
* @param name the name