[jboss-svn-commits] JBL Code SVN: r35454 - in labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta: tests/src/org/jboss/internal/soa/esb/services/registry and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Oct 7 08:03:00 EDT 2010
Author: kevin.conner at jboss.com
Date: 2010-10-07 08:02:58 -0400 (Thu, 07 Oct 2010)
New Revision: 35454
Added:
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptor.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptorUnitTest.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryConcurrencyInterceptor.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryStatsInterceptor.java
Modified:
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptorUnitTest.java
Log:
Add local registry interceptor: JBESB-3449
Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptor.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptor.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptor.java 2010-10-07 12:02:58 UTC (rev 35454)
@@ -0,0 +1,488 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.services.registry.AbstractRegistryInterceptor;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+/**
+ * Local registry interceptor.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public class LocalRegistryInterceptor extends AbstractRegistryInterceptor
+{
+ /**
+ * The logger for the registry cache
+ */
+ private static final Logger LOGGER = Logger.getLogger(LocalRegistryInterceptor.class) ;
+
+ /**
+ * Mapping of service names to service informatio.
+ */
+ private final HashMap<Service, ServiceInfo> serviceInfoMap = new HashMap<Service, ServiceInfo>() ;
+
+ /**
+ * Find all Services assigned to the Red Hat/JBossESB organization.
+ * @return Collection of Strings containing the service names.
+ * @throws RegistryException
+ */
+ public List<String> findAllServices() throws RegistryException
+ {
+ return getRegistry().findAllServices() ;
+ }
+
+ /**
+ * Find all services that belong to the supplied category.
+ *
+ * @param serviceCategoryName - name of the category to which the service belongs.
+ * @return Collection of Strings containing the service names
+ * @throws RegistryException
+ */
+ public List<String> findServices(final String category)
+ throws RegistryException
+ {
+ return getRegistry().findServices(category) ;
+ }
+
+ /**
+ * Returns the first EPR in the list that belong to a specific category and service combination.
+ *
+ * @param serviceCategoryName - name of the category to which the service belongs.
+ * @param serviceName - name of the service to which the EPS belongs.
+ * @return EPR.
+ * @throws RegistryException
+ */
+ public EPR findEPR(final String category, final String name)
+ throws RegistryException, ServiceNotFoundException
+ {
+ final Service service = new Service(category, name) ;
+ final ConcurrentMap<EPR, AtomicLong> eprMap = getEPRs(service) ;
+
+ if (eprMap != null)
+ {
+ final Iterator<EPR> eprIter = eprMap.keySet().iterator() ;
+ if (eprIter.hasNext())
+ {
+ final EPR epr = eprIter.next() ;
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Returning locally registered EPR for category " + category + ", name " + name) ;
+ }
+ return epr ;
+ }
+ }
+ return getRegistry().findEPR(category, name);
+ }
+
+ /**
+ * Finds all the EPRs that belong to a specific category and service combination.
+ *
+ * @param serviceCategoryName - name of the category to which the service belongs.
+ * @param serviceName - name of the service to which the EPS belongs.
+ * @return Collection of EPRs.
+ * @throws RegistryException
+ */
+ public List<EPR> findEPRs(final String category, final String name)
+ throws RegistryException, ServiceNotFoundException
+ {
+ final Service service = new Service(category, name) ;
+ final ConcurrentMap<EPR, AtomicLong> eprMap = getEPRs(service) ;
+
+ if (eprMap != null)
+ {
+ final Set<EPR> eprSet = eprMap.keySet() ;
+ final List<EPR> eprs = Arrays.asList(eprSet.toArray(new EPR[0])) ;
+ if (!eprs.isEmpty())
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Returning locally registered EPRs for category " + category + ", name " + name) ;
+ }
+ return eprs ;
+ }
+ }
+ return getRegistry().findEPRs(category, name) ;
+ }
+
+ /**
+ * Registers an EPR under the specified category and service. If the specified service does
+ * not exist, it will be created at the same time.
+ *
+ * @param serviceCategoryName - name of the category to which the service belongs.
+ * @param serviceName - name of the service to which the EPS belongs.
+ * @param serviceDescription - human readable description of the service,
+ * only used when it the service does not yet exist.
+ * @param epr - the EndPointReference (EPR) that needs to be registered.
+ * @param eprDescription - human readable description of the EPR
+ * @throws RegistryException
+ */
+ public void registerEPR(final String category, final String name,
+ final String serviceDescription, final EPR epr, final String eprDescription)
+ throws RegistryException
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Registering EPR " + epr + " for category " + category + ", name " + name) ;
+ }
+ final Service service = new Service(category, name) ;
+ final ServiceInfo serviceInfo = createWriteLockServiceInfo(service) ;
+ try
+ {
+ getRegistry().registerEPR(category, name, serviceDescription, epr, eprDescription) ;
+ final ConcurrentMap<EPR, AtomicLong> eprs = serviceInfo.getEPRs() ;
+ addEPR(eprs, epr) ;
+ }
+ finally
+ {
+ serviceInfo.getWriteLock().unlock() ;
+ }
+ }
+
+ /**
+ * Removes an EPR from the Registry.
+ * @param serviceCategoryName - name of the category to which the service belongs.
+ * @param serviceName - name of the service to which the EPS belongs.
+ * @param epr - the EndPointReference (EPR) that needs to be unregistered.
+ * @throws RegistryException
+ */
+ public void unRegisterEPR(final String category, final String name,
+ final EPR epr) throws RegistryException, ServiceNotFoundException
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Unregistering EPR " + epr + " for category " + category + ", name " + name) ;
+ }
+ final Service service = new Service(category, name) ;
+ final ServiceInfo serviceInfo = getWriteLockServiceInfo(service) ;
+ if (serviceInfo != null)
+ {
+ try
+ {
+ final ConcurrentMap<EPR, AtomicLong> eprs = serviceInfo.getEPRs() ;
+ final AtomicLong count = eprs.get(epr) ;
+ if (count != null)
+ {
+ if (count.decrementAndGet() == 0)
+ {
+ eprs.remove(epr) ;
+ if (eprs.isEmpty())
+ {
+ removeServiceInfo(service, serviceInfo) ;
+ }
+ }
+ }
+ getRegistry().unRegisterEPR(category, name, epr) ;
+ }
+ finally
+ {
+ serviceInfo.getWriteLock().unlock() ;
+ }
+ }
+ else
+ {
+ getRegistry().unRegisterEPR(category, name, epr) ;
+ }
+ }
+
+ /**
+ * Removes a service from the Registry along with all the ServiceBindings underneath it.
+ *
+ * @param category - name of the service category, for example 'transformation'.
+ * @param serviceName - name of the service, for example 'smooks'.
+ * @throws RegistryException
+ */
+ public void unRegisterService(final String category, final String name)
+ throws RegistryException, ServiceNotFoundException
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Unregistering service category " + category + ", name " + name) ;
+ }
+
+ final Service service = new Service(category, name) ;
+ final ServiceInfo serviceInfo = getWriteLockServiceInfo(service) ;
+ if (serviceInfo != null)
+ {
+ try
+ {
+ removeServiceInfo(service, serviceInfo) ;
+ getRegistry().unRegisterService(category, name) ;
+ }
+ finally
+ {
+ serviceInfo.getWriteLock().unlock() ;
+ }
+ }
+ else
+ {
+ getRegistry().unRegisterService(category, name) ;
+ }
+ }
+
+ /**
+ * Add an EPR entry into the map.
+ * @param eprs The current map.
+ * @param epr The epr to add.
+ */
+ private static void addEPR(final ConcurrentMap<EPR, AtomicLong> eprs, final EPR epr)
+ {
+ final AtomicLong newCount = new AtomicLong(1) ;
+ final AtomicLong count = eprs.putIfAbsent(epr, newCount) ;
+ if (count != null)
+ {
+ count.incrementAndGet() ;
+ }
+ }
+
+ /**
+ * Remove the service info from the current map.
+ * @param service The service to remove.
+ * @param serviceInfo The service information being removed.
+ * @param ifEmpty Only remove the service information if it is empty.
+ */
+ private synchronized void removeServiceInfo(final Service service, final ServiceInfo serviceInfo)
+ {
+ final ServiceInfo currentServiceInfo = serviceInfoMap.remove(service) ;
+ if (serviceInfo != currentServiceInfo)
+ {
+ serviceInfoMap.put(service, currentServiceInfo) ;
+ }
+ }
+
+ /**
+ * Acquire a read lock for the current service info.
+ * @param service The service to lock.
+ * @return The current service info in the map.
+ */
+ private ConcurrentMap<EPR, AtomicLong> getEPRs(final Service service)
+ {
+ final boolean traceEnabled = LOGGER.isTraceEnabled() ;
+ while(true)
+ {
+ final ServiceInfo serviceInfo ;
+ final Lock readLock ;
+ synchronized(this)
+ {
+ serviceInfo = serviceInfoMap.get(service) ;
+ if (traceEnabled)
+ {
+ LOGGER.trace("Retrieved service information for service " + service + ", serviceInfo: " + serviceInfo) ;
+ }
+ if (serviceInfo == null)
+ {
+ return null ;
+ }
+ readLock = serviceInfo.getReadLock() ;
+
+ if (readLock.tryLock())
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("Obtained read lock, returning EPRs") ;
+ }
+ try
+ {
+ return serviceInfo.getEPRs() ;
+ }
+ finally
+ {
+ readLock.unlock() ;
+ }
+ }
+ }
+ LOGGER.trace("Waiting for read lock") ;
+ readLock.lock() ;
+ try
+ {
+ synchronized(this)
+ {
+ if (serviceInfo == serviceInfoMap.get(service))
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("Returning current EPRs") ;
+ }
+ return serviceInfo.getEPRs() ;
+ }
+ }
+ }
+ finally
+ {
+ readLock.unlock() ;
+ }
+ }
+ }
+
+ /**
+ * Acquire a write lock for the current service info, caller <b>must</b> release the lock.
+ * @param service The service to lock.
+ * @return The current service info in the map.
+ */
+ private ServiceInfo getWriteLockServiceInfo(final Service service)
+ {
+ final boolean traceEnabled = LOGGER.isTraceEnabled() ;
+ while(true)
+ {
+ final ServiceInfo serviceInfo ;
+ final Lock writeLock ;
+ synchronized(this)
+ {
+ serviceInfo = serviceInfoMap.get(service) ;
+ if (traceEnabled)
+ {
+ LOGGER.trace("Retrieved service information for service " + service + ", serviceInfo: " + serviceInfo) ;
+ }
+ if (serviceInfo == null)
+ {
+ return null ;
+ }
+ writeLock = serviceInfo.getWriteLock() ;
+
+ if (writeLock.tryLock())
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("Obtained write lock, returning locked serviceInfo") ;
+ }
+ return serviceInfo ;
+ }
+ }
+ LOGGER.trace("Waiting for write lock") ;
+ writeLock.lock() ;
+ synchronized(this)
+ {
+ if (serviceInfo == serviceInfoMap.get(service))
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("ServiceInfo stilll current, returning locked serviceInfo") ;
+ }
+ return serviceInfo ;
+ }
+ else
+ {
+ writeLock.unlock() ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Acquire a write lock for the current service info, caller <b>must</b> release the lock.
+ * ServiceInfo will be created if not present.
+ * @param service The service to lock.
+ * @return The current service info in the map.
+ */
+ private ServiceInfo createWriteLockServiceInfo(final Service service)
+ {
+ final boolean traceEnabled = LOGGER.isTraceEnabled() ;
+ while(true)
+ {
+ final ServiceInfo serviceInfo ;
+ final Lock writeLock ;
+ synchronized(this)
+ {
+ serviceInfo = serviceInfoMap.get(service) ;
+ if (serviceInfo == null)
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("Creating service information for service " + service) ;
+ }
+ final ServiceInfo newServiceInfo = new ServiceInfo() ;
+ serviceInfoMap.put(service, newServiceInfo) ;
+ newServiceInfo.getWriteLock().lock() ;
+ return newServiceInfo ;
+ }
+ if (traceEnabled)
+ {
+ LOGGER.trace("Retrieved service information for service " + service + ", serviceInfo: " + serviceInfo) ;
+ }
+ writeLock = serviceInfo.getWriteLock() ;
+
+ if (writeLock.tryLock())
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("Obtained write lock, returning locked serviceInfo") ;
+ }
+ return serviceInfo ;
+ }
+ }
+ writeLock.lock() ;
+ synchronized(this)
+ {
+ if (serviceInfo == serviceInfoMap.get(service))
+ {
+ if (traceEnabled)
+ {
+ LOGGER.trace("ServiceInfo stilll current, returning locked serviceInfo") ;
+ }
+ return serviceInfo ;
+ }
+ else
+ {
+ writeLock.unlock() ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Class representing the service information
+ * @author kevin
+ */
+ private static class ServiceInfo
+ {
+ private ConcurrentMap<EPR, AtomicLong> eprs = new ConcurrentHashMap<EPR, AtomicLong>() ;
+
+ private ReadWriteLock lock = new ReentrantReadWriteLock() ;
+
+ ConcurrentMap<EPR, AtomicLong> getEPRs()
+ {
+ return eprs ;
+ }
+
+ Lock getWriteLock()
+ {
+ return lock.writeLock() ;
+ }
+
+ Lock getReadLock()
+ {
+ return lock.readLock() ;
+ }
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptorUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptorUnitTest.java 2010-10-07 12:01:42 UTC (rev 35453)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptorUnitTest.java 2010-10-07 12:02:58 UTC (rev 35454)
@@ -21,11 +21,7 @@
import java.net.URI;
import java.util.List;
-import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.TestCase;
@@ -34,8 +30,6 @@
import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.common.ModulePropertyManager;
import org.jboss.soa.esb.services.registry.Registry;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryInterceptor;
import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import com.arjuna.common.util.propertyservice.PropertyManager;
@@ -61,7 +55,7 @@
final EPR epr3 = new EPR(URI.create("urn:test")) ;
final CachingRegistryInterceptor interceptor = new CachingRegistryInterceptor() ;
- final CacheRegistryStatsInterceptor stats = new CacheRegistryStatsInterceptor() ;
+ final RegistryStatsInterceptor stats = new RegistryStatsInterceptor() ;
final MockRegistry registry = new MockRegistry() ;
stats.setRegistry(registry) ;
interceptor.setRegistry(stats) ;
@@ -142,11 +136,7 @@
assertEquals("findEPR count", 0, stats.getFindEPRCount()) ;
assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
- // Need to fix MockRegistry as it does not correctly handle
- // service information. We cannot use unRegisterService unless
- // there is an EPR present so we re-register the first one.
- // Also findEPR and findEPRs should throw ServiceNotFoundException
- // after unRegister but MockRegistry does not support it.
+ // Test unregistering of service
registry.registerEPR(category, name, "Description", epr1, "EPR description") ;
assertEquals("unRegisterService count", 0, stats.getUnRegisterServiceCount()) ;
interceptor.unRegisterService(category, name) ;
@@ -165,7 +155,7 @@
final String name = "name" ;
final CachingRegistryInterceptor interceptor = new CachingRegistryInterceptor() ;
- final CacheRegistryConcurrencyInterceptor concurrency = new CacheRegistryConcurrencyInterceptor(new CyclicBarrier(numServices)) ;
+ final RegistryConcurrencyInterceptor concurrency = new RegistryConcurrencyInterceptor(new CyclicBarrier(numServices)) ;
final MockRegistry registry = new MockRegistry() ;
concurrency.setRegistry(registry) ;
interceptor.setRegistry(concurrency) ;
@@ -254,109 +244,6 @@
}
}
- private static final class CacheRegistryStatsInterceptor implements RegistryInterceptor
- {
- private Registry registry ;
- final AtomicInteger findAllServicesCount = new AtomicInteger() ;
- final AtomicInteger findEPRCount = new AtomicInteger() ;
- final AtomicInteger findEPRsCount = new AtomicInteger() ;
- final AtomicInteger findServicesCount = new AtomicInteger() ;
- final AtomicInteger registerEPRCount = new AtomicInteger() ;
- final AtomicInteger unRegisterEPRCount = new AtomicInteger() ;
- final AtomicInteger unRegisterServiceCount = new AtomicInteger() ;
-
- public List<String> findAllServices()
- throws RegistryException
- {
- findAllServicesCount.incrementAndGet() ;
- return registry.findAllServices() ;
- }
-
- public int getFindAllServicesCount()
- {
- return findAllServicesCount.get() ;
- }
-
- public EPR findEPR(final String serviceCategoryName, final String serviceName)
- throws RegistryException, ServiceNotFoundException
- {
- findEPRCount.incrementAndGet() ;
- return registry.findEPR(serviceCategoryName, serviceName) ;
- }
-
- public int getFindEPRCount()
- {
- return findEPRCount.get() ;
- }
-
- public List<EPR> findEPRs(final String serviceCategoryName, final String serviceName)
- throws RegistryException, ServiceNotFoundException
- {
- findEPRsCount.incrementAndGet() ;
- return registry.findEPRs(serviceCategoryName, serviceName) ;
- }
-
- public int getFindEPRsCount()
- {
- return findEPRsCount.get() ;
- }
-
- public List<String> findServices(final String serviceCategoryName)
- throws RegistryException
- {
- findServicesCount.incrementAndGet() ;
- return registry.findServices(serviceCategoryName) ;
- }
-
- public int getFindServicesCount()
- {
- return findServicesCount.get();
- }
-
- public void registerEPR(final String serviceCategoryName, final String serviceName,
- final String serviceDescription, final EPR epr, final String eprDescription)
- throws RegistryException
- {
- registerEPRCount.incrementAndGet() ;
- registry.registerEPR(serviceCategoryName, serviceName, serviceDescription, epr, eprDescription) ;
- }
-
- public int getRegisterEPRCount()
- {
- return registerEPRCount.get();
- }
-
- public void unRegisterEPR(final String serviceCategoryName,
- final String serviceName, final EPR epr)
- throws RegistryException, ServiceNotFoundException
- {
- unRegisterEPRCount.incrementAndGet() ;
- registry.unRegisterEPR(serviceCategoryName, serviceName, epr) ;
- }
-
- public int getUnRegisterEPRCount()
- {
- return unRegisterEPRCount.get();
- }
-
- public void unRegisterService(final String category, final String serviceName)
- throws RegistryException, ServiceNotFoundException
- {
- unRegisterServiceCount.incrementAndGet() ;
- registry.unRegisterService(category, serviceName) ;
- }
-
- public int getUnRegisterServiceCount()
- {
- return unRegisterServiceCount.get();
- }
-
- public void setRegistry(final Registry registry)
- {
- this.registry = registry ;
- }
- }
-
private static final class ConcurrencyTest extends Thread
{
private final CyclicBarrier barrier ;
@@ -393,97 +280,4 @@
return throwable ;
}
}
-
- private static final class CacheRegistryConcurrencyInterceptor implements RegistryInterceptor
- {
- private final CyclicBarrier barrier ;
-
- private volatile boolean timeout ;
- private Registry registry ;
- private final AtomicInteger findEPRsCount = new AtomicInteger() ;
-
- public CacheRegistryConcurrencyInterceptor(final CyclicBarrier barrier)
- {
- this.barrier = barrier ;
- }
-
- public List<String> findAllServices()
- throws RegistryException
- {
- return registry.findAllServices() ;
- }
-
- public EPR findEPR(final String serviceCategoryName, final String serviceName)
- throws RegistryException, ServiceNotFoundException
- {
- return registry.findEPR(serviceCategoryName, serviceName) ;
- }
-
- public List<EPR> findEPRs(final String serviceCategoryName, final String serviceName)
- throws RegistryException, ServiceNotFoundException
- {
- findEPRsCount.incrementAndGet() ;
- if (!timeout)
- {
- try
- {
- barrier.await(10, TimeUnit.SECONDS) ;
- }
- catch (final TimeoutException te)
- {
- timeout = true ;
- }
- catch (final InterruptedException ie)
- {
- throw new RegistryException("Interrupted", ie) ;
- }
- catch (final BrokenBarrierException bbe)
- {
- throw new RegistryException("Broken barrier", bbe) ;
- }
- }
- return registry.findEPRs(serviceCategoryName, serviceName) ;
- }
-
- public int getFindEPRsCount()
- {
- return findEPRsCount.get() ;
- }
-
- public boolean isTimeout()
- {
- return timeout ;
- }
-
- public List<String> findServices(final String serviceCategoryName)
- throws RegistryException
- {
- return registry.findServices(serviceCategoryName) ;
- }
-
- public void registerEPR(final String serviceCategoryName, final String serviceName,
- final String serviceDescription, final EPR epr, final String eprDescription)
- throws RegistryException
- {
- registry.registerEPR(serviceCategoryName, serviceName, serviceDescription, epr, eprDescription) ;
- }
-
- public void unRegisterEPR(final String serviceCategoryName,
- final String serviceName, final EPR epr)
- throws RegistryException, ServiceNotFoundException
- {
- registry.unRegisterEPR(serviceCategoryName, serviceName, epr) ;
- }
-
- public void unRegisterService(final String category, final String serviceName)
- throws RegistryException, ServiceNotFoundException
- {
- registry.unRegisterService(category, serviceName) ;
- }
-
- public void setRegistry(final Registry registry)
- {
- this.registry = registry ;
- }
- }
}
Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptorUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptorUnitTest.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptorUnitTest.java 2010-10-07 12:02:58 UTC (rev 35454)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.net.URI;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+
+/**
+ * Unit tests for the local registry interceptor
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+public class LocalRegistryInterceptorUnitTest extends TestCase
+{
+ /**
+ * Tests of caching, intended to run within the current cache validity period
+ */
+ public void testLocalRegistration()
+ throws Exception
+ {
+ final String category = "category" ;
+ final String name = "name" ;
+ final String missingCategory = "missingCategory" ;
+ final String missingName = "missingName" ;
+ final EPR epr1 = new EPR() ;
+ final EPR epr2 = new EPR() ;
+ final EPR epr3 = new EPR(URI.create("urn:test")) ;
+
+ final LocalRegistryInterceptor interceptor = new LocalRegistryInterceptor() ;
+ final RegistryStatsInterceptor stats = new RegistryStatsInterceptor() ;
+ final MockRegistry registry = new MockRegistry() ;
+ stats.setRegistry(registry) ;
+ interceptor.setRegistry(stats) ;
+
+ interceptor.registerEPR(category, name, "Description", epr1, "EPR description") ;
+
+ // findAllServices passes through to registry
+ assertEquals("findAllServices count", 0, stats.getFindAllServicesCount()) ;
+ interceptor.findAllServices() ;
+ assertEquals("findAllServices count", 1, stats.getFindAllServicesCount()) ;
+ interceptor.findAllServices() ;
+ assertEquals("findAllServices count", 2, stats.getFindAllServicesCount()) ;
+
+ // findServices passes through to registry
+ assertEquals("findServices count", 0, stats.getFindServicesCount()) ;
+ interceptor.findServices(category) ;
+ assertEquals("findServices count", 1, stats.getFindServicesCount()) ;
+ interceptor.findServices(category) ;
+ assertEquals("findServices count", 2, stats.getFindServicesCount()) ;
+
+ // findEPR/findEPRs go to registry if not present in the local registry interceptor
+ assertEquals("findEPRs count", 0, stats.getFindEPRsCount()) ;
+ interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 0, stats.getFindEPRsCount()) ;
+ interceptor.findEPRs(missingCategory, missingName) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ interceptor.findEPR(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertEquals("findEPR count", 0, stats.getFindEPRCount()) ;
+ try
+ {
+ interceptor.findEPR(missingCategory, missingName) ;
+ // The JAXR registry would return null here, the behaviour is not well defined
+ fail("Expected ServiceNotFoundException") ;
+ }
+ catch (final ServiceNotFoundException snfe) {} // ignore
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertEquals("findEPR count", 1, stats.getFindEPRCount()) ;
+
+ // registerEPR adds to local registry interceptor and then to registry
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertEquals("registerEPR count", 1, stats.getRegisterEPRCount()) ;
+ final List<EPR> registerOrigEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertNotNull("Original EPRs", registerOrigEPRs) ;
+ assertEquals("Original EPR count", 1, registerOrigEPRs.size()) ;
+ interceptor.registerEPR(category, name, "Description", epr2, "EPR description") ;
+ assertEquals("registerEPR count", 2, stats.getRegisterEPRCount()) ;
+ final List<EPR> duplicateEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertNotNull("Duplicate EPRs", duplicateEPRs) ;
+ assertEquals("Duplicate EPR count", 1, duplicateEPRs.size()) ;
+ interceptor.registerEPR(category, name, "Description", epr3, "EPR description") ;
+ assertEquals("registerEPR count", 3, stats.getRegisterEPRCount()) ;
+ final List<EPR> registerNewEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertNotNull("New EPRs", registerNewEPRs) ;
+ assertEquals("New EPR count", 2, registerNewEPRs.size()) ;
+
+ // unRegister removes from local registry interceptor and then registry
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertEquals("unRegisterEPR count", 0, stats.getUnRegisterEPRCount()) ;
+ final List<EPR> unRegisterOrigEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertNotNull("Original EPRs", unRegisterOrigEPRs) ;
+ assertEquals("Original EPR count", 2, unRegisterOrigEPRs.size()) ;
+ interceptor.unRegisterEPR(category, name, epr3) ;
+ assertEquals("unRegisterEPR count", 1, stats.getUnRegisterEPRCount()) ;
+ final List<EPR> unRegisterNewEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertNotNull("New EPRs", unRegisterNewEPRs) ;
+ assertEquals("New EPR count", 1, unRegisterNewEPRs.size()) ;
+ interceptor.unRegisterEPR(category, name, epr2) ;
+ assertEquals("unRegisterEPR count", 2, stats.getUnRegisterEPRCount()) ;
+ final List<EPR> unRegisterFinalEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
+ assertNotNull("Duplicate EPRs", unRegisterFinalEPRs) ;
+ assertEquals("Duplicate EPR count", 1, unRegisterFinalEPRs.size()) ;
+ interceptor.unRegisterEPR(category, name, epr1) ;
+ assertEquals("unRegisterEPR count", 3, stats.getUnRegisterEPRCount()) ;
+ final List<EPR> finalEPRs = interceptor.findEPRs(category, name) ;
+ assertEquals("findEPRs count", 2, stats.getFindEPRsCount()) ;
+ assertNotNull("Final EPRs", finalEPRs) ;
+ assertEquals("Final EPR count", 0, finalEPRs.size()) ;
+ EPR finalEPR = null ;
+ try
+ {
+ finalEPR = interceptor.findEPR(category, name) ;
+ // The JAXR registry would return null here, the behaviour is not well defined
+ fail("Expected ServiceNotFoundException") ;
+ }
+ catch (final ServiceNotFoundException snfe) {} // ignore
+ assertNull("Final EPR", finalEPR) ;
+ assertEquals("findEPR count", 2, stats.getFindEPRCount()) ;
+ assertEquals("findEPRs count", 2, stats.getFindEPRsCount()) ;
+
+ // Test unregistering of service
+ registry.registerEPR(category, name, "Description", epr1, "EPR description") ;
+ assertEquals("unRegisterService count", 0, stats.getUnRegisterServiceCount()) ;
+ interceptor.unRegisterService(category, name) ;
+ assertEquals("unRegisterService count", 1, stats.getUnRegisterServiceCount()) ;
+ try
+ {
+ interceptor.findEPR(category, name) ;
+ fail("Expected ServiceNotFoundException") ;
+ }
+ catch (final ServiceNotFoundException snfe) {} // ignore
+ }
+
+ /**
+ * Test concurrent access to next interceptor in chain.
+ * @throws Exception
+ */
+ public void testConcurrency()
+ throws Exception
+ {
+ final int numServices = 5 ;
+ final String category = "category" ;
+ final String name = "name" ;
+
+ final LocalRegistryInterceptor interceptor = new LocalRegistryInterceptor() ;
+ final RegistryConcurrencyInterceptor concurrency = new RegistryConcurrencyInterceptor(new CyclicBarrier(numServices)) ;
+ final MockRegistry registry = new MockRegistry() ;
+ concurrency.setRegistry(registry) ;
+ interceptor.setRegistry(concurrency) ;
+
+ final String[] names = new String[numServices] ;
+ for (int count = 0 ; count < numServices ; count++)
+ {
+ names[count] = name + count ;
+ interceptor.registerEPR(category, names[count], "description", new EPR(), "EPR description") ;
+ }
+ final int numThreads = numServices*2 ;
+
+ final CyclicBarrier barrier = new CyclicBarrier(numThreads) ;
+ final ConcurrencyTest[] tests = new ConcurrencyTest[numThreads] ;
+ for(int count = 0 ; count < numThreads ; count++)
+ {
+ tests[count] = new ConcurrencyTest(barrier, interceptor, category, names[count%numServices]) ;
+ tests[count].start() ;
+ }
+
+ for(int count = 0 ; count < numThreads ; count++)
+ {
+ tests[count].join();
+ }
+
+ for(int count = 0 ; count < numThreads ; count++)
+ {
+ assertNull("Throwable occurred", tests[count].getThrowable()) ;
+ }
+
+ assertEquals("Registry findEPRs invocation", 0, concurrency.getFindEPRsCount()) ;
+ assertFalse("Barrier timeout", concurrency.isTimeout()) ;
+ }
+
+ private static final class ConcurrencyTest extends Thread
+ {
+ private final CyclicBarrier barrier ;
+ private final Registry registry ;
+ private final String category ;
+ private final String name ;
+
+ private Throwable throwable ;
+
+ ConcurrencyTest(final CyclicBarrier barrier, final Registry registry,
+ final String category, final String name)
+ {
+ this.barrier = barrier ;
+ this.registry = registry ;
+ this.category = category ;
+ this.name = name ;
+ }
+
+ public void run()
+ {
+ try
+ {
+ barrier.await() ;
+ registry.findEPRs(category, name) ;
+ }
+ catch (final Throwable th)
+ {
+ throwable = th ;
+ }
+ }
+
+ Throwable getThrowable()
+ {
+ return throwable ;
+ }
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/LocalRegistryInterceptorUnitTest.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryConcurrencyInterceptor.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryConcurrencyInterceptor.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryConcurrencyInterceptor.java 2010-10-07 12:02:58 UTC (rev 35454)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.util.List;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.RegistryInterceptor;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+
+/**
+ * Concurrency test interceptor.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+class RegistryConcurrencyInterceptor implements RegistryInterceptor
+{
+ private final CyclicBarrier barrier ;
+
+ private volatile boolean timeout ;
+ private Registry registry ;
+ private final AtomicInteger findEPRsCount = new AtomicInteger() ;
+
+ public RegistryConcurrencyInterceptor(final CyclicBarrier barrier)
+ {
+ this.barrier = barrier ;
+ }
+
+ public List<String> findAllServices()
+ throws RegistryException
+ {
+ return registry.findAllServices() ;
+ }
+
+ public EPR findEPR(final String serviceCategoryName, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ return registry.findEPR(serviceCategoryName, serviceName) ;
+ }
+
+ public List<EPR> findEPRs(final String serviceCategoryName, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ findEPRsCount.incrementAndGet() ;
+ if (!timeout)
+ {
+ try
+ {
+ barrier.await(10, TimeUnit.SECONDS) ;
+ }
+ catch (final TimeoutException te)
+ {
+ timeout = true ;
+ }
+ catch (final InterruptedException ie)
+ {
+ throw new RegistryException("Interrupted", ie) ;
+ }
+ catch (final BrokenBarrierException bbe)
+ {
+ throw new RegistryException("Broken barrier", bbe) ;
+ }
+ }
+ return registry.findEPRs(serviceCategoryName, serviceName) ;
+ }
+
+ public int getFindEPRsCount()
+ {
+ return findEPRsCount.get() ;
+ }
+
+ public boolean isTimeout()
+ {
+ return timeout ;
+ }
+
+ public List<String> findServices(final String serviceCategoryName)
+ throws RegistryException
+ {
+ return registry.findServices(serviceCategoryName) ;
+ }
+
+ public void registerEPR(final String serviceCategoryName, final String serviceName,
+ final String serviceDescription, final EPR epr, final String eprDescription)
+ throws RegistryException
+ {
+ registry.registerEPR(serviceCategoryName, serviceName, serviceDescription, epr, eprDescription) ;
+ }
+
+ public void unRegisterEPR(final String serviceCategoryName,
+ final String serviceName, final EPR epr)
+ throws RegistryException, ServiceNotFoundException
+ {
+ registry.unRegisterEPR(serviceCategoryName, serviceName, epr) ;
+ }
+
+ public void unRegisterService(final String category, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ registry.unRegisterService(category, serviceName) ;
+ }
+
+ public void setRegistry(final Registry registry)
+ {
+ this.registry = registry ;
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryConcurrencyInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryStatsInterceptor.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryStatsInterceptor.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryStatsInterceptor.java 2010-10-07 12:02:58 UTC (rev 35454)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.RegistryInterceptor;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+
+/**
+ * Registry stats interceptor.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+class RegistryStatsInterceptor implements RegistryInterceptor
+{
+ private Registry registry ;
+ final AtomicInteger findAllServicesCount = new AtomicInteger() ;
+ final AtomicInteger findEPRCount = new AtomicInteger() ;
+ final AtomicInteger findEPRsCount = new AtomicInteger() ;
+ final AtomicInteger findServicesCount = new AtomicInteger() ;
+ final AtomicInteger registerEPRCount = new AtomicInteger() ;
+ final AtomicInteger unRegisterEPRCount = new AtomicInteger() ;
+ final AtomicInteger unRegisterServiceCount = new AtomicInteger() ;
+
+ public List<String> findAllServices()
+ throws RegistryException
+ {
+ findAllServicesCount.incrementAndGet() ;
+ return registry.findAllServices() ;
+ }
+
+ public int getFindAllServicesCount()
+ {
+ return findAllServicesCount.get() ;
+ }
+
+ public EPR findEPR(final String serviceCategoryName, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ findEPRCount.incrementAndGet() ;
+ return registry.findEPR(serviceCategoryName, serviceName) ;
+ }
+
+ public int getFindEPRCount()
+ {
+ return findEPRCount.get() ;
+ }
+
+ public List<EPR> findEPRs(final String serviceCategoryName, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ findEPRsCount.incrementAndGet() ;
+ return registry.findEPRs(serviceCategoryName, serviceName) ;
+ }
+
+ public int getFindEPRsCount()
+ {
+ return findEPRsCount.get() ;
+ }
+
+ public List<String> findServices(final String serviceCategoryName)
+ throws RegistryException
+ {
+ findServicesCount.incrementAndGet() ;
+ return registry.findServices(serviceCategoryName) ;
+ }
+
+ public int getFindServicesCount()
+ {
+ return findServicesCount.get();
+ }
+
+ public void registerEPR(final String serviceCategoryName, final String serviceName,
+ final String serviceDescription, final EPR epr, final String eprDescription)
+ throws RegistryException
+ {
+ registerEPRCount.incrementAndGet() ;
+ registry.registerEPR(serviceCategoryName, serviceName, serviceDescription, epr, eprDescription) ;
+ }
+
+ public int getRegisterEPRCount()
+ {
+ return registerEPRCount.get();
+ }
+
+ public void unRegisterEPR(final String serviceCategoryName,
+ final String serviceName, final EPR epr)
+ throws RegistryException, ServiceNotFoundException
+ {
+ unRegisterEPRCount.incrementAndGet() ;
+ registry.unRegisterEPR(serviceCategoryName, serviceName, epr) ;
+ }
+
+ public int getUnRegisterEPRCount()
+ {
+ return unRegisterEPRCount.get();
+ }
+
+ public void unRegisterService(final String category, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ unRegisterServiceCount.incrementAndGet() ;
+ registry.unRegisterService(category, serviceName) ;
+ }
+
+ public int getUnRegisterServiceCount()
+ {
+ return unRegisterServiceCount.get();
+ }
+
+ public void setRegistry(final Registry registry)
+ {
+ this.registry = registry ;
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/RegistryStatsInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list