- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
public CommandResult update() {
CommandResult res = null;
try {
long start = System.nanoTime();
res = _port.runCommand(_mongo.getDB("admin"), isMasterCmd);
long end = System.nanoTime();
float newPingMS = (end - start) / 1000000F;
if (!successfullyContacted)
_pingTimeMS = newPingMS;
else
_pingTimeMS = _pingTimeMS + ((newPingMS - _pingTimeMS) / latencySmoothFactor);
getLogger().log(Level.FINE, "Latency to " + _addr + " actual=" + newPingMS + " smoothed=" + _pingTimeMS);
successfullyContacted = true;
if (res == null) {
throw new MongoInternalException("Invalid null value returned from isMaster");
}
if (!_ok) {
getLogger().log(Level.INFO, "Server seen up: " + _addr);
}
_ok = true;
// max size was added in 1.8
if (res.containsField("maxBsonObjectSize")) {
_maxBsonObjectSize = (Integer) res.get("maxBsonObjectSize");
} else {
_maxBsonObjectSize = Bytes.MAX_OBJECT_SIZE;
}
} catch (Exception e) {
if (!((_ok) ? true : (Math.random() > 0.1))) {
return res;
}
final StringBuilder logError = (new StringBuilder("Server seen down: ")).append(_addr);
if (e instanceof IOException) {
logError.append(" - ").append(IOException.class.getName());
if (e.getMessage() != null) {
logError.append(" - message: ").append(e.getMessage());
}
getLogger().log(Level.WARNING, logError.toString());
} else {
getLogger().log(Level.WARNING, logError.toString(), e);
}
_ok = false;
}
return res;
}
https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/ConnectionStatus.java
Незаметен.
Elvenfighter 02.06.2013 04:56 # +2
bormand 02.06.2013 07:00 # +1
myzone 02.06.2013 16:20 # 0
kyzi007 02.06.2013 22:05 # 0
wvxvw 02.06.2013 22:22 # 0
Фейсбук упал и лежит - совпадение?
govnomonad 03.06.2013 03:37 # 0
guest8 11.07.2020 03:52 # −999