Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
removed some unnecessary synchronizations
Michael Peter Christen442ed50be0fb
diff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.javaindex 2fe59c672..85f5b64f8 100644--- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java@@ -102,7 +102,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo* because we can do this with more efficiently in a different way for embedded indexes.*/@Override- public synchronized long getSize() {+ public long getSize() {String threadname = Thread.currentThread().getName();Thread.currentThread().setName("solr query: size");EmbeddedSolrServer ess = (EmbeddedSolrServer) this.server;@@ -154,7 +154,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCoreturn req;}- public synchronized SolrQueryResponse query(SolrQueryRequest req) throws SolrException {+ public SolrQueryResponse query(SolrQueryRequest req) throws SolrException {final long startTime = System.currentTimeMillis();// during the solr query we set the thread name to the query string to get more debugging info in thread dumps@@ -191,9 +191,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCoString threadname = Thread.currentThread().getName();if (q != null) Thread.currentThread().setName("solr query: q = " + q);QueryResponse rsp;- synchronized (this) {- rsp = this.server.query(params);- }+ rsp = this.server.query(params);if (q != null) Thread.currentThread().setName(threadname);if (rsp != null) log.info(rsp.getResults().getNumFound() + " results for q=" + q);return rsp;diff --git a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.javaindex ce7d97680..fbfa7497c 100644--- a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java@@ -91,7 +91,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen}@Override- public synchronized long getSize() {+ public long getSize() {try {final QueryResponse rsp = getResponseByParams(AbstractSolrConnector.catchSuccessQuery);if (rsp == null) return 0;@@ -119,7 +119,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen}@Override- public synchronized void deleteById(final String id) throws IOException {+ public void deleteById(final String id) throws IOException {try {this.server.deleteById(id, -1);} catch (final Throwable e) {@@ -128,7 +128,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen}@Override- public synchronized void deleteByIds(final Collection<String> ids) throws IOException {+ public void deleteByIds(final Collection<String> ids) throws IOException {List<String> l = new ArrayList<String>();for (String s: ids) l.add(s);try {@@ -144,7 +144,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen* @throws IOException*/@Override- public synchronized void deleteByQuery(final String querystring) throws IOException {+ public void deleteByQuery(final String querystring) throws IOException {try {this.server.deleteByQuery(querystring, -1);} catch (final Throwable e) {@@ -161,9 +161,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemenup.setCommitWithin(-1);//up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);try {- synchronized (this.server) {- this.server.request(up);- }+ this.server.request(up);} catch (final Throwable e) {throw new IOException(e);}@@ -174,20 +172,14 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemenif (this.server == null) return;try {if (solrdoc.containsKey("_version_")) solrdoc.setField("_version_",0L); // prevent Solr "version conflict"- synchronized (this.server) {this.server.add(solrdoc, -1);- }} catch (Throwable e) {// catches "version conflict for": try this again and delete the document in advancetry {- synchronized (this.server) {- this.server.deleteById((String) solrdoc.getFieldValue(CollectionSchema.id.getSolrFieldName()));- }+ this.server.deleteById((String) solrdoc.getFieldValue(CollectionSchema.id.getSolrFieldName()));} catch (SolrServerException e1) {}try {- synchronized (this.server) {- this.server.add(solrdoc, -1);- }+ this.server.add(solrdoc, -1);} catch (Throwable ee) {throw new IOException(ee);}@@ -201,22 +193,16 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemenfor (SolrInputDocument solrdoc : solrdocs) {if (solrdoc.containsKey("_version_")) solrdoc.setField("_version_",0L); // prevent Solr "version conflict"}- synchronized (this.server) {- this.server.add(solrdocs, -1);- }+ this.server.add(solrdocs, -1);} catch (Throwable e) {// catches "version conflict for": try this again and delete the document in advanceList<String> ids = new ArrayList<String>();for (SolrInputDocument solrdoc : solrdocs) ids.add((String) solrdoc.getFieldValue(CollectionSchema.id.getSolrFieldName()));try {- synchronized (this.server) {- this.server.deleteById(ids);- }+ this.server.deleteById(ids);} catch (SolrServerException e1) {}try {- synchronized (this.server) {- this.server.add(solrdocs, -1);- }+ this.server.add(solrdocs, -1);} catch (Throwable ee) {log.warn(e.getMessage() + " IDs=" + ids.toString());throw new IOException(ee);