Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-213

Make the Mongo class proxy safe

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.3
    • Component/s: API, Codecs
    • Labels:
      None

      Currently, when calling new Mongo() the following happen:

      • default hard coded settings are used
      • the driver then tries to establish a connection

      When using reflection tools like cglib to build a proxy around a class, a common behaviour is to call the default constructor to wrap around it (through a subclass).

      This doesn't work with the Mongo class (or could in a misleading way if there's a local mongo server listening on the defaults port, which could change, esp in production).

      IMHO, the best approach here would be to have an explicit call to mongo to open the connection. However, at "worst", a way to setup the default settings could be enough, esp. if these settings can be done through java. One could also consider not providing a default constructor (since the current one isn't clean), but it would mean more work when proxying around.

      thanks in advance

            Assignee:
            Unassigned Unassigned
            Reporter:
            zedros ZedroS
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: