diff --git a/mavenPush.py b/mavenPush.py index ea781894732..c4a72f6671b 100755 --- a/mavenPush.py +++ b/mavenPush.py @@ -66,8 +66,13 @@ def go( pkgName, shortName , longName ): out.write( pom ) out.close() - p = subprocess.Popen( [ "sha1sum" , fileRoot + ".jar" ] , stdout=subprocess.PIPE ).communicate() - sha1 = p[0].split( ' ' )[0] + hasSha1Sum = subprocess.Popen( [ "which", "sha1sum" ] , stdout=subprocess.PIPE ).communicate() + if hasSha1Sum[0] != '': + p = subprocess.Popen( [ "sha1sum" , fileRoot + ".jar" ] , stdout=subprocess.PIPE ).communicate() + sha1 = p[0].split( ' ' )[0] + else: + p = subprocess.Popen( [ "openssl", "dgst", "-sha1", fileRoot + ".jar" ] , stdout=subprocess.PIPE ).communicate() + sha1 = p[0].split( ' ' )[1] out = open( fileRoot + ".jar.sha1" , 'w' ) out.write( sha1 ) out.close() diff --git a/src/main/com/mongodb/DBPort.java b/src/main/com/mongodb/DBPort.java index 49d1f7dea74..b980cf2df85 100644 --- a/src/main/com/mongodb/DBPort.java +++ b/src/main/com/mongodb/DBPort.java @@ -193,6 +193,11 @@ boolean _open() long sleepTime = 100; + long maxConnectionRetryTime = CONN_RETRY_TIME_MS; + if (_options.maxConnectionRetryTime > 0) { + maxConnectionRetryTime = _options.maxConnectionRetryTime; + } + final long start = System.currentTimeMillis(); while ( true ){ @@ -220,11 +225,11 @@ boolean _open() long sleptSoFar = System.currentTimeMillis() - start; - if ( sleptSoFar >= CONN_RETRY_TIME_MS ) + if ( sleptSoFar >= maxConnectionRetryTime ) throw lastError; - if ( sleepTime + sleptSoFar > CONN_RETRY_TIME_MS ) - sleepTime = CONN_RETRY_TIME_MS - sleptSoFar; + if ( sleepTime + sleptSoFar > maxConnectionRetryTime ) + sleepTime = maxConnectionRetryTime - sleptSoFar; _logger.severe( "going to sleep and retry. total sleep time after = " + ( sleptSoFar + sleptSoFar ) + "ms this time:" + sleepTime + "ms" ); ThreadUtil.sleep( sleepTime ); diff --git a/src/main/com/mongodb/MongoOptions.java b/src/main/com/mongodb/MongoOptions.java index 85576918d5c..c35575b5361 100644 --- a/src/main/com/mongodb/MongoOptions.java +++ b/src/main/com/mongodb/MongoOptions.java @@ -34,6 +34,7 @@ public void reset(){ maxWaitTime = 1000 * 60 * 2; connectTimeout = 0; socketTimeout = 0; + maxConnectionRetryTime = -1L; socketKeepAlive = false; autoConnectRetry = false; slaveOk = false; @@ -99,6 +100,12 @@ else if (safe) */ public int socketTimeout; + /** + * The maximum amount of time to spend retrying a connection. Used in DBPort. + * Any negative value (the default) will use DBPort's old default value of 15000. + */ + public long maxConnectionRetryTime; + /** * This controls whether or not to have socket keep alive * turned on (SO_KEEPALIVE).