• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Unreferenced()

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why we need non-duplication remote object to implement unreferenced? to do unlocking() has been locked??? what mechanism that is normally put in this method?
 
Kruger Scheitz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how is unreferenced() applicable over here?
my understanding is when one of the client performs
bookflight(){
lock()
read()
modify()
unlock()
}
while read() is being processed, the client crashes. And here unreferenced() comes in and do the unlocking that has been previously locked. Am i right?
- what do u mean client crashes ?
- In what scenario would a client crashes?
- how does a crashed client call up the unreferenced method ?
 
Kruger Scheitz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why unreferenced() is not called when there isn t any more dirty call?
do i need to implicitly NULL those objects that have references to remote object and then garbage collected them in order to call up the unreferenced() at the RemoteData.
pls do enlighten all the questions i have posted above and here.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kruger,


- what do u mean client crashes ?


A network failure. It could be caused by a network server going down, a power outage at the client site, the client accidentally shutting down the application, etc.


- In what scenario would a client crashes?


See above.


- how does a crashed client call up the unreferenced method ?


How could the client call anything after a crash? The client doesn't call the unreferenced() method. The RMI runtime does on your server. When the DGC (distributed garbage collector) determines that there are no more reachable remote references to a Remote object, that object's unreferenced() method is called if it implements the Unreferenced interface and is marked for normal GC. So you don't have to worry about the unreferenced() method, RMI will take care of it for you.
Hope this explains it,
Michael Morris
 
Kruger Scheitz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so how does unreferenced() apply in our project here? what is its used? what logic to put inside the unreferenced() ?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kruger,


so how does unreferenced() apply in our project here? what is its used? what logic to put inside the unreferenced() ?


It is used to unlock any locked records held by the dead client.
Michael Morris
 
Kruger Scheitz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my unreferenced() can't seem to be called up
when i terminate my client GUI.. what s the problem over here?
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order to verify that your unreferenced is working properly, you will need to do 3 things:
1. Create some way to put a significant delay between when your client calls lock and when it calls unlock. You can use Thread.sleep, System.in.read, System.exit, or just comment out the call to unlock.
2. Put some System.out.println's in your unreferenced(), so you can see when it is being called on the server side object.
3. Run the server and client and start the booking process then quit the client without calling unlock. LEAVE the server running for about 15 minutes or so, and you should see your println's confirming that unreferenced was called.

Hope that clarifies it. You seem to be on the right track.
Pete
 
Kruger Scheitz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when the client crashes, it doesn't make sense for the server to wait for 10 minutes b4 all the remote object is garbage collected.
can we start up the server by passing this Djava.rmi.dgc.leaseValue=1000 to VM so that if no dirty call are made to the remote object within one minute, the remote object's unreferenced() will be called.
i came to know that we CANNOT/CAN customise this... so can we or can we not?
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when the client crashes, it doesn't make sense for the server to wait for 10 minutes b4 all the remote object is garbage collected.
can we start up the server by passing this Djava.rmi.dgc.leaseValue=1000 to VM so that if no dirty call are made to the remote object within one minute, the remote object's unreferenced() will be called.
i came to know that we CANNOT/CAN customise this... so can we or can we not?
 
Don't MAKE me come back there with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic