@@ -51,6 +51,7 @@ public void reset(){
5151 socketFactory = SocketFactory .getDefault ();
5252 description = null ;
5353 cursorFinalizerEnabled = true ;
54+ alwaysUseMBeans = false ;
5455 }
5556
5657 public MongoOptions copy () {
@@ -75,6 +76,7 @@ public MongoOptions copy() {
7576 m .socketFactory = socketFactory ;
7677 m .description = description ;
7778 m .cursorFinalizerEnabled = cursorFinalizerEnabled ;
79+ m .alwaysUseMBeans = alwaysUseMBeans ;
7880 return m ;
7981 }
8082
@@ -236,7 +238,15 @@ else if (safe)
236238 */
237239 public boolean cursorFinalizerEnabled ;
238240
239-
241+ /**
242+ * Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is
243+ * Java 6 or greater. If false, the driver will use MXBeans if the VM is Java 6 or greater, and use MBeans if
244+ * the VM is Java 5.
245+ * <p>
246+ * Default is false.
247+ * </p>
248+ */
249+ public boolean alwaysUseMBeans ;
240250
241251 public String toString (){
242252 StringBuilder buf = new StringBuilder ();
@@ -258,7 +268,8 @@ public String toString(){
258268 buf .append ( "wtimeout=" ).append ( wtimeout ).append ( ", " );
259269 buf .append ( "fsync=" ).append ( fsync ).append ( ", " );
260270 buf .append ( "j=" ).append (j ).append ( ", " );
261- buf .append ( "cursorFinalizerEnabled=" ).append ( cursorFinalizerEnabled );
271+ buf .append ( "cursorFinalizerEnabled=" ).append (cursorFinalizerEnabled ).append ( ", " );
272+ buf .append ( "alwaysUseMBeans=" ).append (alwaysUseMBeans );
262273
263274 return buf .toString ();
264275 }
@@ -568,4 +579,20 @@ public boolean isCursorFinalizerEnabled() {
568579 public void setCursorFinalizerEnabled (final boolean cursorFinalizerEnabled ) {
569580 this .cursorFinalizerEnabled = cursorFinalizerEnabled ;
570581 }
582+
583+ /**
584+ *
585+ * @return true if the driver should always use MBeans, regardless of VM
586+ */
587+ public boolean isAlwaysUseMBeans () {
588+ return alwaysUseMBeans ;
589+ }
590+
591+ /**
592+ *
593+ * @param alwaysUseMBeans sets whether the driver should always use MBeans, regardless of VM
594+ */
595+ public void setAlwaysUseMBeans (final boolean alwaysUseMBeans ) {
596+ this .alwaysUseMBeans = alwaysUseMBeans ;
597+ }
571598}
0 commit comments