@@ -511,7 +511,55 @@ public boolean isAlwaysUseMBeans() {
511
511
return alwaysUseMBeans ;
512
512
}
513
513
514
+ @ Override
515
+ public boolean equals (final Object o ) {
516
+ if (this == o ) return true ;
517
+ if (o == null || getClass () != o .getClass ()) return false ;
518
+
519
+ final MongoClientOptions that = (MongoClientOptions ) o ;
520
+
521
+ if (alwaysUseMBeans != that .alwaysUseMBeans ) return false ;
522
+ if (autoConnectRetry != that .autoConnectRetry ) return false ;
523
+ if (connectTimeout != that .connectTimeout ) return false ;
524
+ if (connectionsPerHost != that .connectionsPerHost ) return false ;
525
+ if (cursorFinalizerEnabled != that .cursorFinalizerEnabled ) return false ;
526
+ if (maxAutoConnectRetryTime != that .maxAutoConnectRetryTime ) return false ;
527
+ if (maxWaitTime != that .maxWaitTime ) return false ;
528
+ if (socketKeepAlive != that .socketKeepAlive ) return false ;
529
+ if (socketTimeout != that .socketTimeout ) return false ;
530
+ if (threadsAllowedToBlockForConnectionMultiplier != that .threadsAllowedToBlockForConnectionMultiplier )
531
+ return false ;
532
+ if (!dbDecoderFactory .equals (that .dbDecoderFactory )) return false ;
533
+ if (!dbEncoderFactory .equals (that .dbEncoderFactory )) return false ;
534
+ if (description != null ? !description .equals (that .description ) : that .description != null ) return false ;
535
+ if (!readPreference .equals (that .readPreference )) return false ;
536
+ // Compare SocketFactory Class, since some equivalent SocketFactory instances are not equal to each other
537
+ if (!socketFactory .getClass ().equals (that .socketFactory .getClass ())) return false ;
538
+ if (!writeConcern .equals (that .writeConcern )) return false ;
539
+
540
+ return true ;
541
+ }
514
542
543
+ @ Override
544
+ public int hashCode () {
545
+ int result = description != null ? description .hashCode () : 0 ;
546
+ result = 31 * result + connectionsPerHost ;
547
+ result = 31 * result + threadsAllowedToBlockForConnectionMultiplier ;
548
+ result = 31 * result + maxWaitTime ;
549
+ result = 31 * result + connectTimeout ;
550
+ result = 31 * result + socketTimeout ;
551
+ result = 31 * result + (socketKeepAlive ? 1 : 0 );
552
+ result = 31 * result + (autoConnectRetry ? 1 : 0 );
553
+ result = 31 * result + (int ) (maxAutoConnectRetryTime ^ (maxAutoConnectRetryTime >>> 32 ));
554
+ result = 31 * result + readPreference .hashCode ();
555
+ result = 31 * result + dbDecoderFactory .hashCode ();
556
+ result = 31 * result + dbEncoderFactory .hashCode ();
557
+ result = 31 * result + writeConcern .hashCode ();
558
+ result = 31 * result + socketFactory .hashCode ();
559
+ result = 31 * result + (cursorFinalizerEnabled ? 1 : 0 );
560
+ result = 31 * result + (alwaysUseMBeans ? 1 : 0 );
561
+ return result ;
562
+ }
515
563
516
564
private MongoClientOptions (final Builder builder ) {
517
565
description = builder .description ;
0 commit comments