• 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

why no is the same !?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in my early design, there are one object named DBConnection, exposed with rebind method.
this obj encapsulate de data class which accessing the database directly to satisfy the clients requests..
if all clients accessing data class for the same object ..


dbInterface = (RemoteClient)Naming.lookup("rmi://"+url+"/dbConn");
dbInterface2 = (RemoteClient)Naming.lookup("rmi://"+url+"/dbConn");
if (dbInterface == dbInterface2) { System.out.println("equals"); }


the objects no have to be the same?
why equals not printed?
thanks all again
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


if (dbInterface == dbInterface2) { System.out.println("equals"); }


How about overriding the equals() method of the RemoteClient class and using
if (dbInterface.equals(dbInterface2)) instead?
Eugene.
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hein
but the references no refer to the same object?!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because the actual references are pointing to the stubs(proxy), not the actual object on the server.
Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic