AWGLearned

Tuesday, January 27, 2015

The private lock idiom

Why to use a separate monitor object?

"never synchronize on an variable/field that can change its value ... create some arbitrary private static final Object lock = new Object() and synchronize on that" - John Vint http://stackoverflow.com/questions/3002251/what-is-the-correct-way-to-synchronize-a-shared-static-object-in-java?rq=1

More:
https://www.securecoding.cert.org/confluence/display/java/LCK01-J.+Do+not+synchronize+on+objects+that+may+be+reused
https://www.securecoding.cert.org/confluence/display/java/LCK00-J.+Use+private+final+lock+objects+to+synchronize+classes+that+may+interact+with+untrusted+code

Posted by S931Coder at 8:38 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: Concurrency, Java
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

More Links

  • ColdFusion Learning
  • Java Learning
  • Java Tutorials
  • Version Control Tutorials
  • JavaScript Tutorials
  • Helpful ASP.NET Articles
  • Helpful JavaScript Articles
  • TFS Guidance
  • SharePoint 2007 Dev Tutorials
  • Asynchronous .NET Tutorials
  • Silverlight/WPF Tutorials
  • Helpful Articles

LInks

  • AWGFound
  • AWGReview
  • AWGThoughts
  • AWGCode
  • AWGRead
  • AWGToLearn
  • AWGNotes
  • AWGSkimmed
  • AWGQuotes
  • AWGtek
  • AWGtek Software Outline

Labels

  • .NET (3)
  • ASP.NET (1)
  • C (1)
  • C# (2)
  • CGI (1)
  • Code Smell (1)
  • ColdFusion (1)
  • Concurrency (1)
  • DDD (1)
  • Hosting (1)
  • How-Tos (1)
  • Interview Questions (1)
  • Jargon (1)
  • Java (5)
  • JavaScript (3)
  • Misc Tips (1)
  • MOSS (2)
  • OOP (1)
  • RAII (1)
  • Ruby (1)
  • Servlets (1)
  • Sessions (1)
  • Silverlight (2)
  • Software terms (5)
  • SQL Server (1)
  • TFS (1)
  • Theory (1)
  • Version Control (1)
  • Visual Studio (1)
  • VS Tips (1)
  • Web Services (1)
  • Windows Forms (2)
  • WPF (2)

Blog Archive

  • ►  2016 (2)
    • ►  March (1)
    • ►  January (1)
  • ▼  2015 (1)
    • ▼  January (1)
      • The private lock idiom
  • ►  2014 (4)
    • ►  May (1)
    • ►  April (2)
    • ►  March (1)
  • ►  2013 (11)
    • ►  October (1)
    • ►  July (2)
    • ►  May (1)
    • ►  April (5)
    • ►  March (2)
  • ►  2012 (45)
    • ►  September (4)
    • ►  August (7)
    • ►  July (19)
    • ►  June (2)
    • ►  May (3)
    • ►  April (4)
    • ►  March (3)
    • ►  February (3)

Followers

About Me

S931Coder
Documenting my journey through the world of IT.
View my complete profile

Skimmed

  • Perl5Unleashed
Ethereal theme. Powered by Blogger.