I know what it is, I just wanted to see what you thought it was used for.
The correct usage is this:
using (DocumentLock yourVariableNameGoesHere = someVariableThatIsADocument.LockDocument())
{
// some interesting code goes here
}
By using a 'using' statement, the DocumentLock is correctly disposed, which releases your document (which you code doesn't do), even in the event of failure.
Also, you should never be using the C# 'lock' keyword in AutoCAD, as it's for locking down code for multi-thread access, which AutoCAD is not capable of doing, using any of it's in-built functions.
Next question:
With the below attribute, why are you using CommangFlags.Session?
[CommandMethod("Q2", CommandFlags.Session)]