Asking doc deletion when finding disabled feeds

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-data-indexer-se-plugin@124214 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-02-16 13:44:08 +00:00
parent 2c31e3fbd1
commit 7e645cec61
3 changed files with 27 additions and 7 deletions

16
pom.xml
View File

@ -40,6 +40,12 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>[3.0.1, 4.0.0)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.socialnetworking</groupId>
<artifactId>social-data-indexing-common</artifactId>
@ -88,6 +94,16 @@
<groupId>com.netflix.astyanax</groupId>
<artifactId>astyanax</artifactId>
<version>1.56.26</version>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>

View File

@ -135,15 +135,13 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
} catch (UnknownHostException e) {
logger.debug("Error while adding " + hostsToContact.get(i) + ":" + portNumbers.get(i) + " as host to be contacted.");
logger.error("Error while adding " + hostsToContact.get(i) + ":" + portNumbers.get(i) + " as host to be contacted.");
return;
}
}
logger.debug("Connection to ElasticSearch cluster done.");
logger.debug("Synchronization starts running");
logger.debug("Connection to ElasticSearch cluster done. Synchronization starts running...");
long init = System.currentTimeMillis();
@ -189,8 +187,11 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
@Override
protected void finalize(){
// close connection
if(client != null)
if(client != null){
logger.debug("Closing connection to elasticsearch cluster. " + client.toString());
client.close();
}
}
/**
@ -252,6 +253,7 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
BackoffPolicy.exponentialBackoff(TimeValue.timeValueMillis(50), 8))
.build();
// save feeds
for (int i= 0 ; i < enhanceFeeds.size(); i++) {
String enhFeedUUID = null;
@ -334,7 +336,7 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
* @return
*/
private ArrayList<Comment> getAllCommentsByFeed(String feedid) {
logger.trace("Asking comments for " + feedid);
logger.debug("Asking comments for " + feedid);
ArrayList<Comment> toReturn = (ArrayList<Comment>) store.getAllCommentByFeed(feedid);
Collections.sort(toReturn);
return toReturn;
@ -354,6 +356,7 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
DeleteResponse response = client.prepareDelete(IndexFields.INDEX_NAME, IndexFields.EF_FEEDS_TABLE, docID).get();
logger.debug("doc found? " + response.isFound());
return response.isFound();
}

View File

@ -23,7 +23,8 @@ public class Tests {
Map<String, Object> inputs = new HashMap<String, Object>();
inputs.put("scope", "gcube");
SocialDataIndexerPlugin plugin = new SocialDataIndexerPlugin(null);
plugin.launch(inputs); //TODO: uncomment for testing purpose
//uncomment for testing purpose
//plugin.launch(inputs);
logger.debug("-------------- launch test finished");
}