I suggest you isolate this using *no* JDBCCacheLoader, just simple VAM
(if it provides access methods for testing). This way, we can catch
performance regressions for the VAM. It would be a good idea (if this
hasn't already been done) to write some unit tests that compare VAM to
plain serialization and fail if the diff is more than N percent (I do
this in JGroups).
Galder Zamarreno wrote:
Hi,
I've been doing some performance tests for JDBCCacheLoader with both normal Java
Serialization and VersionAwareMarshaller, using the existing JDBCCacheLoaderPerfTest.
The results I got back were quite suprising. Executing a test consisting of 10 threads
(each thread interacts with a single node) and each thread adds 100 key/value pairs to
their node. Tests showed that normal serialization was something like 15 times faster than
VAM when it came to writes. For reads, normal serialization was still 4 times faster.
We're talking about String/String key value pairs here.
Looking a bit deeper with the profiler, I have seen that TreeCacheMarshaller200 takes
ages marshalling a map containing string key/value pairs. Is this expected? We're
adding quite a few things to a simple String/String map, such as versioning and reference
information. Compared to standard writeObject in HashMap, TreeCacheMarshaller200 spends
quite a bit of time mantaining/updating a reference map.
In this case, for a single put, each key and value values are different (key0/value0
key1/value1 key2/value2...), maintaining references becomes an extra overhead as the
reference maps are created for each request to marshall the original map. However, I can
see the point why it was done (avoid extra serialization and reduce the amount of data in
the wire).
I had a quick thought about caching reference data so that it survived several requests
to marshal data, but it's probably a bad idea as this cache would become a contention
for concurrent marshalling and increase the memory requirements. Has anyone been this
route before? I think it might only produce positive results in such specific test as
this.
I tried JBoss serialization and the results were even worse. What type of Objects is JB
serialization recommended for? Is it user defined ones?
I have attached JProfiler files from all three tests and also a CVS diff in case anyone
wants to have a quick glance. Note that even though there's 1000 calls to marshallMap,
as threads add new key/value pairs, the data read-to-be-updated increases and hence the
number of items to iterate through in the map.
FYI, useRegionBasedMarshalling is set to false.
Galder ZamarreƱo
Sr. Software Maintenance Engineer
JBoss, a division of Red Hat
IT executives: Red Hat still #1 for value
http://www.redhat.com/promo/vendor/
------------------------------------------------------------------------
cvs diff -u (in directory C:\jboss\jira\JBCACHE-879\head\)
? classes
? derby.log
cvs diff: Diffing .
cvs diff: Diffing .settings
cvs diff: Diffing ant-dist
cvs diff: Diffing ant-dist/bin
cvs diff: Diffing ant-dist/lib
cvs diff: Diffing docs
Index: docs/JBossORG-EULA.txt
===================================================================
RCS file: /cvsroot/jboss/JBossCache/docs/JBossORG-EULA.txt,v
retrieving revision 1.2
diff -u -r1.2 JBossORG-EULA.txt
--- docs/JBossORG-EULA.txt 2 Nov 2006 09:09:40 -0000 1.2
+++ docs/JBossORG-EULA.txt 2 Nov 2006 09:09:40 -0000
@@ -1,107 +1,107 @@
-LICENSE AGREEMENT
-JBOSS(r)
-
-This License Agreement governs the use of the Software Packages and any updates to the
Software
-Packages, regardless of the delivery mechanism. Each Software Package is a collective
work
-under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red
Hat") grants to
-the user ("Client") a license to the applicable collective work(s) pursuant to
the
-GNU Lesser General Public License v. 2.1 except for the following Software Packages:
-(a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant
to the
-GNU General Public License v.2;
-
-(b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0;
-
-(c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is
licensed under the
-(open source) Sleepycat License (if Client does not wish to use the open source version
of this database,
-it may purchase a license from Sleepycat Software);
-
-and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public
License v.1,
-and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to
enter various
-royalty-free patent licenses.
-
-Each of the foregoing licenses is available at
http://www.opensource.org/licenses/index.php.
-
-1. The Software. "Software Packages" refer to the various software modules
that are created and made available
-for distribution by the
JBoss.org open source community at
http://www.jboss.org. Each
of the Software Packages
-may be comprised of hundreds of software components. The end user license agreement for
each component is located in
-the component's source code. With the exception of certain image files identified
in Section 2 below,
-the license terms for the components permit Client to copy, modify, and redistribute the
component,
-in both source code and binary code forms. This agreement does not limit Client's
rights under,
-or grant Client rights that supersede, the license terms of any particular component.
-
-2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others
and are protected under copyright
-and other laws. Title to the Software Packages and any component, or to any copy,
modification, or merged portion shall
-remain with the aforementioned, subject to the applicable license. The
"JBoss" trademark, "Red Hat" trademark, the
-individual Software Package trademarks, and the "Shadowman" logo are
registered trademarks of Red Hat and its affiliates
-in the U.S. and other countries. This agreement permits Client to distribute unmodified
copies of the Software Packages
-using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the
condition that Client follows Red Hat's
-trademark guidelines for those trademarks located at
http://www.redhat.com/about/corporate/trademark/. Client must abide by
-these trademark guidelines when distributing the Software Packages, regardless of
whether the Software Packages have been modified.
-If Client modifies the Software Packages, then Client must replace all Red Hat
trademarks and logos identified at
-http://www.jboss.com/company/logos, unless a separate agreement with Red Hat is executed
or other permission granted.
-Merely deleting the files containing the Red Hat trademarks may corrupt the Software
Packages.
-
-3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license
for a particular
-component, to the maximum extent permitted under applicable law, the Software Packages
and the
-components are provided and licensed "as is" without warranty of any kind,
expressed or implied,
-including the implied warranties of merchantability, non-infringement or fitness for a
particular purpose.
-Red Hat warrants that the media on which Software Packages may be furnished will be free
from defects in
-materials and manufacture under normal use for a period of 30 days from the date of
delivery to Client.
-Red Hat does not warrant that the functions contained in the Software Packages will meet
Client's requirements
-or that the operation of the Software Packages will be entirely error free or appear
precisely as described
-in the accompanying documentation. This warranty extends only to the party that
purchases the Services
-pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor.
-
-4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable
law, the remedies
-described below are accepted by Client as its only remedies. Red Hat's entire
liability, and Client's
-exclusive remedies, shall be: If the Software media is defective, Client may return it
within 30 days of
-delivery along with a copy of Client's payment receipt and Red Hat, at its option,
will replace it or
-refund the money paid by Client for the Software. To the maximum extent permitted by
applicable law,
-Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental
or consequential
-damages, including lost profits or lost savings arising out of the use or inability to
use the Software,
-even if Red Hat or such dealer has been advised of the possibility of such damages. In
no event shall
-Red Hat's liability under this agreement exceed the amount that Client paid to Red
Hat under this
-Agreement during the twelve months preceding the action.
-
-5. Export Control. As required by U.S. law, Client represents and warrants that it:
-(a) understands that the Software Packages are subject to export controls under the
-U.S. Commerce Department's Export Administration Regulations ("EAR");
-
-(b) is not located in a prohibited destination country under the EAR or U.S. sanctions
regulations
-(currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria);
-
-(c) will not export, re-export, or transfer the Software Packages to any prohibited
destination, entity,
-or individual without the necessary export license(s) or authorizations(s) from the U.S.
Government;
-
-(d) will not use or transfer the Software Packages for use in any sensitive nuclear,
chemical or
-biological weapons, or missile technology end-uses unless authorized by the U.S.
Government by
-regulation or specific license;
-
-(e) understands and agrees that if it is in the United States and exports or transfers
the Software
-Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit
semi-annual
-reports to the Commerce Department's Bureau of Industry & Security (BIS), which
include the name and
-address (including country) of each transferee;
-
-and (f) understands that countries other than the United States may restrict the import,
use, or
-export of encryption products and that it shall be solely responsible for compliance
with any such
-import, use, or export restrictions.
-
-6. Third Party Programs. Red Hat may distribute third party software programs with the
Software Packages
-that are not part of the Software Packages and which Client must install separately.
These third party
-programs are subject to their own license terms. The license terms either accompany the
programs or
-can be viewed at
http://www.redhat.com/licenses/. If Client does not agree to abide by
the applicable
-license terms for such programs, then Client may not install them. If Client wishes to
install the programs
-on more than one system or transfer the programs to another party, then Client must
contact the licensor
-of the programs.
-
-7. General. If any provision of this agreement is held to be unenforceable, that shall
not affect the
-enforceability of the remaining provisions. This License Agreement shall be governed by
the laws of the
-State of North Carolina and of the United States, without regard to any conflict of laws
provisions,
-except that the United Nations Convention on the International Sale of Goods shall not
apply.
-
-Copyright 2006 Red Hat, Inc. All rights reserved.
-"JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc.
-All other trademarks are the property of their respective owners.
-
- Page 1 of 1 18 October 2006
-
+LICENSE AGREEMENT
+JBOSS(r)
+
+This License Agreement governs the use of the Software Packages and any updates to the
Software
+Packages, regardless of the delivery mechanism. Each Software Package is a collective
work
+under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red
Hat") grants to
+the user ("Client") a license to the applicable collective work(s) pursuant to
the
+GNU Lesser General Public License v. 2.1 except for the following Software Packages:
+(a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant
to the
+GNU General Public License v.2;
+
+(b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0;
+
+(c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is
licensed under the
+(open source) Sleepycat License (if Client does not wish to use the open source version
of this database,
+it may purchase a license from Sleepycat Software);
+
+and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public
License v.1,
+and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to
enter various
+royalty-free patent licenses.
+
+Each of the foregoing licenses is available at
http://www.opensource.org/licenses/index.php.
+
+1. The Software. "Software Packages" refer to the various software modules
that are created and made available
+for distribution by the
JBoss.org open source community at
http://www.jboss.org. Each
of the Software Packages
+may be comprised of hundreds of software components. The end user license agreement for
each component is located in
+the component's source code. With the exception of certain image files identified
in Section 2 below,
+the license terms for the components permit Client to copy, modify, and redistribute the
component,
+in both source code and binary code forms. This agreement does not limit Client's
rights under,
+or grant Client rights that supersede, the license terms of any particular component.
+
+2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others
and are protected under copyright
+and other laws. Title to the Software Packages and any component, or to any copy,
modification, or merged portion shall
+remain with the aforementioned, subject to the applicable license. The
"JBoss" trademark, "Red Hat" trademark, the
+individual Software Package trademarks, and the "Shadowman" logo are
registered trademarks of Red Hat and its affiliates
+in the U.S. and other countries. This agreement permits Client to distribute unmodified
copies of the Software Packages
+using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the
condition that Client follows Red Hat's
+trademark guidelines for those trademarks located at
http://www.redhat.com/about/corporate/trademark/. Client must abide by
+these trademark guidelines when distributing the Software Packages, regardless of
whether the Software Packages have been modified.
+If Client modifies the Software Packages, then Client must replace all Red Hat
trademarks and logos identified at
+http://www.jboss.com/company/logos, unless a separate agreement with Red Hat is executed
or other permission granted.
+Merely deleting the files containing the Red Hat trademarks may corrupt the Software
Packages.
+
+3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license
for a particular
+component, to the maximum extent permitted under applicable law, the Software Packages
and the
+components are provided and licensed "as is" without warranty of any kind,
expressed or implied,
+including the implied warranties of merchantability, non-infringement or fitness for a
particular purpose.
+Red Hat warrants that the media on which Software Packages may be furnished will be free
from defects in
+materials and manufacture under normal use for a period of 30 days from the date of
delivery to Client.
+Red Hat does not warrant that the functions contained in the Software Packages will meet
Client's requirements
+or that the operation of the Software Packages will be entirely error free or appear
precisely as described
+in the accompanying documentation. This warranty extends only to the party that
purchases the Services
+pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor.
+
+4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable
law, the remedies
+described below are accepted by Client as its only remedies. Red Hat's entire
liability, and Client's
+exclusive remedies, shall be: If the Software media is defective, Client may return it
within 30 days of
+delivery along with a copy of Client's payment receipt and Red Hat, at its option,
will replace it or
+refund the money paid by Client for the Software. To the maximum extent permitted by
applicable law,
+Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental
or consequential
+damages, including lost profits or lost savings arising out of the use or inability to
use the Software,
+even if Red Hat or such dealer has been advised of the possibility of such damages. In
no event shall
+Red Hat's liability under this agreement exceed the amount that Client paid to Red
Hat under this
+Agreement during the twelve months preceding the action.
+
+5. Export Control. As required by U.S. law, Client represents and warrants that it:
+(a) understands that the Software Packages are subject to export controls under the
+U.S. Commerce Department's Export Administration Regulations ("EAR");
+
+(b) is not located in a prohibited destination country under the EAR or U.S. sanctions
regulations
+(currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria);
+
+(c) will not export, re-export, or transfer the Software Packages to any prohibited
destination, entity,
+or individual without the necessary export license(s) or authorizations(s) from the U.S.
Government;
+
+(d) will not use or transfer the Software Packages for use in any sensitive nuclear,
chemical or
+biological weapons, or missile technology end-uses unless authorized by the U.S.
Government by
+regulation or specific license;
+
+(e) understands and agrees that if it is in the United States and exports or transfers
the Software
+Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit
semi-annual
+reports to the Commerce Department's Bureau of Industry & Security (BIS), which
include the name and
+address (including country) of each transferee;
+
+and (f) understands that countries other than the United States may restrict the import,
use, or
+export of encryption products and that it shall be solely responsible for compliance
with any such
+import, use, or export restrictions.
+
+6. Third Party Programs. Red Hat may distribute third party software programs with the
Software Packages
+that are not part of the Software Packages and which Client must install separately.
These third party
+programs are subject to their own license terms. The license terms either accompany the
programs or
+can be viewed at
http://www.redhat.com/licenses/. If Client does not agree to abide by
the applicable
+license terms for such programs, then Client may not install them. If Client wishes to
install the programs
+on more than one system or transfer the programs to another party, then Client must
contact the licensor
+of the programs.
+
+7. General. If any provision of this agreement is held to be unenforceable, that shall
not affect the
+enforceability of the remaining provisions. This License Agreement shall be governed by
the laws of the
+State of North Carolina and of the United States, without regard to any conflict of laws
provisions,
+except that the United Nations Convention on the International Sale of Goods shall not
apply.
+
+Copyright 2006 Red Hat, Inc. All rights reserved.
+"JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc.
+All other trademarks are the property of their respective owners.
+
+ Page 1 of 1 18 October 2006
+
cvs diff: Diffing docs/PojoCache
cvs diff: Diffing docs/PojoCache/en
cvs diff: Diffing docs/PojoCache/en/images
cvs diff: Diffing docs/PojoCache/en/modules
cvs diff: Diffing docs/TreeCache
cvs diff: Diffing docs/TreeCache/en
cvs diff: Diffing docs/TreeCache/en/images
cvs diff: Diffing docs/TreeCache/en/modules
cvs diff: Diffing docs/design
cvs diff: Diffing docs/faq
cvs diff: Diffing docs/faq/en
cvs diff: Diffing docs/faq/en/images
cvs diff: Diffing docs/faq-pojo
cvs diff: Diffing docs/faq-pojo/en
cvs diff: Diffing docs/faq-pojo/en/images
cvs diff: Diffing docs/images
cvs diff: Diffing docs/index
cvs diff: Diffing docs/index/en
cvs diff: Diffing docs/index/en/images
cvs diff: Diffing docs/tutorial
cvs diff: Diffing docs/tutorial/en
cvs diff: Diffing docs/tutorial/en/images
cvs diff: Diffing docs/tutorial-pojo
cvs diff: Diffing docs/tutorial-pojo/en
cvs diff: Diffing docs/tutorial-pojo/en/images
cvs diff: Diffing etc
cvs diff: Diffing etc/META-INF
cvs diff: Diffing examples
cvs diff: Diffing examples/PojoCache
cvs diff: Diffing examples/PojoCache/annotated50
cvs diff: Diffing examples/PojoCache/annotated50/src
cvs diff: Diffing examples/PojoCache/annotated50/src/examples
cvs diff: Diffing examples/PojoCache/annotated50/src/test
cvs diff: Diffing examples/PojoCache/annotated50/src/test/examples
cvs diff: Diffing examples/PojoCache/loadtime
cvs diff: Diffing examples/PojoCache/loadtime/src
cvs diff: Diffing examples/PojoCache/loadtime/src/examples
cvs diff: Diffing examples/PojoCache/loadtime/src/test
cvs diff: Diffing examples/PojoCache/loadtime/src/test/examples
cvs diff: Diffing examples/PojoCache/non-annotated
cvs diff: Diffing examples/PojoCache/non-annotated/src
cvs diff: Diffing examples/PojoCache/non-annotated/src/examples
cvs diff: Diffing examples/PojoCache/non-annotated/src/test
cvs diff: Diffing examples/PojoCache/non-annotated/src/test/examples
cvs diff: Diffing examples/PojoCache/passivation
cvs diff: Diffing examples/PojoCache/passivation/src
cvs diff: Diffing examples/PojoCache/passivation/src/examples
cvs diff: Diffing examples/PojoCache/passivation/src/test
cvs diff: Diffing examples/PojoCache/passivation/src/test/examples
cvs diff: Diffing examples/PojoCache/sensor
cvs diff: Diffing examples/PojoCache/sensor/article
cvs diff: Diffing examples/PojoCache/sensor/article/image
cvs diff: Diffing examples/PojoCache/sensor/src
cvs diff: Diffing examples/PojoCache/sensor/src/propagation
cvs diff: Diffing examples/PojoCache/sensor/src/propagation/impl
cvs diff: Diffing examples/PojoCache/sensor/src/test
cvs diff: Diffing examples/PojoCache/sensor/src/test/propagation
cvs diff: Diffing examples/PojoCache/sensor/src/test/propagation/impl
cvs diff: Diffing lib
cvs diff: Diffing lib/berkeleydb
cvs diff: Diffing lib/licenses
cvs diff: Diffing lib/retro
cvs diff: Diffing old
cvs diff: Diffing old/src
cvs diff: Diffing old/src/org
cvs diff: Diffing old/src/org/jboss
cvs diff: Diffing old/src/org/jboss/cache
cvs diff: Diffing old/src/org/jboss/cache/aop
cvs diff: Diffing old/src/org/jboss/cache/aop/annotation
cvs diff: Diffing old/src/org/jboss/cache/aop/collection
cvs diff: Diffing old/src/org/jboss/cache/aop/eviction
cvs diff: Diffing old/src/org/jboss/cache/aop/interceptors
cvs diff: Diffing old/src/org/jboss/cache/aop/references
cvs diff: Diffing old/src/org/jboss/cache/aop/statetransfer
cvs diff: Diffing old/src/org/jboss/cache/aop/util
cvs diff: Diffing old/src-50
cvs diff: Diffing old/src-50/org
cvs diff: Diffing old/src-50/org/jboss
cvs diff: Diffing old/src-50/org/jboss/cache
cvs diff: Diffing old/src-50/org/jboss/cache/aop
cvs diff: Diffing old/src-50/org/jboss/cache/aop/annotation
cvs diff: Diffing old/tests
cvs diff: Diffing old/tests/functional
cvs diff: Diffing old/tests/functional/org
cvs diff: Diffing old/tests/functional/org/jboss
cvs diff: Diffing old/tests/functional/org/jboss/cache
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/collection
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/eviction
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/integrated
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/loader
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/memory
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/statetransfer
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/test
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/test/propagation
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/test/propagation/impl
cvs diff: Diffing old/tests/functional/org/jboss/cache/aop/util
cvs diff: Diffing old/tests/perf
cvs diff: Diffing old/tests/perf/org
cvs diff: Diffing old/tests/perf/org/jboss
cvs diff: Diffing old/tests/perf/org/jboss/cache
cvs diff: Diffing old/tests/perf/org/jboss/cache/aop
cvs diff: Diffing old/tests-50
cvs diff: Diffing old/tests-50/org
cvs diff: Diffing old/tests-50/org/jboss
cvs diff: Diffing old/tests-50/org/jboss/cache
cvs diff: Diffing old/tests-50/org/jboss/cache/aop
cvs diff: Diffing old/tests-50/org/jboss/cache/aop/test
cvs diff: Diffing old/tests-50/org/jboss/cache/aop/test/propagation
cvs diff: Diffing old/tests-50/org/jboss/cache/aop/test/propagation/impl
cvs diff: Diffing src
cvs diff: Diffing src/org
cvs diff: Diffing src/org/jboss
cvs diff: Diffing src/org/jboss/cache
cvs diff: Diffing src/org/jboss/cache/buddyreplication
cvs diff: Diffing src/org/jboss/cache/config
cvs diff: Diffing src/org/jboss/cache/eviction
cvs diff: Diffing src/org/jboss/cache/factories
cvs diff: Diffing src/org/jboss/cache/interceptors
cvs diff: Diffing src/org/jboss/cache/jmx
cvs diff: Diffing src/org/jboss/cache/loader
Index: src/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java,v
retrieving revision 1.12
diff -u -r1.12 AbstractCacheLoader.java
--- src/org/jboss/cache/loader/AbstractCacheLoader.java 20 Nov 2006 07:33:14 -0000 1.12
+++ src/org/jboss/cache/loader/AbstractCacheLoader.java 1 Dec 2006 16:16:12 -0000
@@ -11,6 +11,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
+import org.jboss.cache.marshall.VersionAwareMarshaller;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.util.MapCopy;
@@ -241,4 +242,8 @@
}
}
+ protected VersionAwareMarshaller getMarshaller()
+ {
+ return cache.getMarshaller();
+ }
}
Index: src/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/JDBCCacheLoader.java,v
retrieving revision 1.25
diff -u -r1.25 JDBCCacheLoader.java
--- src/org/jboss/cache/loader/JDBCCacheLoader.java 20 Dec 2006 02:16:24 -0000 1.25
+++ src/org/jboss/cache/loader/JDBCCacheLoader.java 25 Dec 2006 17:28:50 -0000
@@ -677,14 +677,15 @@
if (node != null)
{
// Object marshalledNode = new MarshalledValue(node);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
+// ByteArrayOutputStream baos = new ByteArrayOutputStream();
+// ObjectOutputStream oos = new ObjectOutputStream(baos);
// oos.writeObject(marshalledNode);
//
- oos.writeObject(node);
+// oos.writeObject(node);
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- ps.setBinaryStream(2, bais, baos.size());
+ byte[] byteStream = getMarshaller().objectToByteBuffer(node);
+ ByteArrayInputStream bais = new ByteArrayInputStream(byteStream);
+ ps.setBinaryStream(2, bais, byteStream.length);
}
else
{
@@ -762,13 +763,14 @@
// else
// {
// Object marshalledNode = new MarshalledValue(node);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
+// ByteArrayOutputStream baos = new ByteArrayOutputStream();
+// ObjectOutputStream oos = new ObjectOutputStream(baos);
// oos.writeObject(marshalledNode);
- oos.writeObject(node);
+// oos.writeObject(node);
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- ps.setBinaryStream(1, bais, baos.size());
+ byte[] byteStream = getMarshaller().objectToByteBuffer(node);
+ ByteArrayInputStream bais = new ByteArrayInputStream(byteStream);
+ ps.setBinaryStream(1, bais, byteStream.length);
// }
ps.setString(2, name.toString());
@@ -825,12 +827,14 @@
InputStream is = rs.getBinaryStream(1);
if (is != null && !rs.wasNull())
{
- ObjectInputStream ois = null;
+// ObjectInputStream ois = null;
try
{
// deserialize result
- ois = new ObjectInputStream(is);
- Object marshalledNode = ois.readObject();
+// ois = new ObjectInputStream(is);
+// Object marshalledNode = ois.readObject();
+
+ Object marshalledNode = getMarshaller().objectFromInputStream(is);
// de-marshall value if possible
// if (marshalledNode instanceof MarshalledValue)
@@ -851,9 +855,13 @@
{
throw new SQLException("Unable to load to deserialize result:
" + e);
}
+ catch (Exception e)
+ {
+ throw new SQLException("Unable to load to deserialize result:
" + e);
+ }
finally
{
- safeClose(ois);
+ safeClose(is);
}
}
}
cvs diff: Diffing src/org/jboss/cache/loader/bdbje
cvs diff: Diffing src/org/jboss/cache/loader/jdbm
cvs diff: Diffing src/org/jboss/cache/loader/rmi
cvs diff: Diffing src/org/jboss/cache/loader/tcp
cvs diff: Diffing src/org/jboss/cache/lock
Index: src/org/jboss/cache/lock/NullLock.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/lock/NullLock.java,v
retrieving revision 1.1
diff -u -r1.1 NullLock.java
--- src/org/jboss/cache/lock/NullLock.java 8 Dec 2006 18:50:49 -0000 1.1
+++ src/org/jboss/cache/lock/NullLock.java 8 Dec 2006 18:50:49 -0000
@@ -1,67 +1,67 @@
-package org.jboss.cache.lock;
-
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-
-class NullLock implements Lock, Condition {
-
- public void lock()
- {
- }
-
- public void lockInterruptibly() throws InterruptedException
- {
- }
-
- public Condition newCondition()
- {
- return this;
- }
-
- public boolean tryLock()
- {
- return true;
- }
-
- public boolean tryLock(long arg0, TimeUnit arg1) throws InterruptedException
- {
- return true;
- }
-
- public void unlock()
- {
- }
-
- public void await() throws InterruptedException
- {
- }
-
- public boolean await(long arg0, TimeUnit arg1) throws InterruptedException
- {
- return true;
- }
-
- public long awaitNanos(long arg0) throws InterruptedException
- {
- return arg0;
- }
-
- public void awaitUninterruptibly()
- {
- }
-
- public boolean awaitUntil(Date arg0) throws InterruptedException
- {
- return true;
- }
-
- public void signal()
- {
- }
-
- public void signalAll()
- {
- }
-}
+package org.jboss.cache.lock;
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+
+class NullLock implements Lock, Condition {
+
+ public void lock()
+ {
+ }
+
+ public void lockInterruptibly() throws InterruptedException
+ {
+ }
+
+ public Condition newCondition()
+ {
+ return this;
+ }
+
+ public boolean tryLock()
+ {
+ return true;
+ }
+
+ public boolean tryLock(long arg0, TimeUnit arg1) throws InterruptedException
+ {
+ return true;
+ }
+
+ public void unlock()
+ {
+ }
+
+ public void await() throws InterruptedException
+ {
+ }
+
+ public boolean await(long arg0, TimeUnit arg1) throws InterruptedException
+ {
+ return true;
+ }
+
+ public long awaitNanos(long arg0) throws InterruptedException
+ {
+ return arg0;
+ }
+
+ public void awaitUninterruptibly()
+ {
+ }
+
+ public boolean awaitUntil(Date arg0) throws InterruptedException
+ {
+ return true;
+ }
+
+ public void signal()
+ {
+ }
+
+ public void signalAll()
+ {
+ }
+}
cvs diff: Diffing src/org/jboss/cache/marshall
Index: src/org/jboss/cache/marshall/JBossObjectStreamFactory.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/JBossObjectStreamFactory.java,v
retrieving revision 1.2
diff -u -r1.2 JBossObjectStreamFactory.java
--- src/org/jboss/cache/marshall/JBossObjectStreamFactory.java 2 Nov 2006 09:42:09
-0000 1.2
+++ src/org/jboss/cache/marshall/JBossObjectStreamFactory.java 1 Dec 2006 17:32:52 -0000
@@ -47,6 +47,11 @@
return new JBossObjectInputStreamOverride(in);
}
+ public ObjectInputStream createObjectInputStream(InputStream in) throws IOException
+ {
+ return new JBossObjectInputStreamOverride(in);
+ }
+
public ObjectOutputStream createObjectOutputStream(OutputStream out) throws
IOException
{
return new JBossObjectOutputStreamSharedTree(out);
Index: src/org/jboss/cache/marshall/JavaObjectStreamFactory.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/JavaObjectStreamFactory.java,v
retrieving revision 1.2
diff -u -r1.2 JavaObjectStreamFactory.java
--- src/org/jboss/cache/marshall/JavaObjectStreamFactory.java 2 Nov 2006 09:42:09
-0000 1.2
+++ src/org/jboss/cache/marshall/JavaObjectStreamFactory.java 1 Dec 2006 17:31:57 -0000
@@ -7,6 +7,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+import java.io.InputStream;
/**
* @author Clebert Suconic
@@ -21,6 +22,11 @@
return new MarshalledValueInputStream(in);
}
+ public ObjectInputStream createObjectInputStream(InputStream in) throws IOException
+ {
+ return new MarshalledValueInputStream(in);
+ }
+
public ObjectOutputStream createObjectOutputStream(OutputStream out) throws
IOException
{
return new ObjectOutputStream(out);
Index: src/org/jboss/cache/marshall/ObjectSerializationFactory.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/ObjectSerializationFactory.java,v
retrieving revision 1.18
diff -u -r1.18 ObjectSerializationFactory.java
--- src/org/jboss/cache/marshall/ObjectSerializationFactory.java 2 Nov 2006 09:42:09
-0000 1.18
+++ src/org/jboss/cache/marshall/ObjectSerializationFactory.java 1 Dec 2006 17:33:34
-0000
@@ -13,6 +13,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+import java.io.InputStream;
/**
* Factory class for creating object output and inut streams, switching between JDK
defaults and JBoss Serialization classes.
@@ -56,6 +57,11 @@
return factory.createObjectInputStream(bytes);
}
+ public static ObjectInputStream createObjectInputStream(InputStream in) throws
IOException
+ {
+ return factory.createObjectInputStream(in);
+ }
+
public static boolean useJBossSerialization()
{
return useJBossSerialization;
Index: src/org/jboss/cache/marshall/ObjectStreamFactory.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/ObjectStreamFactory.java,v
retrieving revision 1.2
diff -u -r1.2 ObjectStreamFactory.java
--- src/org/jboss/cache/marshall/ObjectStreamFactory.java 2 Nov 2006 09:42:09 -0000 1.2
+++ src/org/jboss/cache/marshall/ObjectStreamFactory.java 1 Dec 2006 17:31:24 -0000
@@ -4,6 +4,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+import java.io.InputStream;
/**
* @author Clebert Suconic
@@ -14,4 +15,6 @@
public ObjectOutputStream createObjectOutputStream(OutputStream out) throws
IOException;
public ObjectInputStream createObjectInputStream(byte[] bytes) throws IOException;
+
+ public ObjectInputStream createObjectInputStream(InputStream in) throws IOException;
}
Index: src/org/jboss/cache/marshall/TreeCacheMarshaller200.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/TreeCacheMarshaller200.java,v
retrieving revision 1.10
diff -u -r1.10 TreeCacheMarshaller200.java
--- src/org/jboss/cache/marshall/TreeCacheMarshaller200.java 16 Nov 2006 17:11:46
-0000 1.10
+++ src/org/jboss/cache/marshall/TreeCacheMarshaller200.java 25 Dec 2006 11:56:20 -0000
@@ -492,7 +492,7 @@
private Map unmarshallMap(ObjectInputStream in, Map refMap) throws Exception
{
int mapSize = in.readInt();
- if (mapSize == 0) return Collections.emptyMap();
+ // if (mapSize == 0) return Collections.emptyMap();
Map map = new HashMap(mapSize);
for (int i = 0; i < mapSize; i++)
{
Index: src/org/jboss/cache/marshall/VersionAwareMarshaller.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/VersionAwareMarshaller.java,v
retrieving revision 1.11
diff -u -r1.11 VersionAwareMarshaller.java
--- src/org/jboss/cache/marshall/VersionAwareMarshaller.java 27 Nov 2006 17:07:06
-0000 1.11
+++ src/org/jboss/cache/marshall/VersionAwareMarshaller.java 1 Dec 2006 17:35:19 -0000
@@ -14,6 +14,7 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
@@ -162,6 +163,29 @@
return marshaller.objectFromStream(in);
}
+ public Object objectFromInputStream(InputStream is) throws Exception
+ {
+ Marshaller marshaller;
+ int versionId;
+ ObjectInputStream in;
+ try
+ {
+ // just a peek - does not actually "remove" these bytes from the
stream.
+ // create an input stream and read the first short
+ in = ObjectSerializationFactory.createObjectInputStream(is);
+ versionId = in.readShort();
+ }
+ catch (Exception e)
+ {
+ log.error("Unable to read version id from first two bytes of stream,
barfing.");
+ throw e;
+ }
+
+ marshaller = getMarshaller(versionId);
+
+ return marshaller.objectFromStream(in);
+ }
+
/**
* Lazily instantiates and loads the relevant marshaller for a given version.
*
cvs diff: Diffing src/org/jboss/cache/notifications
cvs diff: Diffing src/org/jboss/cache/optimistic
cvs diff: Diffing src/org/jboss/cache/rpc
cvs diff: Diffing src/org/jboss/cache/statetransfer
cvs diff: Diffing src/org/jboss/cache/transaction
cvs diff: Diffing src/org/jboss/cache/util
cvs diff: Diffing src/org/jboss/cache/xml
cvs diff: Diffing src-50
cvs diff: Diffing src-50/org
cvs diff: Diffing src-50/org/jboss
cvs diff: Diffing src-50/org/jboss/cache
cvs diff: Diffing src-50/org/jboss/cache/pojo
cvs diff: Diffing src-50/org/jboss/cache/pojo/annotation
cvs diff: Diffing src-50/org/jboss/cache/pojo/collection
Index: src-50/org/jboss/cache/pojo/collection/IntegerCache.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/IntegerCache.java,v
retrieving revision 1.1
diff -u -r1.1 IntegerCache.java
--- src-50/org/jboss/cache/pojo/collection/IntegerCache.java 6 Nov 2006 23:32:16
-0000 1.1
+++ src-50/org/jboss/cache/pojo/collection/IntegerCache.java 6 Nov 2006 23:32:16 -0000
@@ -1,24 +1,24 @@
-package org.jboss.cache.pojo.collection;
-
-/**
- * Cache of integers in String format from 0-99.
- */
-public class IntegerCache
-{
-
- private IntegerCache() {}
- private static final String values[] = new String[100];
- static
- {
- for (int i = 0; i < values.length; i++)
- values[i] = Integer.toString(i).intern();
- }
-
- public static String toString(int i)
- {
- if (i >= 0 && i < values.length)
- return values[i];
- return Integer.toString(i);
- }
-
-}
+package org.jboss.cache.pojo.collection;
+
+/**
+ * Cache of integers in String format from 0-99.
+ */
+public class IntegerCache
+{
+
+ private IntegerCache() {}
+ private static final String values[] = new String[100];
+ static
+ {
+ for (int i = 0; i < values.length; i++)
+ values[i] = Integer.toString(i).intern();
+ }
+
+ public static String toString(int i)
+ {
+ if (i >= 0 && i < values.length)
+ return values[i];
+ return Integer.toString(i);
+ }
+
+}
cvs diff: Diffing src-50/org/jboss/cache/pojo/eviction
cvs diff: Diffing src-50/org/jboss/cache/pojo/factory
cvs diff: Diffing src-50/org/jboss/cache/pojo/impl
cvs diff: Diffing src-50/org/jboss/cache/pojo/interceptors
cvs diff: Diffing src-50/org/jboss/cache/pojo/interceptors/dynamic
cvs diff: Diffing src-50/org/jboss/cache/pojo/jmx
cvs diff: Diffing src-50/org/jboss/cache/pojo/memory
cvs diff: Diffing src-50/org/jboss/cache/pojo/observable
cvs diff: Diffing src-50/org/jboss/cache/pojo/util
cvs diff: Diffing src-50/resources
cvs diff: Diffing tests
cvs diff: Diffing tests/functional
cvs diff: Diffing tests/functional/org
cvs diff: Diffing tests/functional/org/jboss
cvs diff: Diffing tests/functional/org/jboss/cache
cvs diff: Diffing tests/functional/org/jboss/cache/api
cvs diff: Diffing tests/functional/org/jboss/cache/buddyreplication
cvs diff: Diffing tests/functional/org/jboss/cache/config
cvs diff: Diffing tests/functional/org/jboss/cache/data
cvs diff: Diffing tests/functional/org/jboss/cache/eviction
cvs diff: Diffing tests/functional/org/jboss/cache/factories
cvs diff: Diffing tests/functional/org/jboss/cache/interceptors
cvs diff: Diffing tests/functional/org/jboss/cache/invalidation
cvs diff: Diffing tests/functional/org/jboss/cache/invocationcontext
cvs diff: Diffing tests/functional/org/jboss/cache/jmx
cvs diff: Diffing tests/functional/org/jboss/cache/loader
cvs diff: Diffing tests/functional/org/jboss/cache/loader/deadlock
cvs diff: Diffing tests/functional/org/jboss/cache/lock
cvs diff: Diffing tests/functional/org/jboss/cache/marshall
cvs diff: Diffing tests/functional/org/jboss/cache/marshall/data
cvs diff: Diffing tests/functional/org/jboss/cache/mgmt
cvs diff: Diffing tests/functional/org/jboss/cache/misc
cvs diff: Diffing tests/functional/org/jboss/cache/notifications
cvs diff: Diffing tests/functional/org/jboss/cache/optimistic
cvs diff: Diffing tests/functional/org/jboss/cache/options
cvs diff: Diffing tests/functional/org/jboss/cache/options/cachemodelocal
cvs diff: Diffing tests/functional/org/jboss/cache/passivation
cvs diff: Diffing tests/functional/org/jboss/cache/replicated
cvs diff: Diffing tests/functional/org/jboss/cache/statetransfer
cvs diff: Diffing tests/functional/org/jboss/cache/transaction
cvs diff: Diffing tests/functional/org/jboss/cache/util
cvs diff: Diffing tests/interop
cvs diff: Diffing tests/perf
cvs diff: Diffing tests/perf/org
cvs diff: Diffing tests/perf/org/jboss
cvs diff: Diffing tests/perf/org/jboss/cache
cvs diff: Diffing tests/perf/org/jboss/cache/loader
Index: tests/perf/org/jboss/cache/loader/JDBCCacheLoaderPerfTest.java
===================================================================
RCS file:
/cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/loader/JDBCCacheLoaderPerfTest.java,v
retrieving revision 1.9
diff -u -r1.9 JDBCCacheLoaderPerfTest.java
--- tests/perf/org/jboss/cache/loader/JDBCCacheLoaderPerfTest.java 14 Dec 2006 18:52:40
-0000 1.9
+++ tests/perf/org/jboss/cache/loader/JDBCCacheLoaderPerfTest.java 27 Dec 2006 22:32:00
-0000
@@ -29,7 +29,7 @@
private Random random = new Random();
// Tune as necessary
- private static final int NUM_TIMES_PER_THREAD = 1;
+ private static final int NUM_TIMES_PER_THREAD = 2;
private static final int NUM_THREADS = 1;
private static final String threadNamePrefix = "TesterThread-";
@@ -109,6 +109,7 @@
catch (Exception e)
{
e.printStackTrace();
+ fail();
}
}
};
@@ -148,6 +149,7 @@
catch (Exception e)
{
e.printStackTrace();
+ fail();
}
}
};
@@ -189,6 +191,7 @@
catch (Exception e)
{
e.printStackTrace();
+ fail();
}
}
};
cvs diff: Diffing tests/perf/org/jboss/cache/manualtests
cvs diff: Diffing tests/scripts
cvs diff: Diffing tests/scripts/TcpCacheServer
cvs diff: Diffing tests/stress
cvs diff: Diffing tests/stress/org
cvs diff: Diffing tests/stress/org/jboss
cvs diff: Diffing tests/stress/org/jboss/cache
cvs diff: Diffing tests/stress/org/jboss/cache/optimistic
cvs diff: Diffing tests-50
cvs diff: Diffing tests-50/functional
cvs diff: Diffing tests-50/functional/org
cvs diff: Diffing tests-50/functional/org/jboss
cvs diff: Diffing tests-50/functional/org/jboss/cache
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/annotation
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/collection
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/event
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/integrated
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/jmx
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/memory
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/observer
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/passivation
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/region
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/rollback
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/statetransfer
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/test
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/test/propagation
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/test/propagation/impl
cvs diff: Diffing tests-50/functional/org/jboss/cache/pojo/util
cvs diff: Diffing tests-50/perf
cvs diff: Diffing tests-50/perf/org
cvs diff: Diffing tests-50/perf/org/jboss
cvs diff: Diffing tests-50/perf/org/jboss/cache
cvs diff: Diffing tests-50/perf/org/jboss/cache/pojo
cvs diff: Diffing tests-50/perf/org/jboss/cache/pojo/collection
------------------------------------------------------------------------
_______________________________________________
jbosscache-dev mailing list
jbosscache-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosscache-dev
--
Bela Ban
Lead JGroups / JBoss Clustering team
JBoss - a division of Red Hat