Examples of ServiceRegistryEntry


Examples of org.impalaframework.service.ServiceRegistryEntry

                }
            }
           
        } else {
            for (int i = 0; i < references.size(); i++) {
                final ServiceRegistryEntry ref = getMatchingReference(references, supportedTypes, i);
                if (ref != null) {
                    return ref;
                }
            }
        }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

        if (exportTypesOnly) {
            //filter only export types
            filterReferenceByExportTypes(references, supportedTypes);
        } else {
            for (Iterator<ServiceRegistryEntry> iterator = references.iterator(); iterator.hasNext();) {
                ServiceRegistryEntry serviceReference = iterator.next();
                if (!classChecker.matchesTypes(serviceReference, supportedTypes)) {
                    iterator.remove();
                }
            }
        }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

            //filter only export types
            filterReferenceByExportTypes(values, types);
               
            //check each entry against filter
            for (Iterator<ServiceRegistryEntry> iterator = values.iterator(); iterator.hasNext();) {
                ServiceRegistryEntry serviceReference = iterator.next();
              
                if (!filter.matches(serviceReference)) {
                    iterator.remove();
                }
            }
           
            return serviceReferenceSorter.sort(values, true);
        } else {
       
            //Create new list of services for concurrency protection
            final List<ServiceRegistryEntry> values;
           
            try {
                registryReadLock.lock();
                values = new LinkedList<ServiceRegistryEntry>(this.services);
            } finally {
                registryReadLock.unlock();
            }
           
            for (Iterator<ServiceRegistryEntry> iterator = values.iterator(); iterator.hasNext();) {
                ServiceRegistryEntry serviceReference = iterator.next();
              
                if (!(classChecker.matchesTypes(serviceReference, types) && filter.matches(serviceReference))) {
                    iterator.remove();
                }
            }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

    private void filterReferenceByExportTypes(final List<ServiceRegistryEntry> values, Class<?>[] types) {
       
        Iterator<ServiceRegistryEntry> iterator = values.iterator();
        while (iterator.hasNext()) {
           
            ServiceRegistryEntry serviceReference = iterator.next();
           
            //note start index is 1 because we've already checked first type
            boolean isPresent = isPresentInExportTypes(serviceReference, types, 1);
            if (!isPresent) {
                iterator.remove();
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

    private ServiceRegistryEntry getMatchingReference(
            final List<ServiceRegistryEntry> list,
            Class<?>[] supportedTypes,
            int index) {
       
        final ServiceRegistryEntry reference = list.get(index);
        if (reference == null) {
            return null;
        }
       
        if (classChecker.matchesTypes(reference, supportedTypes)) {
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

            ServiceBeanReference beanReference,
            List<Class<?>> classes,
            Map<String, ?> attributes,
            ClassLoader classLoader) {
       
        ServiceRegistryEntry serviceEntry = entryRegistryDelegate.addService(beanName, moduleName, beanReference, classes, attributes, classLoader);
       
        if (logger.isDebugEnabled())
            logger.debug("Added service bean '" + beanName
                    + "' contributed from module '" + moduleName
                    + "' to service registry, with attributes " + attributes);
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

    }
   
    /* ******************* Private and package method ******************** */
   
    private void handleEventRemoved(ServiceRegistryEvent event) {
        ServiceRegistryEntry ref = event.getServiceRegistryEntry();
       
        //no particular point matching before removing as it is more extra work than
        //simply calling remove.
        serviceActivityNotifiable.remove(ref);
    }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

        //simply calling remove.
        serviceActivityNotifiable.remove(ref);
    }

    void handleEventAdded(ServiceRegistryEvent event) {
        ServiceRegistryEntry entry = event.getServiceRegistryEntry();
        handleReferenceAdded(entry);
    }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

    public Object invoke(MethodInvocation invocation) throws Throwable {
       
        final boolean setCCCL = setContextClassLoader;
       
        ServiceRegistryEntry serviceReference = targetSource.getServiceRegistryReference();
       
        int retriesUsed = 0;
        while (serviceReference == null && retriesUsed < retryCount) {
            try {
                Thread.sleep(retryInterval);
            }
            catch (InterruptedException e) {
            }
            serviceReference = targetSource.getServiceRegistryReference();
            retriesUsed++;
        }

        if (serviceReference != null) {
           
            final Thread currentThread;
            final ClassLoader existingClassLoader;
            if (setCCCL) {
                currentThread = Thread.currentThread()
                existingClassLoader= currentThread.getContextClassLoader();
            } else {
                currentThread = null;
                existingClassLoader = null;
            }
           
           
            try {
                if (setCCCL) {
                    currentThread.setContextClassLoader(serviceReference.getBeanClassLoader());
                }
                return invocation.proceed();
               
            } finally {
                //reset the previous class loader
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryEntry

               
                if (serviceRegistry != null) {
                    String moduleName = moduleDefinition.getName();
                    logger.info("Contributing bean " + beanName + " from module " + moduleName);
                    final ServiceBeanReference beanReference = SpringModuleServiceUtils.newServiceBeanReference(beanFactory, beanName);
                    final ServiceRegistryEntry serviceReference = serviceRegistry.addService(beanName, moduleName, beanReference, beanClassLoader);
                    contributionMap.put(serviceReference, endPoint);
                }  
            }      
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.