Skip to content
Snippets Groups Projects
Commit b444222e authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Do not run 'index' task as async, if not a local ES node

parent 19f71086
No related branches found
No related tags found
No related merge requests found
......@@ -525,6 +525,34 @@
<version>0.12</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-optional</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b2</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
......
uCoinj Cesium
=============
## Test it
```bash
cd src/main/cesium
ionic serve
```
......@@ -11,5 +11,4 @@
<artifactId>ucoinj-cesium</artifactId>
</project>
\ No newline at end of file
......@@ -43,10 +43,8 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
public class Main {
......@@ -127,7 +125,6 @@ public class Main {
shutdown();
log.info("uCoinj :: ElasticSearch Indexer successfully stopped");
//System.exit(-1);
}
/* -- protected methods -- */
......
......@@ -24,7 +24,6 @@ package io.ucoin.ucoinj.elasticsearch.action;
* #L%
*/
import io.ucoin.ucoinj.core.client.model.bma.BlockchainBlock;
import io.ucoin.ucoinj.core.client.model.bma.BlockchainParameters;
import io.ucoin.ucoinj.core.client.model.local.Peer;
import io.ucoin.ucoinj.core.client.service.bma.BlockchainRemoteService;
......@@ -41,6 +40,8 @@ public class IndexerAction {
public void indexLastBlocks() {
boolean async = ServiceLocator.instance().getElasticSearchService().isNodeInstance();
Runnable runnable = new Runnable() {
@Override
public void run() {
......@@ -52,9 +53,17 @@ public class IndexerAction {
}
};
// Async execution
if (async) {
ServiceLocator.instance().getExecutorService().execute(runnable);
}
// Synchrone execution
else {
runnable.run();
}
}
public void resetAllBlocks() {
BlockchainRemoteService blockchainService = ServiceLocator.instance().getBlockchainRemoteService();
BlockIndexerService indexerService = ServiceLocator.instance().getBlockIndexerService();
......
......@@ -88,6 +88,10 @@ public class ElasticSearchService implements Bean,InitializingBean, Closeable {
config.isLocal());
}
public boolean isNodeInstance() {
return node != null && !localNode;
}
public void startNode(boolean enableHttp, boolean local) {
if (node != null && !localNode) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment