mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
nicer code
This commit is contained in:
parent
1521222534
commit
d633b3dfbb
1
.idea/dictionaries/kimchy.xml
generated
1
.idea/dictionaries/kimchy.xml
generated
@ -41,6 +41,7 @@
|
||||
<w>ngram</w>
|
||||
<w>param</w>
|
||||
<w>params</w>
|
||||
<w>pluggable</w>
|
||||
<w>plugins</w>
|
||||
<w>porterstem</w>
|
||||
<w>rebalance</w>
|
||||
|
@ -60,10 +60,22 @@ public class Nodes implements Iterable<Node> {
|
||||
return nodes.values().iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a valid nodes that has the minimal information set. The minimal set is defined
|
||||
* by the localNodeId being set.
|
||||
*/
|
||||
public boolean valid() {
|
||||
return localNodeId != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if the local node is the master node.
|
||||
*/
|
||||
public boolean localNodeMaster() {
|
||||
if (localNodeId == null) {
|
||||
// we don't know yet the local node id, return false
|
||||
return false;
|
||||
}
|
||||
return localNodeId.equals(masterNodeId);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,11 @@ import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.util.component.LifecycleComponent;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* A pluggable module allowing to implement discovery of other nodes, publishing of the cluster
|
||||
* state to all nodes, electing a master of the cluster that raises cluster state change
|
||||
* events.
|
||||
*
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public interface Discovery extends LifecycleComponent<Discovery> {
|
||||
|
||||
@ -33,6 +37,9 @@ public interface Discovery extends LifecycleComponent<Discovery> {
|
||||
|
||||
String nodeDescription();
|
||||
|
||||
/**
|
||||
* Is the discovery of this node caused this node to be the first master in the cluster.
|
||||
*/
|
||||
boolean firstMaster();
|
||||
|
||||
/**
|
||||
|
@ -27,17 +27,17 @@ import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.cluster.metadata.MetaDataService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.util.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.util.concurrent.DynamicExecutors;
|
||||
import org.elasticsearch.util.settings.Settings;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static java.util.concurrent.Executors.*;
|
||||
import static org.elasticsearch.cluster.ClusterState.*;
|
||||
import static org.elasticsearch.cluster.metadata.MetaData.*;
|
||||
import static org.elasticsearch.util.TimeValue.*;
|
||||
import static org.elasticsearch.util.concurrent.DynamicExecutors.*;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
@ -67,7 +67,7 @@ public class GatewayService extends AbstractLifecycleComponent<GatewayService> i
|
||||
|
||||
@Override protected void doStart() throws ElasticSearchException {
|
||||
gateway.start();
|
||||
this.executor = Executors.newSingleThreadExecutor(DynamicExecutors.daemonThreadFactory(settings, "gateway"));
|
||||
this.executor = newSingleThreadExecutor(daemonThreadFactory(settings, "gateway"));
|
||||
clusterService.add(this);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user