From: <jwi...@ea...> - 2012-01-25 15:05:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "opentaps v2". The branch, master has been updated via 750c068a04bbfd57e24da40b5231b3a0a57c34af (commit) from 436b434da87762796f798e9920b4cd0971b36d0c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 750c068a04bbfd57e24da40b5231b3a0a57c34af Author: Jeremy Wickersheimer <jwi...@gm...> Date: Wed Jan 25 23:05:22 2012 +0800 Add comment about why this lazy initialization pattern was chosen diff --git a/modules/validation/impl/src/main/java/org/opentaps/validation/impl/ValidationServiceImpl.java b/modules/validation/impl/src/main/java/org/opentaps/validation/impl/ValidationServiceImpl.java index 9616c2f..5b632e0 100644 --- a/modules/validation/impl/src/main/java/org/opentaps/validation/impl/ValidationServiceImpl.java +++ b/modules/validation/impl/src/main/java/org/opentaps/validation/impl/ValidationServiceImpl.java @@ -30,6 +30,9 @@ public class ValidationServiceImpl implements ValidationService { public ValidationServiceImpl() { } + // Note: although it would be cleaner to get the factory in a static way, this has to be initialized this way + // as there seem to be some timing issues in OSGI .. eg: during testing static init, i got the correct Validator instance + // but it would not actually validate anything for some reasons public Validator getValidator() { if (factory == null) { synchronized(this) { diff --git a/modules/validation/testimpl/src/main/java/org/opentaps/validation/impl/ValidationServiceTestImpl.java b/modules/validation/testimpl/src/main/java/org/opentaps/validation/impl/ValidationServiceTestImpl.java index 4edba83..8442d2e 100644 --- a/modules/validation/testimpl/src/main/java/org/opentaps/validation/impl/ValidationServiceTestImpl.java +++ b/modules/validation/testimpl/src/main/java/org/opentaps/validation/impl/ValidationServiceTestImpl.java @@ -32,6 +32,9 @@ public class ValidationServiceTestImpl implements ValidationService { public ValidationServiceTestImpl() { } + // Note: although it would be cleaner to get the factory in a static way, this has to be initialized this way + // as there seem to be some timing issues in OSGI .. eg: during testing static init, i got the correct Validator instance + // but it would not actually validate anything for some reasons public Validator getValidator() { if (factory == null) { synchronized(this) { ----------------------------------------------------------------------- Summary of changes: .../validation/impl/ValidationServiceImpl.java | 3 +++ .../validation/impl/ValidationServiceTestImpl.java | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) hooks/post-receive -- opentaps v2 |