COMP 310
Fall 2014

Lec44: Tips & Traps and Team Work 

Home  Info  Owlspace   Java Resources  Eclipse Resources  Piazza

Trap:

Watch out for code that attempts to perform RMI actions before IRMIUtils.startRMI() has been run!   Symptoms can include strange RMI behavior such as remote dynamic class loading not working as expected.  Common culprit: constructors that try to do too much, too early.

Tip:

  1. Separate pure construction operations (constructor) from start-up initialization operations ("start" method).   Put RMI operations with the start-up operations.
  2.  Do not call the startup operations until after the RMI system has been started.

 


Trap:

Not waiting for network operations to complete can lead to race conditions such as concurrent modification errors.    Common culprit:  A method that sends the data to the a chat room on a new thread but provides no means of executing a process after the returned packets have been processed, i.e. after the data has been definitively sent.

Tips:

 


Trap:

Shutting down the application leaves objects still bound in the Registry, network connections hanging or disconnected, class file servers still running, etc.     Common culprit: A main GUI frame that is set to EXIT_ON_CLOSE and thus does not "clean-up" before it exits, e.g. gracefully exit all chat rooms, run IRMIUtils.stopRMI() to shut down the class server,  registry.unbind(name) to unbind the IHost stub, etc.

Tips:

 


© 2014 by Stephen Wong