Commit Graph
576 Commits
Author SHA1 Message Date
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
Jacques Le Roux 03ac565c90 No functional changes just a clean-up : no intermediate var is needed
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835851 13f79535-47bb-0310-9956-ffa450edef68
2009-11-13 14:01:47 +00:00
Adrian Crum 7a5509a277 Small improvement to the Converters class. A converter is registered only once.
Now client code can create local instances of specific converters without interfering with the operation of the factory method.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835667 13f79535-47bb-0310-9956-ffa450edef68
2009-11-13 00:31:39 +00:00
Adam Heath eb02b4e77d Simplied the object graph, removed AbstractCollectionConverter. All
collection conversions now have proper generification.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835453 13f79535-47bb-0310-9956-ffa450edef68
2009-11-12 17:15:01 +00:00
Adam Heath edf7210d88 Remove extraneous blank lines, and trailing whitespace.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835451 13f79535-47bb-0310-9956-ffa450edef68
2009-11-12 17:12:02 +00:00
Adrian Crum be36dd70be Changed the String to Timestamp converter code to fix a problem reported by Hans.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835440 13f79535-47bb-0310-9956-ffa450edef68
2009-11-12 16:52:23 +00:00
Scott Gray 6fa4e52764 Passed in locale was being discarded, fixes OFBIZ-3177 reported by Willem Janssen
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835309 13f79535-47bb-0310-9956-ffa450edef68
2009-11-12 09:15:42 +00:00
Adrian Crum 19f8bf0228 More converter improvements. Better handling of strings supplied to formatting classes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835197 13f79535-47bb-0310-9956-ffa450edef68
2009-11-12 02:31:59 +00:00
Adam Heath 172a135a56 Move getSourceClass and getTargetClass into the base class; removes a
bunch of code.  This also nescessitated the creation of a helper class
for collection containment.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835164 13f79535-47bb-0310-9956-ffa450edef68
2009-11-11 23:47:03 +00:00
Adrian Crum 3fe7e1f03e Oops, I forgot to include one of the Converter collections in my last commit.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835159 13f79535-47bb-0310-9956-ffa450edef68
2009-11-11 23:29:21 +00:00
Adrian Crum a55f49fce5 More improvements to the conversion framework, plus bug fixes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@835032 13f79535-47bb-0310-9956-ffa450edef68
2009-11-11 19:35:34 +00:00
Adrian Crum ae236a6b7d Conversion framework improvements, fixed bugs reported on mailing list.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@834978 13f79535-47bb-0310-9956-ffa450edef68
2009-11-11 17:45:33 +00:00
Adrian Crum 7ec17ed148 Some work on CachedClassLoader.java. Fixed non-thread-safe code, converted HashMap and HashSet to Javolution classes, added a registerClass method, and simplified the Init interface.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@834727 13f79535-47bb-0310-9956-ffa450edef68
2009-11-11 00:39:44 +00:00
Adrian Crum 2f53c75789 Revert unintended change.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@834667 13f79535-47bb-0310-9956-ffa450edef68
2009-11-10 21:08:31 +00:00
Adrian Crum b4d02def78 Modified ObjectType.java to use only the new conversion framework.
This change can be reverted if any major issues come up. I will monitor the dev mailing list and fix any issues that are reported.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@834552 13f79535-47bb-0310-9956-ffa450edef68
2009-11-10 17:18:34 +00:00