geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [geode] branch feature/GEODE-3926_2 updated: Spotless
Date Wed, 14 Mar 2018 23:06:18 GMT
This is an automated email from the ASF dual-hosted git repository.

udo pushed a commit to branch feature/GEODE-3926_2
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-3926_2 by this push:
     new 778ea2c  Spotless
778ea2c is described below

commit 778ea2cef1a52c2da9458addf34b49e1d338b3f4
Author: Udo <ukohlmeyer@pivotal.io>
AuthorDate: Wed Mar 14 16:06:06 2018 -0700

    Spotless
---
 .../lucene/internal/IndexRepositoryFactory.java    | 11 ++----
 .../cache/lucene/internal/LuceneEventListener.java |  3 +-
 .../internal/LuceneIndexForPartitionedRegion.java  | 35 +++++++-----------
 .../lucene/internal/LuceneIndexImplFactory.java    | 11 ++----
 .../cache/lucene/internal/LuceneServiceImpl.java   | 43 +++++++++-------------
 .../internal/PartitionedRepositoryManager.java     |  6 +--
 .../internal/RawLuceneRepositoryManager.java       |  3 +-
 .../lucene/internal/LuceneIndexFactorySpy.java     |  9 ++---
 .../LuceneIndexRecoveryHAIntegrationTest.java      | 16 +++++---
 9 files changed, 57 insertions(+), 80 deletions(-)

diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
index 4bf796b..fcb1620 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
@@ -45,16 +45,13 @@ public class IndexRepositoryFactory {
   private static final Logger logger = LogService.getLogger();
   public static final String APACHE_GEODE_INDEX_COMPLETE = "APACHE_GEODE_INDEX_COMPLETE";
 
-  public IndexRepositoryFactory() {
-  }
+  public IndexRepositoryFactory() {}
 
   public IndexRepository computeIndexRepository(final Integer bucketId, LuceneSerializer
serializer,
-                                                InternalLuceneIndex index,
-                                                PartitionedRegion userRegion,
-                                                final IndexRepository oldRepository)
+      InternalLuceneIndex index, PartitionedRegion userRegion, final IndexRepository oldRepository)
       throws IOException {
-    return ((LuceneIndexForPartitionedRegion) index)
-        .computeIndexRepository(bucketId, serializer, userRegion, oldRepository);
+    return ((LuceneIndexForPartitionedRegion) index).computeIndexRepository(bucketId, serializer,
+        userRegion, oldRepository);
   }
 
 
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
index 7f5e2b0..db44981 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
@@ -41,8 +41,7 @@ import org.apache.geode.internal.logging.LogService;
 /**
  * An Async event queue listener that writes all of the events in batches to Lucene
  */
