Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Orbiter committed Aug 17, 2012
1 parent f9fc5cf commit d54b803
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions htroot/IndexFederated_p.java
Expand Up @@ -32,7 +32,7 @@
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.services.federated.solr.ShardSelection;
import net.yacy.cora.services.federated.solr.ShardSolrConnector;
import net.yacy.cora.services.federated.solr.SingleSolrConnector;
import net.yacy.cora.services.federated.solr.RemoteSolrConnector;
import net.yacy.cora.services.federated.solr.SolrConnector;
import net.yacy.cora.storage.ConfigurationSet;
import net.yacy.kelondro.logging.Log;
Expand Down Expand Up @@ -175,8 +175,8 @@ public static serverObjects respond(@SuppressWarnings("unused") final RequestHea
} else {
prop.put("table", 1);
final SolrConnector solr = sb.index.fulltext().getRemoteSolr();
final long[] size = (solr instanceof ShardSolrConnector) ? ((ShardSolrConnector) solr).getSizeList() : new long[]{((SingleSolrConnector) solr).getSize()};
final String[] urls = (solr instanceof ShardSolrConnector) ? ((ShardSolrConnector) solr).getAdminInterfaceList() : new String[]{((SingleSolrConnector) solr).getAdminInterface()};
final long[] size = (solr instanceof ShardSolrConnector) ? ((ShardSolrConnector) solr).getSizeList() : new long[]{((RemoteSolrConnector) solr).getSize()};
final String[] urls = (solr instanceof ShardSolrConnector) ? ((ShardSolrConnector) solr).getAdminInterfaceList() : new String[]{((RemoteSolrConnector) solr).getAdminInterface()};
boolean dark = false;
for (int i = 0; i < size.length; i++) {
prop.put("table_list_" + i + "_dark", dark ? 1 : 0); dark = !dark;
Expand Down
Expand Up @@ -40,7 +40,7 @@ public class MultipleSolrConnector implements SolrConnector {
private int commitWithinMs;

public MultipleSolrConnector(final String url, int connections) throws IOException {
this.solr = new SingleSolrConnector(url);
this.solr = new RemoteSolrConnector(url);
this.queue = new ArrayBlockingQueue<SolrInputDocument>(1000);
this.worker = new AddWorker[connections];
this.commitWithinMs = 180000;
Expand All @@ -53,7 +53,7 @@ public MultipleSolrConnector(final String url, int connections) throws IOExcepti
private class AddWorker extends Thread {
private final SolrConnector solr;
public AddWorker(final String url) throws IOException {
this.solr = new SingleSolrConnector(url);
this.solr = new RemoteSolrConnector(url);
this.solr.setCommitWithinMs(MultipleSolrConnector.this.commitWithinMs);
}
@Override
Expand Down
Expand Up @@ -44,7 +44,7 @@
import org.apache.solr.client.solrj.impl.HttpSolrServer;


public class SingleSolrConnector extends AbstractSolrConnector implements SolrConnector {
public class RemoteSolrConnector extends AbstractSolrConnector implements SolrConnector {

private final String solrurl, host, solrpath, solraccount, solrpw;
private final int port;
Expand All @@ -55,7 +55,7 @@ public class SingleSolrConnector extends AbstractSolrConnector implements SolrCo
* @param scheme
* @throws IOException
*/
public SingleSolrConnector(final String url) throws IOException {
public RemoteSolrConnector(final String url) throws IOException {
super();
this.solrurl = url;

Expand Down Expand Up @@ -115,9 +115,9 @@ public String getAdminInterface() {
}

public static void main(final String args[]) {
SingleSolrConnector solr;
RemoteSolrConnector solr;
try {
solr = new SingleSolrConnector("http://127.0.0.1:8983/solr");
solr = new RemoteSolrConnector("http://127.0.0.1:8983/solr");
solr.clear();
final File exampleDir = new File("test/parsertest/");
long t, t0, a = 0;
Expand Down
Expand Up @@ -50,7 +50,7 @@ public ShardSolrConnector(final String urlList, final ShardSelection.Method meth
this.connectors = new ArrayList<SolrConnector>();
SolrConnector s;
for (final String u: this.urls) {
s = multipleConnections ? new MultipleSolrConnector(u.trim(), 2) : new SingleSolrConnector(u.trim());
s = multipleConnections ? new MultipleSolrConnector(u.trim(), 2) : new RemoteSolrConnector(u.trim());
this.connectors.add(new RetrySolrConnector(s, timeout));
}
this.sharding = new ShardSelection(method, this.urls.length);
Expand Down

0 comments on commit d54b803

Please sign in to comment.