This usually means:
- Something is being deployed via API (check Setup -> Monitor Deployments)
- Something is being deployed via changesets (Setup -> Deploy -> Inbound change sets)
- You're running some unit tests.
Your request (from developer console, Eclipse or whatever) might have been canceled / timed out but the deployment still runs. One of these means should give you a hint what's going on.... You might also check setup aoudit trail if the condition persists.
If your class failed to save but it seems to be still checking - maybe you've modified something "big". Will many visualforce pages / apex clases that rely on this class suddenly become invalid because you deleted a lot? In that case it might be worth a while to help SF dependency checker by commenting out majority of these VF classes before saving your main change...
Best Answer
1) why is the record locked
I do not see the code use any locking statements, not sure if there are 2 record types used in your org for locking and unlocking if the above 2 statements don't apply:
Check if there is an approval process on the object and in check if there is a final approve action/ final reject action that says
2) Check who can edit the records :
This gives you the answer to why you can still edit the record even as a standard user ( login as a user who is not the submitter of the record or the owner and try to edit, you should get a record locked error)