Commit Graph
590 Commits
Author SHA1 Message Date
Adam Heath 1c2d454f0d Bother, back out GenericMap change to this; more extensive testing
concurrent modification type bugs with the keySet/entrySet/values
collections.  I saw an exception in AbstractEntityConditionCache, so
I'll back this out until I have a chance to fix it properly.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885343 13f79535-47bb-0310-9956-ffa450edef68
2009-11-30 07:36:56 +00:00
Adam Heath 9b03b443db UtilCache is now a map. keySet, entrySet, and values iterators won't
reflect items added/removed.  However, most membership tests directly
access the underlying cache anyways, so this isn't a big deal.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885275 13f79535-47bb-0310-9956-ffa450edef68
2009-11-29 21:26:37 +00:00
Adam Heath 548b074859 Make cacheLineTable private and final.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885274 13f79535-47bb-0310-9956-ffa450edef68
2009-11-29 21:25:17 +00:00
Adam Heath 0a53bebe52 Don't return null in values(), but instead an empty collection.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885272 13f79535-47bb-0310-9956-ffa450edef68
2009-11-29 21:24:16 +00:00
Adam Heath 5baa6186e1 Switch UtilCache.values() to return a Collection instead of a List.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885270 13f79535-47bb-0310-9956-ffa450edef68
2009-11-29 21:23:38 +00:00
Adam Heath 1a1cc17e5f Add isEmpty implementation.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885269 13f79535-47bb-0310-9956-ffa450edef68
2009-11-29 21:22:50 +00:00
Adam Heath 2dec3e0f54 Change return type of size() to int; CacheLineTable.size() already had
an int return, and this change moves this closer to the Map interface.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885188 13f79535-47bb-0310-9956-ffa450edef68
2009-11-29 03:35:07 +00:00
Jacques Le Roux 035361f4b6 Oops, this file should not have been changed in r885103
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885117 13f79535-47bb-0310-9956-ffa450edef68
2009-11-28 17:34:22 +00:00
Jacques Le Roux e07ab48fb4 Some cleaning related to is(Not)Empty
* remove duplicate ()
* remove casts no longer needed

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885103 13f79535-47bb-0310-9956-ffa450edef68
2009-11-28 15:46:52 +00:00
Jacques Le Roux 569a4afeea Some cleaning related to isEmpty
* remove duplicate ()
* remove casts no longer needed

I'm doing these last tasks around isEmpty and isNotEmpty mostly to be sure that nothing has slipped in. Despite I have been very careful, I prefer double check.

+ one typo in ofbizSelenium help (not sure this file is used yet though, seems to be missing some parts which are commented out, for now I guess)



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885093 13f79535-47bb-0310-9956-ffa450edef68
2009-11-28 14:08:16 +00:00
Jacques Le Roux 2777b83223 Fix r885091 where isNotEmpty has been used by error instead of isEmpty
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885092 13f79535-47bb-0310-9956-ffa450edef68
2009-11-28 13:59:45 +00:00
Jacques Le Roux 5d4b9b5982 More uses of isEmpty(expr) instead of (expr == null) || (expr.size() == 0
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885091 13f79535-47bb-0310-9956-ffa450edef68
2009-11-28 13:31:52 +00:00
Adam Heath d68d9fb287 None of the stats values were protected with any kind of locking. The
The jvm doesn't guarantee anything about ++ operations; they are *not*
single commands.  This is even more of a problem with 64 bit longs on a
32 bit jvm, where even a read or a write to/from a long may be multiple
commands.  It is entirely possible that a write to a long might be
partially read by another thread.

The fix is either to protected all the stats with a synchronized block,
either a single one, or one per stat, or to use the new java 1.5 atomic
variables.  The latter is much better, because most of the time no one
is reading the stats, so there is hardly ever any contention.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884984 13f79535-47bb-0310-9956-ffa450edef68
2009-11-27 20:26:06 +00:00
Jacques Le Roux e26e66c8c3 Oops, I forgot to commit this file in r884545
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884598 13f79535-47bb-0310-9956-ffa450edef68
2009-11-26 15:42:46 +00:00
Jacques Le Roux 2c51efbc09 Better version of isEmpty() with comments from Scott and Adam on dev ML.
I used one line, please feel free to comment if needed

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884545 13f79535-47bb-0310-9956-ffa450edef68
2009-11-26 13:09:40 +00:00
Adam Heath cd446f9c3c Fix getOrCreateUtilCache, so that it doesn't always create new caches; mea culpa.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884262 13f79535-47bb-0310-9956-ffa450edef68
2009-11-25 20:47:51 +00:00
Adam Heath 683479438b size() needs to be synchronized as well.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884239 13f79535-47bb-0310-9956-ffa450edef68
2009-11-25 19:47:31 +00:00
Adam Heath 8ad14aae64 Remove synchronization for listeners, switching to CopyOnWriteArraySet.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884238 13f79535-47bb-0310-9956-ffa450edef68
2009-11-25 19:46:49 +00:00
Adam Heath 126a045cda Remove all remaining synchronized protection against utilCacheTable.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884237 13f79535-47bb-0310-9956-ffa450edef68
2009-11-25 19:46:05 +00:00
Jacques Le Roux 70d7a15dfb Partially fix an issue I discussed with Akash on dev ML on how to format decimals in prices
* Mostly parameterize UtilFormatOut.formatPrice() from general.properties
* I removed unused currency.decimal.format calls in CheckOutEvents class
* Also removed unused priceNumberFormat in UtilFormatOut class

Still have to fix 11 harcoded  "##0.00" in ftl files using ofbizCurrency 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884023 13f79535-47bb-0310-9956-ffa450edef68
2009-11-25 10:43:09 +00:00
Adrian Crum 07f3abc276 Eliminated unnecessary casts.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883827 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 19:26:20 +00:00
Adrian Crum 036cc7b2c4 Converter framework bug fixes. This commit fixes the out of memory errors the demo servers have been having lately.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883807 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 18:37:09 +00:00
Jacques Le Roux 8620399660 Complete r883634 : allows to check isEmpty() on a CharSequence
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883647 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 10:29:30 +00:00
Jacques Le Roux e25f58f02d Scott detected that UtilValidate.is(Not)Empty did not exist for CharSequence and reverted changes I did in EntitySaxReader.java
This commit adds UtilValidate.is(Not)Empty for CharSequence; and uses it in EntitySaxReader.java and everywhere else it might still be used (because of my changes)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883634 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 09:24:32 +00:00
Adrian Crum 0206592d18 JavaDoc updates in the conversion framework. No functional changes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883589 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 05:35:18 +00:00
Jacques Le Roux c72b29cb1f Use UtilValidate.isNotEmpty methods instead of (obj != null) || (obj.length > 0) and (obj != null) || (obj.size > 0)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883549 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 23:41:34 +00:00
Adrian Crum df86f46af2 Added Blob<->byte[] converters.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883529 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 22:49:06 +00:00
Jacques Le Roux 5518e9baf8 Use UtilValidate.isEmpty methods instead of (obj == null) || (obj.size == 0)
Complete r883492

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883516 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 22:02:05 +00:00
Jacques Le Roux e839974fe7 Use UtilValidate.isEmpty methods instead of (obj == null) || (obj.length == 0)
Complete r883507


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883508 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 21:48:18 +00:00
Jacques Le Roux 4e0d303e06 Use UtilValidate.isEmpty methods instead of (obj == null) || (obj.length == 0)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883507 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 21:42:18 +00:00
Adam Heath 1e2d73707f Switch to ConcurrentHashMap for utilCacheTable.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883230 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:07:01 +00:00
Adam Heath 10bc1da16b Remove all but one constructor.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883229 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:06:21 +00:00
Adam Heath c4a0d6d66d Make utilCacheTable private.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883228 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:05:30 +00:00
Adam Heath e4718ddb62 Add a helper method, getUtilCacheTableKeySet, and use that in
FindUtilCache.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883227 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:04:50 +00:00
Adam Heath 6e0fcf060a No longer access utilCacheTable from AbstractCache; this nescessatited
creating a getOrCreateUtilCache helper method.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883225 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:03:20 +00:00
Adam Heath 760632627c Add another createUtilCache variant that allows for extra properties to
be looked upped for setting parameters.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883223 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:01:37 +00:00
Adam Heath 8c800494de Fix defaultIndices manipulation, by switching to ConcurrentHashMap; this
has a good side-effect of fixing the total lack of synchronization on
the previous version.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883222 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:00:49 +00:00
Adam Heath b625a1ff4d Make defaultIndex calculation field and method private and static.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883221 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 03:00:04 +00:00
Adam Heath 0a1ab8a989 Move utilCacheTable.put out of the constructors.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883220 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 02:59:22 +00:00
Adam Heath f691ed6312 Make utilCacheTable final.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883219 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 02:58:36 +00:00
Adam Heath b6788006fb Make all constructors private(removing deprecation while doing so), and
then make the name property private/final.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883218 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 02:57:47 +00:00
Adam Heath 820d11eb97 Deprecate UtilCache constructors, and add a create helper function.
This is the first step to making utilCacheTable concurrent, and
non-blocking.  To do so, the constructor has to have no side-effects.
This means it can't modify utilCacheTable itself; this will be moved to
the helper function created above.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883217 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 02:56:28 +00:00
Adam Heath 60e0905b7f Fix generics in getUtilCacheTableValuesImage.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@883216 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 02:52:29 +00:00
Jacques Le Roux c28207e323 A patch from Philippe Mouawad "OutOfMemory provoked by Cache overflow" (https://issues.apache.org/jira/browse/OFBIZ-2186) - OFBIZ-2186
CacheLineTable and LRUMap do not synchronize on the same lock

    * CacheLineTable synchronization use the CacheLineTable instance monitor
    * LRUMap synchronization use the LRUMap instance monitor

the LRUMap (memoryTable) can be updated concurrently by 2 differents threads

    * one in the CacheLineTable #put or CacheLineTable#remove
    * another in the CacheLineTable#get

this leads to the corruption of the LRUMap which is not thread-safe

the CacheLineTable#get should be synchronized or the LRUMap should be replaced by a thead safe collection

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@882072 13f79535-47bb-0310-9956-ffa450edef68
2009-11-19 08:25:48 +00:00
Adam Heath 284eecbe8f More space changes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@881683 13f79535-47bb-0310-9956-ffa450edef68
2009-11-18 06:20:15 +00:00
Adam Heath 4494ee3306 Use the location, instead of the url's file path, when parsing groovy
class files.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@881659 13f79535-47bb-0310-9956-ffa450edef68
2009-11-18 03:44:06 +00:00
Adrian Crum 22b83c211f More Java object type converters.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@881515 13f79535-47bb-0310-9956-ffa450edef68
2009-11-17 21:02:57 +00:00
Jacques Le Roux 834176ceaf A patch from Philippe Mouawad "Ofbiz freeze" (https://issues.apache.org/jira/browse/OFBIZ-2124) - OFBIZ-2124
In a certain scenario the application freezes, no more AJP connector threads are available.
After analysis the lock seems to come from very slow response time in GenericDelegator.clearAllCaches and particularily in CacheLineTable.keySet.
Furthermore, looking at org.ofbiz.base.util.cache.UtilCache, the class seems to have some synchronisation problems:
1) utilCacheTable.put calls are not synchronized
2) findCache synchronizes access to utilCacheTable while only getting an element which has big performance impact since utilCacheTable is static
3) clearExpiredFromAllCaches and clearAllCaches does not synchronize while clearCachesThatStartWith does, why ?

The patch synchronizes correctly the access to utilCacheTable and optimises findCache 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@881194 13f79535-47bb-0310-9956-ffa450edef68
2009-11-17 08:36:35 +00:00
Scott Gray d79e59f640 Added java.sql.Date -> java.sql.Timestamp converter
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@881045 13f79535-47bb-0310-9956-ffa450edef68
2009-11-16 23:27:19 +00:00
Adam Heath 91050d9263 Very large update. SQL parser is fairly generic now. Can parse sql
that is compatible with features used by ofbiz.  Has support for
DELETE, INSERT, INSERT SELECT, SELECT, UPDATE, and VIEW.

Modified the delegator side of the above to handle the new
interfaces.  Now supports complex alias.  Only SELECT is supported,
and the parseCondition code is disabled for the time being.

The plan(sic) here is to obviously support the other sql statements.
Then, to have a jdbc wrapper around all this, so external tools, that
only know how to talk jdbc, can actually talk directly to the
delegator.

Plus, many more people can understand sql syntax.  This allows them
to do things with ofbiz, that they would find much more difficult if
they had to write <view-entity> definitions.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@880835 13f79535-47bb-0310-9956-ffa450edef68
2009-11-16 16:31:32 +00:00