]> git.mxchange.org Git - addressbook-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sun, 25 Jun 2017 17:25:35 +0000 (19:25 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 25 Jun 2017 17:37:54 +0000 (19:37 +0200)
- sadly, Glassfish and Payara are both not so super-flexible to allow JNDI
  lookups in constructors. You have to either move that code to a @PostConstruct
  annotated method in bean (=controller) classes or do it on-demand.
- @PostConstruct, @Observes and so on are not processed outside beans, next
  "limitation" (or not wanted/intended/possible?).

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/converter/businesscontact/AddressbookBusinessContactConverter.java
src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java
src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java
src/java/org/mxchange/addressbook/converter/mobile/AddressbookMobileNumberConverter.java
src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java
src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java
src/java/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java
src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java
src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java
src/java/org/mxchange/addressbook/validator/privacy_terms/AddressbookPrivacyTermsCheckboxValidator.java
src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java

index b89015c3c748dd8a37f103ebf116682df462e40f..2c6046d46401fb653d70b73c78183921bee83792 100644 (file)
@@ -47,17 +47,6 @@ public class AddressbookBusinessContactConverter implements Converter {
         * Initialization of this converter
         */
        public AddressbookBusinessContactConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // ... and user controller
-                       this.businessContactBean = (BusinessContactSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/businessContact!org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
@@ -71,6 +60,23 @@ public class AddressbookBusinessContactConverter implements Converter {
                        return null;
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.businessContactBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and user controller
+                                       this.businessContactBean = (BusinessContactSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/businessContact!org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Init instance
                BusinessContact businessContact = null;
 
index ceace4f382524eeda76ab9ee8a6242f976d5a07a..2ddd71bb8cd87071f26798dbaf5c3cf74dd39e87 100644 (file)
@@ -46,17 +46,6 @@ public class AddressbookContactConverter implements Converter {
         * Initialization of this converter
         */
        public AddressbookContactConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // ... and user controller
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
@@ -70,6 +59,23 @@ public class AddressbookContactConverter implements Converter {
                        return null;
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.contactBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and user controller
+                                       this.contactBean = (ContactSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Init instance
                Contact contact = null;
 
index e52da38a52a4f5aa6c4c43548c9831f1ce81b05b..22b6e679a838f0d805e68b463117fdac7169544e 100644 (file)
@@ -41,23 +41,12 @@ public class AddressbookCountryConverter implements Converter {
        /**
         * Country bean
         */
-       private CountrySingletonBeanRemote countryBean;
+       private CountrySingletonBeanRemote countryBean = null;
 
        /**
         * Initialization of this converter
         */
        public AddressbookCountryConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // ... and country bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
@@ -71,6 +60,23 @@ public class AddressbookCountryConverter implements Converter {
                        return null;
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.countryBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and country bean
+                                       this.countryBean = (CountrySingletonBeanRemote) initialContext.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Get full list
                List<Country> countryList = this.countryBean.allCountries();
 
index 82c41e36ed1dff5399f04877b129d7e7ee2bcbe6..fc64926804ef0ebaac3cbcb1e1c487be61f0b207 100644 (file)
@@ -47,17 +47,6 @@ public class AddressbookMobileNumberConverter implements Converter {
         * Initialization of this converter
         */
        public AddressbookMobileNumberConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // ... and user controller
-                       this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
@@ -71,6 +60,23 @@ public class AddressbookMobileNumberConverter implements Converter {
                        return null;
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.phoneBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and user controller
+                                       this.phoneBean = (PhoneSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Init instance
                DialableMobileNumber mobile = null;
 
index d6c2661879dc92ea7379b2d68794d62d5adba10a..9c59ef5b062772809ab194d21a0cd79f0ff354cc 100644 (file)
@@ -47,17 +47,6 @@ public class AddressbookMobileProviderConverter implements Converter {
         * Initialization of this converter
         */
        public AddressbookMobileProviderConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       /// and mobile provider controller
-                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
@@ -71,6 +60,23 @@ public class AddressbookMobileProviderConverter implements Converter {
                        return null;
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.mobileRemoteBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       /// and mobile provider controller
+                                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) initialContext.lookup("java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Get full list
                List<MobileProvider> providerList = this.mobileRemoteBean.allMobileProvider();
 
index ca2419d8f46ee42346c6ef767b7a42bcd9cf17f4..4605f89853b7d36a6e298e9bec6b2b08fc3fd7ff 100644 (file)
@@ -46,17 +46,6 @@ public class AddressbookUserConverter implements Converter {
         * Initialization of this converter
         */
        public AddressbookUserConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // ... and user controller
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
@@ -70,6 +59,23 @@ public class AddressbookUserConverter implements Converter {
                        return null;
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.userBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and user controller
+                                       this.userBean = (UserSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new RuntimeException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Init instance
                User user = null;
 
index de348780fbf63a68ccb77bb2d4f68cd94611f997..4ac7388dcc334f3bf1f2d1764b0a6e8dbaea92a6 100644 (file)
@@ -29,8 +29,6 @@ import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote;
 import org.mxchange.jaddressbook.exceptions.AddressbookNotFoundException;
 import org.mxchange.jaddressbook.model.addressbook.Addressbook;
 import org.mxchange.jcoreee.validator.number.BaseLongValidator;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
 
 /**
  * A validator for address book id verification
@@ -50,43 +48,37 @@ public class AddressbookIdValidator extends BaseLongValidator {
         */
        private AddressbookSessionBeanRemote addressbookBean;
 
-       /**
-        * Logger instance
-        */
-       @Log
-       private LoggerBeanLocal loggerBeanLocal;
-
        /**
         * Public consutructor
         */
        public AddressbookIdValidator () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Lookup logger
-                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
-
-                       // ... and user controller
-                       this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
        }
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
                // All accepted, required fields
                String[] requiredFields = {"addressbookId"}; //NOI18N
 
                // Pre-validation (example: not null, not a string, empty string ...)
                super.preValidate(context, component, value, requiredFields, false);
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.addressbookBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and user controller
+                                       this.addressbookBean = (AddressbookSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new RuntimeException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Cast to long
                Long addressbookId = (Long) value;
 
@@ -113,8 +105,6 @@ public class AddressbookIdValidator extends BaseLongValidator {
                        // Continue to throw
                        throw new ValidatorException(new FacesMessage(MessageFormat.format("Cannot find address book with id {0}", addressbookId)), ex); //NOI18N
                }
-
-               // Trace message
-               this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
        }
+
 }
index fadb2a68a0919c8b550aad342adb651f4bb0e075..abb00df56f1357533f1c6864fb9c66a0ff4aece7 100644 (file)
@@ -49,10 +49,10 @@ public class AddressbookBirthdayValidator extends BaseDateValidator implements V
                // Try to get it
                try {
                        // Get initial context
-                       Context context = new InitialContext();
+                       Context initialContext = new InitialContext();
                } catch (final NamingException ex) {
                        // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
                }
        }
 
index ea22102100d9b60d55b1befde0783fd0438e99ad..8ab45b86f1a6a516b403d8626f0e283abb5ab236 100644 (file)
@@ -21,10 +21,10 @@ import java.util.regex.Pattern;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
 import javax.faces.validator.FacesValidator;
 import javax.faces.validator.Validator;
 import javax.faces.validator.ValidatorException;
-import javax.faces.view.facelets.FaceletException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -47,23 +47,12 @@ public class AddressbookEmailAddressValidator extends BaseStringValidator implem
        /**
         * Contact session-scoped bean
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * Default constructor
         */
        public AddressbookEmailAddressValidator () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -91,6 +80,23 @@ public class AddressbookEmailAddressValidator extends BaseStringValidator implem
                        throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
                }
 
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.contactBean) {
+                               // Try it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // Try to lookup
+                                       this.contactBean = (ContactSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
+               }
+
                // Get client id (aka form id)
                String clientId = component.getClientId();
 
index b6376d11efb52d10e1e2a3619439119308e62ec4..b4df90c75dcdd01df5d4a0ed3205bf9185581bb2 100644 (file)
@@ -44,4 +44,5 @@ public class AddressbookPrivacyTermsCheckboxValidator extends BaseBooleanValidat
                // Pre-validation (example: not null, not a string, empty string ...)
                super.preValidate(context, component, value, requiredFields, false);
        }
+
 }
index 25f45cfffb1b3b7b58fc5a6431a666cf475fba6a..96ddca3d1685e780d71d1e2a282b83e1ce316360 100644 (file)
@@ -17,9 +17,6 @@
 package org.mxchange.addressbook.validator.user;
 
 import java.text.MessageFormat;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.enterprise.event.Observes;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -31,8 +28,6 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcoreee.validator.number.BaseLongValidator;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 
 /**
@@ -43,11 +38,6 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 @FacesValidator ("UserIdValidator")
 public class AddressbookUserIdValidator extends BaseLongValidator implements Validator {
 
-       /**
-        * Cached user status
-        */
-       private static final Set<Long> cachedStatus = new TreeSet<>();
-
        /**
         * Serial number
         */
@@ -62,45 +52,6 @@ public class AddressbookUserIdValidator extends BaseLongValidator implements Val
         * Initialization of this converter
         */
        public AddressbookUserIdValidator () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // ... and user controller
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
-       }
-
-       /**
-        * Event fired when the user registration is complete
-        * <p>
-        * @param event User registration event
-        */
-       public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getRegisteredUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.user is null"); //NOI18N
-               } else if (event.getRegisteredUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.user.userId is null"); //NOI18N
-               } else if (event.getRegisteredUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
-               }
-
-               // Get user instance
-               User registeredUser = event.getRegisteredUser();
-
-               // Update cache
-               AddressbookUserIdValidator.cachedStatus.add(registeredUser.getUserId());
        }
 
        @Override
@@ -114,26 +65,31 @@ public class AddressbookUserIdValidator extends BaseLongValidator implements Val
                // Cast value
                Long userId = (Long) value;
 
-               // Define variable
-               Boolean ifUserExists;
-
-               // Is a map entry there?
-               if (AddressbookUserIdValidator.cachedStatus.contains(userId)) {
-                       // Get from cache
-                       ifUserExists = Boolean.TRUE;
-               } else {
-                       // Get status
-                       ifUserExists = this.userBean.ifUserIdExists(userId);
+               synchronized (this) {
+                       // Is the EJB instanciated?
+                       if (null == this.userBean) {
+                               // Try to get it
+                               try {
+                                       // Get initial context
+                                       Context initialContext = new InitialContext();
+
+                                       // ... and user controller
+                                       this.userBean = (UserSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+                               } catch (final NamingException ex) {
+                                       // Continue to throw it
+                                       throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                               }
+                       }
                }
 
+               // Define variable
+               Boolean ifUserExists = this.userBean.ifUserIdExists(userId);
+
                // Is the user id valid?
                if (!ifUserExists) {
                        // Is not valid
                        throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", userId))); //NOI18N
                }
-
-               // Add to cache if valid
-               AddressbookUserIdValidator.cachedStatus.add(userId);
        }
 
 }