-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from benmccann/admin-repl-info
Add replication info to admin page and check whether index exists before initial import
- Loading branch information
Showing
16 changed files
with
361 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,9 @@ | ||
package org.elasticsearch.river.mongodb; | ||
|
||
import org.elasticsearch.river.mongodb.util.MongoDBRiverHelper; | ||
public enum Status { | ||
|
||
class Status implements Runnable { | ||
|
||
private final MongoDBRiver mongoDBRiver; | ||
private final MongoDBRiverDefinition definition; | ||
private final SharedContext context; | ||
|
||
public Status(MongoDBRiver mongoDBRiver, MongoDBRiverDefinition definition, SharedContext context) { | ||
this.mongoDBRiver = mongoDBRiver; | ||
this.definition = definition; | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
while (true) { | ||
try { | ||
if (this.mongoDBRiver.startInvoked) { | ||
boolean enabled = MongoDBRiverHelper.isRiverEnabled(this.mongoDBRiver.client, this.definition.getRiverName()); | ||
|
||
if (this.context.isActive() && !enabled) { | ||
MongoDBRiver.logger.info("About to stop river: {}", this.definition.getRiverName()); | ||
this.mongoDBRiver.close(); | ||
} | ||
|
||
if (!this.context.isActive() && enabled) { | ||
MongoDBRiver.logger.trace("About to start river: {}", this.definition.getRiverName()); | ||
this.mongoDBRiver.start(); | ||
} | ||
} | ||
Thread.sleep(1000L); | ||
} catch (InterruptedException e) { | ||
MongoDBRiver.logger.info("Status thread interrupted", e, (Object) null); | ||
Thread.currentThread().interrupt(); | ||
break; | ||
} | ||
|
||
} | ||
} | ||
} | ||
RUNNING, | ||
STOPPED, | ||
INITIAL_IMPORT_FAILED; | ||
|
||
} |
Oops, something went wrong.