@Test public void testCreateCacheEntitiesDisablesNonStop() throws Exception { repositoryService.createCacheEntities(Collections.singleton("testCacheManager"), Collections.singleton("testCache1"), Collections.singleton("Size")); verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrentThread(anyBoolean()); }
@Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder builder = null; Collection<CacheEntity> entities; cacheManagerSamplerRepoLock.readLock().lock(); List<SamplerRepoEntry> disabledSamplerRepoEntries = new ArrayList<SamplerRepoEntry>(); try { if (cacheManagerNames == null) { for (Map.Entry<String, SamplerRepoEntry> entry : cacheManagerSamplerRepo.entrySet()) { enableNonStopFor(entry.getValue(), false); disabledSamplerRepoEntries.add(entry.getValue()); for (CacheSampler sampler : entry.getValue().getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, entry.getKey()) : builder .add(sampler, entry.getKey()); } } } else { for (String cmName : cacheManagerNames) { SamplerRepoEntry entry = cacheManagerSamplerRepo.get(cmName); if (entry != null) { enableNonStopFor(entry, false); disabledSamplerRepoEntries.add(entry); for (CacheSampler sampler : entry.getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, cmName) : builder.add(sampler, cmName); } } } } if (builder == null) entities = new HashSet<CacheEntity>(0); else entities = attributes == null ? builder.build() : builder.add(attributes).build(); } finally { for (SamplerRepoEntry samplerRepoEntry : disabledSamplerRepoEntries) { enableNonStopFor(samplerRepoEntry, true); } cacheManagerSamplerRepoLock.readLock().unlock(); } return entities; }
DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
    DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder builder = null; Collection<CacheEntity> entities; cacheManagerSamplerRepoLock.readLock().lock(); List<SamplerRepoEntry> disabledSamplerRepoEntries = new ArrayList<SamplerRepoEntry>(); try { if (cacheManagerNames == null) { for (Map.Entry<String, SamplerRepoEntry> entry : cacheManagerSamplerRepo.entrySet()) { enableNonStopFor(entry.getValue(), false); disabledSamplerRepoEntries.add(entry.getValue()); for (CacheSampler sampler : entry.getValue().getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, entry.getKey()) : builder .add(sampler, entry.getKey()); } } } else { for (String cmName : cacheManagerNames) { SamplerRepoEntry entry = cacheManagerSamplerRepo.get(cmName); if (entry != null) { enableNonStopFor(entry, false); disabledSamplerRepoEntries.add(entry); for (CacheSampler sampler : entry.getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, cmName) : builder.add(sampler, cmName); } } } } if (builder == null) entities = new HashSet<CacheEntity>(0); else entities = attributes == null ? builder.build() : builder.add(attributes).build(); } finally { for (SamplerRepoEntry samplerRepoEntry : disabledSamplerRepoEntries) { enableNonStopFor(samplerRepoEntry, true); } cacheManagerSamplerRepoLock.readLock().unlock(); } return entities; } }
DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
    DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder builder = null; Collection<CacheEntity> entities; cacheManagerSamplerRepoLock.readLock().lock(); List<SamplerRepoEntry> disabledSamplerRepoEntries = new ArrayList<SamplerRepoEntry>(); try { if (cacheManagerNames == null) { for (Map.Entry<String, SamplerRepoEntry> entry : cacheManagerSamplerRepo.entrySet()) { enableNonStopFor(entry.getValue(), false); disabledSamplerRepoEntries.add(entry.getValue()); for (CacheSampler sampler : entry.getValue().getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, entry.getKey()) : builder .add(sampler, entry.getKey()); } } } else { for (String cmName : cacheManagerNames) { SamplerRepoEntry entry = cacheManagerSamplerRepo.get(cmName); if (entry != null) { enableNonStopFor(entry, false); disabledSamplerRepoEntries.add(entry); for (CacheSampler sampler : entry.getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, cmName) : builder.add(sampler, cmName); } } } } if (builder == null) entities = new HashSet<CacheEntity>(0); else entities = attributes == null ? builder.build() : builder.add(attributes).build(); } finally { for (SamplerRepoEntry samplerRepoEntry : disabledSamplerRepoEntries) { enableNonStopFor(samplerRepoEntry, true); } cacheManagerSamplerRepoLock.readLock().unlock(); } return entities; } DfltSamplerRepositoryService(String clientUUID, ManagementRESTServiceConfiguration configuration); }
DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
    DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder builder = null; Collection<CacheEntity> entities; cacheManagerSamplerRepoLock.readLock().lock(); List<SamplerRepoEntry> disabledSamplerRepoEntries = new ArrayList<SamplerRepoEntry>(); try { if (cacheManagerNames == null) { for (Map.Entry<String, SamplerRepoEntry> entry : cacheManagerSamplerRepo.entrySet()) { enableNonStopFor(entry.getValue(), false); disabledSamplerRepoEntries.add(entry.getValue()); for (CacheSampler sampler : entry.getValue().getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, entry.getKey()) : builder .add(sampler, entry.getKey()); } } } else { for (String cmName : cacheManagerNames) { SamplerRepoEntry entry = cacheManagerSamplerRepo.get(cmName); if (entry != null) { enableNonStopFor(entry, false); disabledSamplerRepoEntries.add(entry); for (CacheSampler sampler : entry.getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, cmName) : builder.add(sampler, cmName); } } } } if (builder == null) entities = new HashSet<CacheEntity>(0); else entities = attributes == null ? builder.build() : builder.add(attributes).build(); } finally { for (SamplerRepoEntry samplerRepoEntry : disabledSamplerRepoEntries) { enableNonStopFor(samplerRepoEntry, true); } cacheManagerSamplerRepoLock.readLock().unlock(); } return entities; } DfltSamplerRepositoryService(String clientUUID, ManagementRESTServiceConfiguration configuration); @Override final synchronized void registerMBean(String clientUUID); @Override void dispose(); @Override byte[] invoke(RemoteCallDescriptor remoteCallDescriptor); @Override String getVersion(); @Override String getAgency(); @Override void register(CacheManager cacheManager); void unregister(CacheManager cacheManager); @Override boolean hasRegistered(); @Override Collection<CacheManagerEntity> createCacheManagerEntities(Set<String> cacheManagerNames,
                                                                   Set<String> attributes); @Override Collection<CacheManagerConfigEntity> createCacheManagerConfigEntities(Set<String> cacheManagerNames); @Override Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames,
                                                     Set<String> cacheNames,
                                                     Set<String> attributes); @Override Collection<CacheConfigEntity> createCacheConfigEntities(Set<String> cacheManagerNames,
                                                                 Set<String> cacheNames); @Override Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> cacheManagerNames,
                                                                                 Set<String> cacheNames,
                                                                                 Set<String> sampleNames); @Override void createOrUpdateCache(String cacheManagerName,
                                  String cacheName,
                                  CacheEntity resource); @Override void clearCache(String cacheManagerName,
                         String cacheName); @Override void updateCacheManager(String cacheManagerName,
                                 CacheManagerEntity resource); @Override Collection<QueryResultsEntity> executeQuery(String cacheManagerName, String queryString); @Override Collection<AgentEntity> getAgents(Set<String> ids); @Override Collection<AgentMetadataEntity> getAgentsMetadata(Set<String> ids); }
DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
    DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder builder = null; Collection<CacheEntity> entities; cacheManagerSamplerRepoLock.readLock().lock(); List<SamplerRepoEntry> disabledSamplerRepoEntries = new ArrayList<SamplerRepoEntry>(); try { if (cacheManagerNames == null) { for (Map.Entry<String, SamplerRepoEntry> entry : cacheManagerSamplerRepo.entrySet()) { enableNonStopFor(entry.getValue(), false); disabledSamplerRepoEntries.add(entry.getValue()); for (CacheSampler sampler : entry.getValue().getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, entry.getKey()) : builder .add(sampler, entry.getKey()); } } } else { for (String cmName : cacheManagerNames) { SamplerRepoEntry entry = cacheManagerSamplerRepo.get(cmName); if (entry != null) { enableNonStopFor(entry, false); disabledSamplerRepoEntries.add(entry); for (CacheSampler sampler : entry.getComprehensiveCacheSamplers(cacheNames)) { builder = builder == null ? CacheEntityBuilder.createWith(sampler, cmName) : builder.add(sampler, cmName); } } } } if (builder == null) entities = new HashSet<CacheEntity>(0); else entities = attributes == null ? builder.build() : builder.add(attributes).build(); } finally { for (SamplerRepoEntry samplerRepoEntry : disabledSamplerRepoEntries) { enableNonStopFor(samplerRepoEntry, true); } cacheManagerSamplerRepoLock.readLock().unlock(); } return entities; } DfltSamplerRepositoryService(String clientUUID, ManagementRESTServiceConfiguration configuration); @Override final synchronized void registerMBean(String clientUUID); @Override void dispose(); @Override byte[] invoke(RemoteCallDescriptor remoteCallDescriptor); @Override String getVersion(); @Override String getAgency(); @Override void register(CacheManager cacheManager); void unregister(CacheManager cacheManager); @Override boolean hasRegistered(); @Override Collection<CacheManagerEntity> createCacheManagerEntities(Set<String> cacheManagerNames,
                                                                   Set<String> attributes); @Override Collection<CacheManagerConfigEntity> createCacheManagerConfigEntities(Set<String> cacheManagerNames); @Override Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames,
                                                     Set<String> cacheNames,
                                                     Set<String> attributes); @Override Collection<CacheConfigEntity> createCacheConfigEntities(Set<String> cacheManagerNames,
                                                                 Set<String> cacheNames); @Override Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> cacheManagerNames,
                                                                                 Set<String> cacheNames,
                                                                                 Set<String> sampleNames); @Override void createOrUpdateCache(String cacheManagerName,
                                  String cacheName,
                                  CacheEntity resource); @Override void clearCache(String cacheManagerName,
                         String cacheName); @Override void updateCacheManager(String cacheManagerName,
                                 CacheManagerEntity resource); @Override Collection<QueryResultsEntity> executeQuery(String cacheManagerName, String queryString); @Override Collection<AgentEntity> getAgents(Set<String> ids); @Override Collection<AgentMetadataEntity> getAgentsMetadata(Set<String> ids); static final String MBEAN_NAME_PREFIX; static final String AGENCY; }