Allow TcpSockets to be held somewhere else than Actor.locals()

#5 Merged
Repository
Deleted repository
Branch
default (40d54497bc72)
Repository
fantomongo
Branch
default
Author
  1. Steve Eynon
Reviewers
Description

Currently the Mongo class holds a reference to a single Connection object. That Connection object holds a TcpSocket instance in Actor.locals(), creating a new Socket should one not exist in Actor.locals().

While this would work fine in a GUI app, in a web app it's more of a memory leak as each different HTTP request (thread) would create a new TcpSocket.

These changes allow DB objects to be easily created with different instances / subclasses of Connection. The default Connection object still uses Actor.locals() but it allows the user to create and manage their own Connection classes should they wish.

Um, I also added some F4 IDE files by mistake - ignore these!

Cheers,

Steve.

Comments (2)

  1. Liam Staskawicz repo owner

    Thanks! I haven't touched this in quite a while, so did not verify/test this change.

    If you end up working with this project more, I can give you commit access if you're interested.