@@ -78,8 +78,8 @@ public class MerchantConfig {
7878 private boolean customHttpClassEnabled ;
7979 private boolean certificateCacheEnabled ;
8080 private boolean merchantConfigCacheEnabled ;
81+ private boolean staleConnectionCheckEnabled ;
8182 private boolean shutdownHookEnabled ;
82-
8383 public String getcustomHttpClass () {
8484 return customHttpClass ;
8585 }
@@ -381,6 +381,14 @@ public boolean isMerchantConfigCacheEnabled() {
381381 return merchantConfigCacheEnabled ;
382382 }
383383
384+ /**
385+ * Getter method for staleConnectionCheckEnabled
386+ * @return boolean
387+ */
388+ public boolean isStaleConnectionCheckEnabled () {
389+ return staleConnectionCheckEnabled ;
390+ }
391+
384392 /**
385393 * Getter method for shutdownHookEnabled
386394 * @return boolean
@@ -534,52 +542,77 @@ public MerchantConfig(Properties _props, String _merchantID)
534542 throw new ConfigException ("maxConnections property is empty" );
535543 } else {
536544 maxConnections = getIntegerProperty (merchantID , "maxConnections" );
545+ if (maxConnections <= 0 ){
546+ throw new ConfigException ("maxConnections property can't be 0 or negative" );
547+ }
537548 }
538549
539550 if (StringUtils .isEmpty (getProperty (merchantID , "defaultMaxConnectionsPerRoute" ))) {
540551 throw new ConfigException ("defaultMaxConnectionsPerRoute property is empty" );
541552 } else {
542553 defaultMaxConnectionsPerRoute = getIntegerProperty (merchantID , "defaultMaxConnectionsPerRoute" );
554+ if (defaultMaxConnectionsPerRoute <= 0 ){
555+ throw new ConfigException ("defaultMaxConnectionsPerRoute property can't be 0 or negative" );
556+ }
543557 }
544558
545559 if (StringUtils .isEmpty (getProperty (merchantID , "maxConnectionsPerRoute" ))) {
546560 throw new ConfigException ("maxConnectionsPerRoute property is empty" );
547561 } else {
548562 maxConnectionsPerRoute = getIntegerProperty (merchantID , "maxConnectionsPerRoute" );
563+ if (maxConnectionsPerRoute <= 0 ){
564+ throw new ConfigException ("maxConnectionsPerRoute property can't be 0 or negative" );
565+ }
549566 }
550567
551568 if (StringUtils .isEmpty (getProperty (merchantID , "connectionRequestTimeoutMs" ))) {
552569 throw new ConfigException ("connectionRequestTimeoutMs property is empty" );
553570 } else {
554571 connectionRequestTimeoutMs = getIntegerProperty (merchantID , "connectionRequestTimeoutMs" );
572+ if (connectionRequestTimeoutMs <= 0 ){
573+ throw new ConfigException ("connectionRequestTimeoutMs property can't be 0 or negative" );
574+ }
555575 }
556576
557577 if (StringUtils .isEmpty (getProperty (merchantID , "connectionTimeoutMs" ))) {
558578 throw new ConfigException ("connectionTimeoutMs property is empty" );
559579 } else {
560580 connectionTimeoutMs = getIntegerProperty (merchantID , "connectionTimeoutMs" );
581+ if (connectionTimeoutMs <= 0 ){
582+ throw new ConfigException ("connectionTimeoutMs property can't be 0 or negative" );
583+ }
561584 }
562585
563586 if (StringUtils .isEmpty (getProperty (merchantID , "socketTimeoutMs" ))) {
564587 throw new ConfigException ("socketTimeoutMs property is empty" );
565588 } else {
566589 socketTimeoutMs = getIntegerProperty (merchantID , "socketTimeoutMs" );
590+ if (socketTimeoutMs <= 0 ){
591+ throw new ConfigException ("socketTimeoutMs property can't be 0 or negative" );
592+ }
567593 }
568594
569595 if (StringUtils .isEmpty (getProperty (merchantID , "evictThreadSleepTimeMs" ))) {
570596 throw new ConfigException ("evictThreadSleepTimeMs property is empty" );
571597 } else {
572598 evictThreadSleepTimeMs = getIntegerProperty (merchantID , "evictThreadSleepTimeMs" );
599+ if (evictThreadSleepTimeMs <= 0 ){
600+ throw new ConfigException ("evictThreadSleepTimeMs property can't be 0 or negative" );
601+ }
573602 }
574603
575604 if (StringUtils .isEmpty (getProperty (merchantID , "maxKeepAliveTimeMs" ))) {
576605 throw new ConfigException ("maxKeepAliveTimeMs property is empty" );
577606 } else {
578607 maxKeepAliveTimeMs = getIntegerProperty (merchantID , "maxKeepAliveTimeMs" );
608+ if (maxKeepAliveTimeMs <= 0 ){
609+ throw new ConfigException ("maxKeepAliveTimeMs property can't be 0 or negative" );
610+ }
579611 }
580612
581- validateAfterInactivityMs = getIntegerProperty (merchantID , "validateAfterInactivityMs" , 2000 );
582- shutdownHookEnabled =getBooleanProperty (merchantID , "enabledShutdownHook" , true );
613+ validateAfterInactivityMs = getIntegerProperty (merchantID , "validateAfterInactivityMs" , 0 );
614+ staleConnectionCheckEnabled = getBooleanProperty (merchantID , "staleConnectionCheckEnabled" , true );
615+ shutdownHookEnabled = getBooleanProperty (merchantID , "enabledShutdownHook" , true );
583616 }
584617
585618 allowRetry = getBooleanProperty (merchantID , "allowRetry" , true );
@@ -772,6 +805,7 @@ public String getLogString() {
772805 appendPair (sb , "evictThreadSleepTimeMs" , evictThreadSleepTimeMs );
773806 appendPair (sb , "maxKeepAliveTimeMs" , maxKeepAliveTimeMs );
774807 appendPair (sb , "validateAfterInactivityMs" , validateAfterInactivityMs );
808+ appendPair (sb , "staleConnectionCheckEnabled" , staleConnectionCheckEnabled );
775809 appendPair (sb , "enabledShutdownHook" , shutdownHookEnabled );
776810 }
777811 appendPair (sb , "timeout" , timeout );
0 commit comments