-public class
-LuceneEventListener implements AsyncEventListener {
+public class LuceneEventListener implements AsyncEventListener {
 
   private static LuceneExceptionObserver exceptionObserver = exception -> {
   };
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index 8f2f08c..0f5fda4 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -85,11 +85,9 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
   }
 
   public LuceneIndexForPartitionedRegion(String indexName, String regionPath, InternalCache
cache,
-                                         Analyzer analyzer,
-                                         Map<String, Analyzer> fieldAnalyzers,
-                                         LuceneSerializer serializer, RegionAttributes attributes,
-                                         String aeqId, String[] fields,
-                                         ExecutorService waitingThreadPool) {
+      Analyzer analyzer, Map<String, Analyzer> fieldAnalyzers, LuceneSerializer serializer,
+      RegionAttributes attributes, String aeqId, String[] fields,
+      ExecutorService waitingThreadPool) {
     this(indexName, regionPath, cache);
     this.waitingThreadPool = waitingThreadPool;
     this.setSearchableFields(fields);
@@ -184,11 +182,9 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl
{
   }
 
   protected <K, V> Region<K, V> createRegion(final String regionName,
-                                             final RegionShortcut regionShortCut,
-                                             final String colocatedWithRegionName,
-                                             final PartitionAttributes partitionAttributes,
-                                             final RegionAttributes regionAttributes,
-                                             PartitionListener lucenePrimaryBucketListener)
{
+      final RegionShortcut regionShortCut, final String colocatedWithRegionName,
+      final PartitionAttributes partitionAttributes, final RegionAttributes regionAttributes,
+      PartitionListener lucenePrimaryBucketListener) {
     PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
     if (lucenePrimaryBucketListener != null) {
       partitionAttributesFactory.addPartitionListener(lucenePrimaryBucketListener);
@@ -208,13 +204,12 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl
{
     return createRegion(regionName, attributes);
   }
 
-  public void close() {
-  }
+  public void close() {}
 
   @Override
   public void dumpFiles(final String directory) {
     ResultCollector results = FunctionService.onRegion(getDataRegion())
-        .setArguments(new String[]{directory, indexName}).execute(DumpDirectoryFiles.ID);
+        .setArguments(new String[] {directory, indexName}).execute(DumpDirectoryFiles.ID);
     results.getResult();
   }
 
@@ -288,9 +283,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
   }
 
   public IndexRepository computeIndexRepository(final Integer bucketId, LuceneSerializer
serializer,
-                                                PartitionedRegion userRegion,
-                                                final IndexRepository oldRepository)
-      throws IOException {
+      PartitionedRegion userRegion, final IndexRepository oldRepository) throws IOException
{
     final PartitionedRegion fileRegion = getFileAndChunkRegion();
     BucketRegion fileAndChunkBucket = getFileBucketRegion(bucketId, fileRegion);
 
@@ -327,12 +320,11 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl
{
     try {
       // bucketTargetingMap handles partition resolver (via bucketId as callbackArg)
       Map bucketTargetingMap = getBucketTargetingMap(fileAndChunkBucket, bucketId);
-      RegionDirectory dir =
-          new RegionDirectory(bucketTargetingMap, getFileSystemStats());
+      RegionDirectory dir = new RegionDirectory(bucketTargetingMap, getFileSystemStats());
       IndexWriterConfig config = new IndexWriterConfig(getAnalyzer());
       IndexWriter writer = new IndexWriter(dir, config);
-      repo = new IndexRepositoryImpl(fileAndChunkBucket, writer, serializer,
-          getIndexStats(), dataBucket, lockService, lockName, this);
+      repo = new IndexRepositoryImpl(fileAndChunkBucket, writer, serializer, getIndexStats(),
+          dataBucket, lockService, lockName, this);
       success = false;
       // fileRegion ops (get/put) need bucketId as a callbackArg for PartitionResolver
       if (null != fileRegion.get(APACHE_GEODE_INDEX_COMPLETE, bucketId)) {
@@ -370,8 +362,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
   }
 
   private boolean reindexUserDataRegion(Integer bucketId, PartitionedRegion userRegion,
-                                        PartitionedRegion fileRegion, BucketRegion dataBucket,
-                                        IndexRepository repo)
+      PartitionedRegion fileRegion, BucketRegion dataBucket, IndexRepository repo)
       throws IOException {
     Set<IndexRepository> affectedRepos = new HashSet<IndexRepository>();
 
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
index 74656d1..aeb6054 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
@@ -25,19 +25,16 @@ import org.apache.geode.internal.cache.InternalCache;
 
 public class LuceneIndexImplFactory {
 
-  public LuceneIndexImplFactory() {
-  }
+  public LuceneIndexImplFactory() {}
 
   public LuceneIndexImpl create(String indexName, String regionPath, InternalCache cache)
{
     return new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
   }
 
   public LuceneIndexImpl create(String indexName, String regionPath, InternalCache cache,
-                                Analyzer analyzer,
-                                Map<String, Analyzer> fieldAnalyzers,
-                                LuceneSerializer serializer, RegionAttributes attributes,
-                                String aeqId,
-                                String[] fields, ExecutorService waitingThreadPool) {
+      Analyzer analyzer, Map<String, Analyzer> fieldAnalyzers, LuceneSerializer serializer,
+      RegionAttributes attributes, String aeqId, String[] fields,
+      ExecutorService waitingThreadPool) {
     return new LuceneIndexForPartitionedRegion(indexName, regionPath, cache, analyzer,
         fieldAnalyzers, serializer, attributes, aeqId, fields, waitingThreadPool);
   }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
index bd9144c..1f8184c 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
@@ -82,6 +82,7 @@ import org.apache.geode.management.internal.beans.CacheServiceMBeanBase;
 
 /**
  * Implementation of LuceneService to create lucene index and query.
+ *
  * @since GemFire 8.5
  */
 public class LuceneServiceImpl implements InternalLuceneService {
@@ -96,8 +97,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
       Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "luceneReindex");
   private DistributionManager dm;
 
-  public LuceneServiceImpl() {
-  }
+  public LuceneServiceImpl() {}
 
   @Override
   public org.apache.geode.cache.lucene.LuceneIndexFactory createIndexFactory() {
@@ -171,12 +171,12 @@ public class LuceneServiceImpl implements InternalLuceneService {
   }
 
   public static String getUniqueIndexRegionName(String indexName, String regionPath,
-                                                String regionSuffix) {
+      String regionSuffix) {
     return getUniqueIndexName(indexName, regionPath) + regionSuffix;
   }
 
   public void createIndex(String indexName, String regionPath, Map<String, Analyzer>
fieldAnalyzers,
-                          LuceneSerializer serializer, boolean allowOnExistingRegion) {
+      LuceneSerializer serializer, boolean allowOnExistingRegion) {
     if (fieldAnalyzers == null || fieldAnalyzers.isEmpty()) {
       throw new IllegalArgumentException("At least one field must be indexed");
     }
@@ -189,9 +189,8 @@ public class LuceneServiceImpl implements InternalLuceneService {
   }
 
   public void createIndex(final String indexName, String regionPath, final Analyzer analyzer,
-                          final Map<String, Analyzer> fieldAnalyzers,
-                          final LuceneSerializer serializer,
-                          boolean allowOnExistingRegion, final String... fields) {
+      final Map<String, Analyzer> fieldAnalyzers, final LuceneSerializer serializer,
+      boolean allowOnExistingRegion, final String... fields) {
 
     if (!regionPath.startsWith("/")) {
       regionPath = "/" + regionPath;
@@ -221,9 +220,8 @@ public class LuceneServiceImpl implements InternalLuceneService {
   }
 
   private void createIndexOnExistingRegion(PartitionedRegion region, String indexName,
-                                           String regionPath, String[] fields, Analyzer analyzer,
-                                           Map<String, Analyzer> fieldAnalyzers,
-                                           LuceneSerializer serializer) {
+      String regionPath, String[] fields, Analyzer analyzer, Map<String, Analyzer>
fieldAnalyzers,
+      LuceneSerializer serializer) {
     validateRegionAttributes(region.getAttributes());
 
     String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
@@ -242,7 +240,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
   }
 
   protected boolean createLuceneIndexOnDataRegion(final PartitionedRegion userRegion,
-                                                  final InternalLuceneIndex luceneIndex)
{
+      final InternalLuceneIndex luceneIndex) {
     try {
       PartitionedRepositoryManager repositoryManager =
           (PartitionedRepositoryManager) luceneIndex.getRepositoryManager();
@@ -323,27 +321,22 @@ public class LuceneServiceImpl implements InternalLuceneService {
   }
 
   public LuceneIndexImpl beforeDataRegionCreated(final String indexName, final String regionPath,
-                                                 RegionAttributes attributes,
-                                                 final Analyzer analyzer,
-                                                 final Map<String, Analyzer> fieldAnalyzers,
-                                                 String aeqId, final LuceneSerializer serializer,
-                                                 final String... fields) {
+      RegionAttributes attributes, final Analyzer analyzer,
+      final Map<String, Analyzer> fieldAnalyzers, String aeqId, final LuceneSerializer
serializer,
+      final String... fields) {
     return createIndexObject(indexName, regionPath, fields, analyzer, fieldAnalyzers, serializer,
         attributes, aeqId);
   }
 
   private LuceneIndexImpl createIndexObject(String indexName, String regionPath, String[]
fields,
-                                            Analyzer analyzer,
-                                            Map<String, Analyzer> fieldAnalyzers,
-                                            LuceneSerializer serializer,
-                                            RegionAttributes attributes, String aeqId) {
-    return luceneIndexFactory
-        .create(indexName, regionPath, cache, analyzer, fieldAnalyzers, serializer, attributes,
-            aeqId, fields, dm.getWaitingThreadPool());
+      Analyzer analyzer, Map<String, Analyzer> fieldAnalyzers, LuceneSerializer serializer,
+      RegionAttributes attributes, String aeqId) {
+    return luceneIndexFactory.create(indexName, regionPath, cache, analyzer, fieldAnalyzers,
+        serializer, attributes, aeqId, fields, dm.getWaitingThreadPool());
   }
 
   private void registerDefinedIndex(final String indexName, final String regionPath,
-                                    final LuceneIndexCreationProfile luceneIndexCreationProfile)
{
+      final LuceneIndexCreationProfile luceneIndexCreationProfile) {
     String regionAndIndex = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
     if (definedIndexMap.containsKey(regionAndIndex) || indexMap.containsKey(regionAndIndex))
{
       throw new LuceneIndexExistsException(indexName, regionPath);
@@ -538,7 +531,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
     }
   }
 
-  //Public for test purposes
+  // Public for test purposes
   public static void registerDataSerializables() {
     DSFIDFactory.registerDSFID(DataSerializableFixedID.LUCENE_CHUNK_KEY, ChunkKey.class);
 
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
index a6e8402..f0f0045 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
@@ -64,7 +64,7 @@ public class PartitionedRepositoryManager implements RepositoryManager {
   private final ExecutorService waitingThreadPoolFromDM;
 
   public PartitionedRepositoryManager(InternalLuceneIndex index, LuceneSerializer serializer,
-                                      ExecutorService waitingThreadPool) {
+      ExecutorService waitingThreadPool) {
     this.index = index;
     this.serializer = serializer;
     this.closed = false;
@@ -138,9 +138,7 @@ public class PartitionedRepositoryManager implements RepositoryManager
{
   }
 
   protected IndexRepository computeRepository(Integer bucketId, LuceneSerializer serializer,
-                                              InternalLuceneIndex index,
-                                              PartitionedRegion userRegion,
-                                              IndexRepository oldRepository)
+      InternalLuceneIndex index, PartitionedRegion userRegion, IndexRepository oldRepository)
       throws IOException {
     return indexRepositoryFactory.computeIndexRepository(bucketId, serializer, index, userRegion,
         oldRepository);
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
index f47e11e..2bb94a5 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
@@ -15,6 +15,7 @@
 package org.apache.geode.cache.lucene.internal;
 
 import java.io.IOException;
+import java.util.concurrent.Executors;
 
 import org.apache.geode.cache.lucene.LuceneSerializer;
 import org.apache.geode.cache.lucene.internal.repository.IndexRepository;
@@ -25,7 +26,7 @@ public class RawLuceneRepositoryManager extends PartitionedRepositoryManager
{
   public static IndexRepositoryFactory indexRepositoryFactory = new RawIndexRepositoryFactory();
 
   public RawLuceneRepositoryManager(LuceneIndexImpl index, LuceneSerializer serializer) {
-    super(index, serializer);
+    super(index, serializer, Executors.newSingleThreadExecutor());
   }
 
   @Override
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
index fa8d7d8..bb38ed3 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
@@ -42,12 +42,9 @@ public class LuceneIndexFactorySpy extends LuceneIndexImplFactory {
 
   @Override
   public LuceneIndexImpl create(String indexName, String regionPath, InternalCache cache,
-                                Analyzer analyzer,
-                                Map<String, Analyzer> fieldAnalyzers,
-                                LuceneSerializer serializer,
-                                RegionAttributes attributes,
-                                String aeqId, String[] fields,
-                                ExecutorService waitingThreadPool) {
+      Analyzer analyzer, Map<String, Analyzer> fieldAnalyzers, LuceneSerializer serializer,
+      RegionAttributes attributes, String aeqId, String[] fields,
+      ExecutorService waitingThreadPool) {
     LuceneIndexForPartitionedRegion index =
         Mockito.spy(new ExtendedLuceneIndexForPartitionedRegion(indexName, regionPath, cache));
     return index;
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
index 0f67cb6..0381c16 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
+import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.lucene.analysis.Analyzer;
@@ -44,7 +45,7 @@ import org.apache.geode.test.junit.categories.LuceneTest;
 
 @Category({IntegrationTest.class, LuceneTest.class})
 public class LuceneIndexRecoveryHAIntegrationTest {
-  String[] indexedFields = new String[] {"txt"};
+  String[] indexedFields = new String[]{"txt"};
   HeterogeneousLuceneSerializer mapper = new HeterogeneousLuceneSerializer();
   Analyzer analyzer = new StandardAnalyzer();
 
@@ -54,7 +55,7 @@ public class LuceneIndexRecoveryHAIntegrationTest {
 
   @Before
   public void setup() {
-    indexedFields = new String[] {"txt"};
+    indexedFields = new String[]{"txt"};
     mapper = new HeterogeneousLuceneSerializer();
     analyzer = new StandardAnalyzer();
     LuceneServiceImpl.registerDataSerializables();
@@ -91,7 +92,10 @@ public class LuceneIndexRecoveryHAIntegrationTest {
     userRegion.put("rebalance", "test");
     service.waitUntilFlushed("index1", "userRegion", 30000, TimeUnit.MILLISECONDS);
 
-    RepositoryManager manager = new PartitionedRepositoryManager((LuceneIndexImpl) index,
mapper);
+    RepositoryManager
+        manager =
+        new PartitionedRepositoryManager((LuceneIndexImpl) index, mapper,
+            Executors.newSingleThreadExecutor());
     IndexRepository repo = manager.getRepository(userRegion, 0, null);
     assertNotNull(repo);
 
@@ -106,14 +110,14 @@ public class LuceneIndexRecoveryHAIntegrationTest {
 
     userRegion = (PartitionedRegion) regionfactory.create("userRegion");
     userRegion.put("rebalance", "test");
-    manager = new PartitionedRepositoryManager((LuceneIndexImpl) index, mapper);
+    manager =
+        new PartitionedRepositoryManager((LuceneIndexImpl) index, mapper,
+            Executors.newSingleThreadExecutor());
     IndexRepository newRepo = manager.getRepository(userRegion, 0, null);
 
     Assert.assertNotEquals(newRepo, repo);
   }
 
-
-
   private void verifyIndexFinishFlushing(String indexName, String regionName)
       throws InterruptedException {
     LuceneService service = LuceneServiceProvider.get(cache);

-- 
To stop receiving notification emails like this one, please contact
udo@apache.org.

Mime
View raw message