• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Object Locking mechanism

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I want to implement new locking mechanism similar to like how threads locking or synchronized does the operation. Any inputs to implement out own locking mechanism ?


With regards,
Shiva kore
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you want to do this? And how would it be different from the existing locking mechanisms?
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You write your own virtual machine; if it is different from that in the Java Language Specification you cannot call the language Java.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A different JVM is not necessary, as it is perfectly possible to write locking mechanisms using the classes provided by the JRE. Whether that is possible in the case shiva is thinking about, we'll know once the questions I asked have been answered.
 
shiva kore
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,

Thanks, You are right. I am a beginner to java coding just thinking is it possible to write our own locking technique or not.

Thanks,
Shiva kore
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shiva kore wrote:
I am a beginner to java coding just thinking is it possible to write our own locking technique or not.



Well, wouldn't that really depend on what you are trying to do? If you want to have some code that does some sort of locking, then take a look at the classes in the java.util.concurrent package. There are lots of different types of synchronization mechanisms there -- perhaps you can add to it, or use them as the basis for your own locking mechanism.

If you are trying to modify the synchronize keyword to do something else (ie. change the Java language structure), as other has stated, it will probably be a bit too much for a beginner...

Henry
 
shiva kore
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Henry, I will go through java.util.concurrent package and let me try..
 
reply
    Bookmark Topic Watch Topic
  • New Topic