* the class is now thread safe
* the class is now cleaner (no references to delegator etc...)
* replaced the collision detection algorithm with a simpler/reliable/efficient one based on: update with no changes (to get a lock) + select + update (to increase the last sequence id)
* removed ugly special code for "clusters" that is no more needed
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621438 13f79535-47bb-0310-9956-ffa450edef68
Added two unit tests to confirm the proper behavior of the SequenceUtil class; the second test fails without the fix committed with this revision.
Part of OFBIZ-2353.
This is just the first pass of my work to refactor the SequenceUtil.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621335 13f79535-47bb-0310-9956-ffa450edef68
the entirety of the delegator in a thread pool. This will become a big
win very shortly, when multiple delegators are created at startup.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617816 13f79535-47bb-0310-9956-ffa450edef68
patch, that initializes the eca handlers DispatchContext asynchronously.
With it, when the eca attempts to initialize, the DelegatorContext will
also initialize at the same time; this will end up calling back into the
same delegator, and a deadlock will occur.
When both are asynchronous, then the eca initialization will return
quickly, and upon first access, the DispatchContext future will be
waited for.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617813 13f79535-47bb-0310-9956-ffa450edef68
in that:
* BATCH does not block when all the coreThreads are busy, as would
happen with EXECUTOR. When all coreThreads are busy, new threads will
be spawned.
* Scheduled jobs can *not* be submitted.
You can simulate the first problem, by modifying ExecutionPool, and
force-setting the threadCount to 1. Then, submit something to the pool,
that will then itself submit more items into the pool. Dead-lock will
occur.
BATCH should be used when it might be posslbe that more items could be
submitted by code you are calling.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617810 13f79535-47bb-0310-9956-ffa450edef68
engine tests, when run with java1.7. Apparently, the order of methods
returned by reflection varies between runs, so if methods have implicit
requirements on each other, you get spurious errors.
The are 3 types of fixes:
* Combine the separate testCase methods into one
* Add explict method ordering.
* Make use testCase method completely stand-alone.
The product inventory tests were combined, while the entity engine tests
were restructured to be stand-alone.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1605269 13f79535-47bb-0310-9956-ffa450edef68
encryption/decryption happens at the jdbc layer, when values are set
into a PreparedStatement, or fetched from a ResultSet.
This means that conditions are no longer munged to contain the encrypted
value, and entities are no longer updated to temporarily contain the
encrypted value. In all cases, the value of a field in memory will be
unecncrypted.
This fixes the following code patterns:
person = delegator.create("Person", [partyId: "my-party"]);
person.socialSecurityNumber = "1234";
person.store();
// this fails, the encrypted value is stored inside entity
assertEquals("1234", person.socialSecurityNumber);
currentValue = person.socialSecurityNumber
person.store();
// this fails, the field is doubly-encrypted
assertEquals(currentValue, person.socialSecurityNumber);
origCondition = EntityCondition.makeCondition(
"socialSecurityNumber",
EntityOperator.EQUALS,
"1234"
);
list = delegator.findList("Person", origCondition);
newCondition = EntityCondition.makeCondition(
"socialSecurityNumber",
EntityOperator.EQUALS,
"1234"
);
// this fails, because the condition is updated in-place, with the
// encrypted field value.
assertEquals(origCondition, newCondition);
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604976 13f79535-47bb-0310-9956-ffa450edef68
condition; this allows the wrapped value to be changed, as the builder
api is used, and will make it possible for the actual condition object
to be made final.
To allow for this wrapper to be passed to the delegator, it extends
EntityCondition, and delegates all calls to the contained condition
object.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604974 13f79535-47bb-0310-9956-ffa450edef68
classes/fields not yet finalized are left undone due to there being
side-effects with other parts of the code base. These side-effects will
be fixed shortly.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604969 13f79535-47bb-0310-9956-ffa450edef68
This is done by just setting the length of salt bytes to 0, but still
having a length byte prepended.
Add a feature to allow for certain fields to actually have a salt
prefix. This is enabled by setting encrypt=salt in the entity
definition.
This change is slightly incompatible with existing code. Old database
values will continue to be decrypted correctly. However, newly
encrypted values will no longer have a salt prepended, while originally
they would. This shouldn't be a problem in practice.
This change, along with the previous commit, finally allow for direct
lookup of encrypted values. However, already stored values will not be
found. To fix those, each database row will have to be read in by
ofbiz, then immediately written back out.
This is part two to completely fix OFBIZ-5959:
Person.socialSecurityNumber can't be used for findByAnd.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604968 13f79535-47bb-0310-9956-ffa450edef68
a String, because it would end up being wrapped in an EntityFieldValue
object. The only way it would be a String is during incorrect
Freemarker lookups(which no longer happen, as the
EntityCondition.makeCondition factory pattern is now in use).
With this fix in place, EntityExpr can finally start encrypting it's
field values, so that direct matching on encrypted fields can work.
This is part one to fix OFBIZ-5959: Person.socialSecurityNumber can't be
used for findByAnd.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604967 13f79535-47bb-0310-9956-ffa450edef68