mirror of https://github.com/apache/lucene.git
SOLR-6273: Fixed a null check, some typos and a few compiler warnings
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1709619 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8239523660
commit
5beea1098e
|
@ -66,7 +66,7 @@ public class CdcrReplicator implements Runnable {
|
|||
// Add the param to indicate the {@link CdcrUpdateProcessor} to keep the provided version number
|
||||
req.setParam(CdcrUpdateProcessor.CDCR_UPDATE, "");
|
||||
|
||||
// Start the benchmakr timer
|
||||
// Start the benchmark timer
|
||||
state.getBenchmarkTimer().start();
|
||||
|
||||
long counter = 0;
|
||||
|
|
|
@ -64,7 +64,6 @@ class CdcrReplicatorScheduler {
|
|||
void start() {
|
||||
if (!isStarted) {
|
||||
scheduler = Executors.newSingleThreadScheduledExecutor(new DefaultSolrThreadFactory("cdcr-scheduler"));
|
||||
//replicatorsPool = Executors.newFixedThreadPool(poolSize, new DefaultSolrThreadFactory("cdcr-replicator"));
|
||||
replicatorsPool = ExecutorUtil.newMDCAwareFixedThreadPool(poolSize, new DefaultSolrThreadFactory("cdcr-replicator"));
|
||||
|
||||
// the scheduler thread is executed every second and submits one replication task
|
||||
|
@ -75,7 +74,7 @@ class CdcrReplicatorScheduler {
|
|||
public void run() {
|
||||
int nCandidates = statesQueue.size();
|
||||
for (int i = 0; i < nCandidates; i++) {
|
||||
// a thread that pool one state from the queue, execute the replication task, and push back
|
||||
// a thread that poll one state from the queue, execute the replication task, and push back
|
||||
// the state in the queue when the task is completed
|
||||
replicatorsPool.execute(new Runnable() {
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ class CdcrReplicatorState {
|
|||
// Shift back to the right by 20 bits the version number - See VersionInfo#getNewClock
|
||||
return DateFormatUtil.formatExternal(new Date(logReader.getLastVersion() >> 20));
|
||||
}
|
||||
return new String();
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,7 +201,6 @@ class CdcrReplicatorState {
|
|||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,10 +126,10 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
replicasConfiguration = new HashMap<>();
|
||||
List replicas = args.getAll(CdcrParams.REPLICA_PARAM);
|
||||
for (Object replica : replicas) {
|
||||
if (replicas != null && replica instanceof NamedList) {
|
||||
if (replica != null && replica instanceof NamedList) {
|
||||
SolrParams params = SolrParams.toSolrParams((NamedList) replica);
|
||||
if (!replicasConfiguration.containsKey(params.get(CdcrParams.SOURCE_COLLECTION_PARAM))) {
|
||||
replicasConfiguration.put(params.get(CdcrParams.SOURCE_COLLECTION_PARAM), new ArrayList<SolrParams>());
|
||||
replicasConfiguration.put(params.get(CdcrParams.SOURCE_COLLECTION_PARAM), new ArrayList<>());
|
||||
}
|
||||
replicasConfiguration.get(params.get(CdcrParams.SOURCE_COLLECTION_PARAM)).add(params);
|
||||
}
|
||||
|
@ -591,8 +591,7 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
|
||||
@Override
|
||||
public Long call() throws Exception {
|
||||
HttpSolrClient server = new HttpSolrClient(baseUrl);
|
||||
try {
|
||||
try (HttpSolrClient server = new HttpSolrClient(baseUrl)) {
|
||||
server.setConnectionTimeout(15000);
|
||||
server.setSoTimeout(60000);
|
||||
|
||||
|
@ -604,8 +603,6 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
|
||||
NamedList response = server.request(request);
|
||||
return (Long) response.get(CdcrParams.CHECKPOINT);
|
||||
} finally {
|
||||
server.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ abstract class CdcrStateManager {
|
|||
}
|
||||
}
|
||||
|
||||
static interface CdcrStateObserver {
|
||||
interface CdcrStateObserver {
|
||||
|
||||
public void stateUpdate();
|
||||
void stateUpdate();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue