Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-06-2008, 11:01 PM
Member
 
Join Date: Oct 2008
Posts: 18
piyu.sha is on a distinguished road
[SOLVED] Hacking Singleton- Multiple instance of a Singleton class
I was reading about singleton patter on web and there was a mention about a hacking technique which can create multiple instances of a Singleton class.

As far as I know java, we can not access private methods or constructor of a class outside it so how can a object be created.

Just wanted to know if this is possible or not?

Any help or pointers please....
__________________
Live life king size
[
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
]
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-06-2008, 11:03 PM
Member
 
Join Date: Oct 2008
Posts: 45
priyanka.dandekar is on a distinguished road
I think that is possible through Reflection APIs, have a look at the Reflection APIs in details you should find something.

I have seen some code by which you can access private member of a class.

____________________________________________
Priya,
Cooking is Fun | Eat Healthy Stay Fit | Sweets | Raita | Bread | Dal
__________________
Cheers,

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 10-06-2008, 11:06 PM
Member
 
Join Date: Oct 2008
Location: US
Posts: 40
kzvi.kzvi.1 is on a distinguished road
+1 on Priyanka's post, here is the exact Example code which demonstrates how you can do this.

Try it out and play with it for various other tricks you can do with same API.

____________________________________________
Software Wiki | Interview FAQs | Lucene Search | Oracle | ORM | Struts2 | Job Seeker
__________________
Have fun....

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
singleton object ... haiforhussain Advanced Java 8 06-23-2008 08:43 AM
Whether to make Bean Singleton or non Singleton (prototype) Java Tip Java Tips 0 03-29-2008 02:41 PM
Singleton Pattern Java Tip Java Tips 0 01-24-2008 05:21 PM
Whether to make Bean Singleton or non Singleton (prototype) JavaBean Java Tips 0 09-26-2007 10:32 PM
singleton pattern Peter Advanced Java 1 07-09-2007 06:45 AM


All times are GMT +3. The time now is 11:38 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org