<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I just checked the following in trunk. &nbsp;<div><br></div><div>Galder, you may want to do something similar for your JBMAR prototype.<div><br></div><div>The changes are around InternalCacheEntry and now InternalCacheValue.</div><div><br></div><div>Previously, the marshaller stored an InternalCacheEntry as [key, value, canExpire, created, lifespan, lastUsed, maxIdle], setting either of the last 4 elements to -1 if they are unused. &nbsp;In a system mainly comprising of mortal values, this is wasteful since each of the last 2 values - which would be unused - are longs and still written to.</div><div><br></div><div>So this change identifies the InternalCacheEntry and writes just what is needed, hence the use of specific magic numbers for each of the InternalCacheEntry implementations. &nbsp;Using a different magic number for each entry type allows me to trim what is written.</div><div><br></div><div>Same approach used for InternalCacheValue. &nbsp;</div><div><br></div><div>Yes, even more ugly switch statements - and this is why we need JBMAR to clean this up - if and when it can match performance and compactness of the resulting byte array. &nbsp;:-)</div><div><br></div><div>Cheers</div><div>Manik</div><div><br></div><div><br></div><div><div><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>From: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="mailto:infinispan-commits@lists.jboss.org">infinispan-commits@lists.jboss.org</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Date: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">8 May 2009 12:37:23 BST</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>To: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="mailto:infinispan-commits@lists.jboss.org">infinispan-commits@lists.jboss.org</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Subject: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><b>[infinispan-commits] Infinispan SVN: r234 - trunk/core/src/main/java/org/infinispan/marshall.</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Reply-To: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="mailto:infinispan-commits@lists.jboss.org">infinispan-commits@lists.jboss.org</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> </div><div>Author: <a href="mailto:manik.surtani@jboss.com">manik.surtani@jboss.com</a><br>Date: 2009-05-08 07:37:23 -0400 (Fri, 08 May 2009)<br>New Revision: 234<br><br>Modified:<br> &nbsp;&nbsp;trunk/core/src/main/java/org/infinispan/marshall/MarshallerImpl.java<br>Log:<br>Improved marshaller<br><br>Modified: trunk/core/src/main/java/org/infinispan/marshall/MarshallerImpl.java<br>===================================================================<br>--- trunk/core/src/main/java/org/infinispan/marshall/MarshallerImpl.java<span class="Apple-tab-span" style="white-space:pre">        </span>2009-05-08 11:36:59 UTC (rev 233)<br>+++ trunk/core/src/main/java/org/infinispan/marshall/MarshallerImpl.java<span class="Apple-tab-span" style="white-space:pre">        </span>2009-05-08 11:37:23 UTC (rev 234)<br>@@ -26,8 +26,13 @@<br> import org.infinispan.commands.RemoteCommandFactory;<br> import org.infinispan.commands.ReplicableCommand;<br> import org.infinispan.commands.write.WriteCommand;<br>+import org.infinispan.container.entries.ImmortalCacheEntry;<br> import org.infinispan.container.entries.InternalCacheEntry;<br>+import org.infinispan.container.entries.InternalCacheValue;<br> import org.infinispan.container.entries.InternalEntryFactory;<br>+import org.infinispan.container.entries.MortalCacheEntry;<br>+import org.infinispan.container.entries.TransientCacheEntry;<br>+import org.infinispan.container.entries.TransientMortalCacheEntry;<br> import org.infinispan.io.ByteBuffer;<br> import org.infinispan.io.ExposedByteArrayOutputStream;<br> import org.infinispan.remoting.responses.ExceptionResponse;<br>@@ -94,14 +99,23 @@<br> &nbsp;&nbsp;&nbsp;protected static final int MAGICNUMBER_SINGLETON_LIST = 23;<br> &nbsp;&nbsp;&nbsp;protected static final int MAGICNUMBER_COMMAND = 24;<br> &nbsp;&nbsp;&nbsp;protected static final int MAGICNUMBER_TRANSACTION_LOG = 25;<br>- &nbsp;&nbsp;protected static final int MAGICNUMBER_INTERNAL_CACHED_ENTRY = 26;<br><br>+ &nbsp;&nbsp;// --- cache entries and values ---<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICE_IMMORTAL = 26;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICE_MORTAL = 27;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICE_TRANSIENT = 28;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICE_TRANSIENT_MORTAL = 29;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICV_IMMORTAL = 30;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICV_MORTAL = 31;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICV_TRANSIENT = 32;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_ICV_TRANSIENT_MORTAL = 33;<br>+<br> &nbsp;&nbsp;&nbsp;// ---- responses<br>- &nbsp;&nbsp;protected static final int MAGICNUMBER_REQUEST_IGNORED_RESPONSE = 27;<br>- &nbsp;&nbsp;protected static final int MAGICNUMBER_EXTENDED_RESPONSE = 28;<br>- &nbsp;&nbsp;protected static final int MAGICNUMBER_EXCEPTION_RESPONSE = 29;<br>- &nbsp;&nbsp;protected static final int MAGICNUMBER_SUCCESSFUL_RESPONSE = 30;<br>- &nbsp;&nbsp;protected static final int MAGICNUMBER_UNSUCCESSFUL_RESPONSE = 31;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_REQUEST_IGNORED_RESPONSE = 34;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_EXTENDED_RESPONSE = 35;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_EXCEPTION_RESPONSE = 36;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_SUCCESSFUL_RESPONSE = 37;<br>+ &nbsp;&nbsp;protected static final int MAGICNUMBER_UNSUCCESSFUL_RESPONSE = 38;<br><br> &nbsp;&nbsp;&nbsp;protected static final int MAGICNUMBER_NULL = 99;<br> &nbsp;&nbsp;&nbsp;protected static final int MAGICNUMBER_SERIALIZABLE = 100;<br>@@ -173,19 +187,9 @@<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (o instanceof Response) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallResponse((Response) o, out, refMap);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (o instanceof InternalCacheEntry) {<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_INTERNAL_CACHED_ENTRY);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InternalCacheEntry ice = (InternalCacheEntry) o;<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getKey(), out, refMap);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getValue(), out, refMap);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ice.canExpire()) {<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeBoolean(true);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, ice.getCreated());<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(ice.getLifespan()); // could be negative so should not use unsigned longs<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, ice.getLastUsed());<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(ice.getMaxIdle()); // could be negative so should not use unsigned longs<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeBoolean(false);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallInternalCacheEntry((InternalCacheEntry) o, out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (o instanceof InternalCacheValue) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallInternalCacheValue((InternalCacheValue) o, out, refMap);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (o.getClass().equals(ArrayList.class)) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ARRAY_LIST);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallCollection((Collection) o, out, refMap);<br>@@ -252,7 +256,65 @@<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;}<br><br>+ &nbsp;&nbsp;private void marshallInternalCacheEntry(InternalCacheEntry ice, ObjectOutput out, Map&lt;Object, Integer> refMap) throws IOException {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ice.getClass().equals(ImmortalCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICE_IMMORTAL);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getKey(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getValue(), out, refMap);<br><br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (ice.getClass().equals(MortalCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICE_MORTAL);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getKey(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getValue(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, ice.getCreated());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(ice.getLifespan()); // could be negative so should not use unsigned longs<br>+<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (ice.getClass().equals(TransientCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICE_TRANSIENT);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getKey(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getValue(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, ice.getLastUsed());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(ice.getMaxIdle()); // could be negative so should not use unsigned longs<br>+<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (ice.getClass().equals(TransientMortalCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICE_TRANSIENT_MORTAL);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getKey(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(ice.getValue(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, ice.getCreated());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(ice.getLifespan()); // could be negative so should not use unsigned longs<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, ice.getLastUsed());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(ice.getMaxIdle()); // could be negative so should not use unsigned longs<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+ &nbsp;&nbsp;}<br>+<br>+ &nbsp;&nbsp;private void marshallInternalCacheValue(InternalCacheValue icv, ObjectOutput out, Map&lt;Object, Integer> refMap) throws IOException {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (icv.getClass().equals(ImmortalCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICV_IMMORTAL);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(icv.getValue(), out, refMap);<br>+<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (icv.getClass().equals(MortalCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICV_MORTAL);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(icv.getValue(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, icv.getCreated());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(icv.getLifespan()); // could be negative so should not use unsigned longs<br>+<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (icv.getClass().equals(TransientCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICV_TRANSIENT);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(icv.getValue(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, icv.getLastUsed());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(icv.getMaxIdle()); // could be negative so should not use unsigned longs<br>+<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (icv.getClass().equals(TransientMortalCacheEntry.class)) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeByte(MAGICNUMBER_ICV_TRANSIENT_MORTAL);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;marshallObject(icv.getValue(), out, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, icv.getCreated());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(icv.getLifespan()); // could be negative so should not use unsigned longs<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeUnsignedLong(out, icv.getLastUsed());<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeLong(icv.getMaxIdle()); // could be negative so should not use unsigned longs<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+ &nbsp;&nbsp;}<br>+<br>+<br> &nbsp;&nbsp;&nbsp;protected void marshallString(String s, ObjectOutput out) throws IOException {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//StringUtil.saveString(out, s);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.writeObject(s);<br>@@ -385,19 +447,16 @@<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MarshalledValue mv = new MarshalledValue();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv.readExternal(in);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return mv;<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_INTERNAL_CACHED_ENTRY:<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object k = unmarshallObject(in, refMap);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object v = unmarshallObject(in, refMap);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;boolean canExpire = in.readBoolean();<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (canExpire) {<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long created = readUnsignedLong(in);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long lifespan = in.readLong(); // could be negative so should not use unsigned longs<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long lastUsed = readUnsignedLong(in);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long maxIdle = in.readLong(); // could be negative so should not use unsigned longs<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return InternalEntryFactory.create(k, v, created, lifespan, lastUsed, maxIdle);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return InternalEntryFactory.create(k, v);<br>- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_IMMORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_MORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_TRANSIENT:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_TRANSIENT_MORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return unmarshallInternalCacheEntry(magicNumber, in, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICV_IMMORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICV_MORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICV_TRANSIENT:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICV_TRANSIENT_MORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return unmarshallInternalCacheValue(magicNumber, in, refMap);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_REQUEST_IGNORED_RESPONSE:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_EXTENDED_RESPONSE:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_EXCEPTION_RESPONSE:<br>@@ -465,6 +524,49 @@<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new IOException("Unknown magic number " + magicNumber);<br> &nbsp;&nbsp;&nbsp;}<br><br>+ &nbsp;&nbsp;private InternalCacheEntry unmarshallInternalCacheEntry(byte magic, ObjectInput in, UnmarshalledReferences refMap) throws IOException, ClassNotFoundException {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object k = unmarshallObject(in, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object v = unmarshallObject(in, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (magic) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_IMMORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return InternalEntryFactory.create(k, v);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_MORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return InternalEntryFactory.create(k, v,<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readUnsignedLong(in), (Long) unmarshallObject(in, refMap),<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1, -1);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_TRANSIENT:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readUnsignedLong(in), (Long) unmarshallObject(in, refMap),<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readUnsignedLong(in), (Long) unmarshallObject(in, refMap));<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new IllegalArgumentException("Unknown magic number " + magic);<br>+ &nbsp;&nbsp;}<br>+<br>+ &nbsp;&nbsp;private InternalCacheValue unmarshallInternalCacheValue(byte magic, ObjectInput in, UnmarshalledReferences refMap) throws IOException, ClassNotFoundException {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object v = unmarshallObject(in, refMap);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (magic) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_IMMORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return InternalEntryFactory.createValue(v);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case MAGICNUMBER_ICE_MORTAL:<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return Intern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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readUnsignedLong(in), (Long) unmarshallObject(in, refMap));<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new IllegalArgumentException("Unknown magic number " + magic);<br>+ &nbsp;&nbsp;}<br>+<br> &nbsp;&nbsp;&nbsp;private FastCopyHashMap unmarshallFastCopyHashMap(ObjectInput in, UnmarshalledReferences refMap) throws IOException, ClassNotFoundException {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FastCopyHashMap map = new FastCopyHashMap();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;populateFromStream(in, refMap, map);<br><br>_______________________________________________<br>infinispan-commits mailing list<br><a href="mailto:infinispan-commits@lists.jboss.org">infinispan-commits@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-commits<br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div>Lead, Infinispan</div><div>Lead, JBoss Cache</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></div></div></body></html>