remote methode invocation

Download Remote Methode Invocation

Post on 26-Mar-2015

225 views

Category:

Documents

6 download

Embed Size (px)

TRANSCRIPT

Foreword Preface Chapter 1.IntroductiontoRMI Section1.1. Inthischapter Section1.2. JavaandRMI Section1.3. ArchitectureofRMIsystems Section1.4. SyntaxofRMI Section1.5. Firstprinciplesremotemethodinvocation Section1.6. Baby'sfirstwords Section1.7. Exercises Chapter 2.CharacteristicsofRMI Section2.1. Inthischapter Section2.2. Syntax Section2.3. Semantics Section2.4. Semanticsoflocalmethodinvocation Section2.5. Semanticsofremotemethodinvocation Section2.6. Summary Section2.7. Exercises Chapter 3.Serialization Section3.1. Inthischapter Section3.2. Introduction Section3.3. Essentials Section3.4. Serializationindepth Section3.5. Theserializationprocess Section3.6. TheSerializableinterface Section3.7. TheExternalizableinterface Section3.8. MarshalledObject Section3.9. Classversioning Section3.10. SerialVersionUID Section3.11. Alternativeapproachestoversioning Section3.12. AdvancedfacilitiesinSerialization Section3.13. javadocandserialization Section3.14. ImprovingtheperformanceofSerialization Section3.15. Exercises Chapter 4.Remoteinterfaces Section4.1. Inthischapter Section4.2. Introduction Section4.3. Proxies Section4.4. Dispatchers Section4.5. Exercises Chapter 5.RMIclients Section5.1. Inthischapter Section5.2. Introduction Section5.3. Remotefailure

Section5.4. Partialfailure Section5.5. Latency Section5.6. Applets Section5.7. Exercises Chapter 6.NamingIRMIregistry Section6.1. Inthischapter Section6.2. Purpose Section6.3. Howitworks Section6.4. Namesintheregistry Section6.5. TheNamingclass Section6.6. TheRegistryinterface Section6.7. Registryexceptions Section6.8. NamesandURLs Section6.9. Registrysetup Section6.10. Registryconfigurations Section6.11. Utilities Section6.12. Alternativenamingservices Section6.13. Exercises Chapter 7.ServersIunicastservers Section7.1. Inthischapter Section7.2. Introduction Section7.3. Writingtheserver Section7.4. Implementingremoteinterfacemethods Section7.5. Threads,sockets,andports Section7.6. TheUnreferencedinterface Section7.7. Buildingtheserver Section7.8. Foundationclasses Section7.9. Serialization Section7.10. Alternativeserverclasses Section7.11. Exercises Chapter 8.SecurityIexecution Section8.1. Inthischapter Section8.2. Introduction Section8.3. RMIandsecuritymanagers Section8.4. Applets Section8.5. Clients Section8.6. Servers Section8.7. Systempropertiessecurity Section8.8. Policyfiles Section8.9. GrantingAllPermission Chapter 9.Mobilecode Section9.1. Inthischapter Section9.2. Outline Section9.3. Howcodemobilityworks

Section9.4. Usesofcodemobility Section9.5. Securityconsiderations Section9.6. Setup Section9.7. HTTPservers Section9.8. Otherprotocols Section9.9. Deployment Section9.10. Downloadingtheclient Chapter 10.ServersIIactivation Section10.1. Inthischapter Section10.2. Introduction Section10.3. Firstprinciplesactivation Section10.4. Howitworks Section10.5. Writinganactivatableserver Section10.6. Registration Section10.7. Buildinganactivatableserver Section10.8. Runtimesetup Section10.9. ActivationandtheUnreferencedinterface Section10.10. Whichserversshouldbeactivatable Section10.11. TheactivationsystemasanRMIregistry Section10.12. Debugging Section10.13. ActivationgroupsinWin32 Section10.14. Activationclients Section10.15. RemarksontheActivationPackage Section10.16. Exercises Chapter 11.Socketfactories Section11.1. Inthischapter Section11.2. Purpose Section11.3. Serversocketfactories Section11.4. Clientsocketfactories Section11.5. Factoryequalitytheequalsmethod Section11.6. Usesofsocketfactories Section11.7. Remarks Chapter 12.Agentsandpatterns Section12.1. Inthischapter Section12.2. Introduction Section12.3. Mobileagents Section12.4. Callbacks Section12.5. Mobileservers Section12.6. Agentsanddesignpatterns Section12.7. Adapter Section12.8. Proxy Section12.9. Clientserverpatterns Section12.10. Singleton Section12.11. Remotefactory

Section12.12. Abstractremote Section12.13. Session Section12.14. Exercises Section12.15. Remarksontheexamplesandexercises Chapter 13.NamingIIJNDIandJini Section13.1. Inthischapter Section13.2. JNDI Section13.3. JNDIoperations Section13.4. JNDIproviders Section13.5. Examples Section13.6. Otherfeaturesandsetup Section13.7. OtherJNDIserviceproviders Section13.8. Jininaming Section13.9. Exercises Chapter 14.ServersIIIRMI/IIOP Section14.1. Inthischapter Section14.2. Introduction Section14.3. RMI/IIOPandCORBA Section14.4. RMI/IIOPandEnterpriseJavaBeans Section14.5. PortableRemoteObject Section14.6. Writingtheserver Section14.7. Buildingtheserver Section14.8. Java/IDLtool Section14.9. SupportingbothJRMPandIIOP Section14.10. Restrictions Section14.11. Implementingtheserviceinanotherlanguage Section14.12. IIOPclients Section14.13. Implementingtheclientinanotherlanguage Section14.14. Exercises Chapter 15.RMIthroughfirewalls Section15.1. Inthischapter Section15.2. Firewalls Section15.3. SOCKS Section15.4. HTTPtunnelling Section15.5. FirewallsandRMI Section15.6. GIOPProxies Section15.7. TheRMIProxy Section15.8. Anoteoncallbacks Section15.9. AnoteonfirewallimplementationsandRMI Chapter 16.SecurityIItheconversation Section16.1. Inthischapter Section16.2. Identity Section16.3. Integrity Section16.4. Privacy

Section16.5. SecureSocketsLayer Section16.6. LDAPauthentication Section16.7. JAAS Section16.8. RMISecurityExtension Section16.9. Exercises Chapter 17.ServersIVbeyondunicast Section17.1. Inthischapter Section17.2. Datagrams Section17.3. Multicast Section17.4. Broadcast Section17.5. Clients Section17.6. Exercises Chapter 18.Selectedfurthertopics Section18.1. Inthischapter Section18.2. Distributedgarbagecollection Section18.3. Logging Section18.4. Debugging Section18.5. TestingRMIinasinglemachine Section18.6. Performance Section18.7. RMIandJDKversions Section18.8. Exercises AppendixA. ExceptionsinRMI SectionA.1. Classhierarchy SectionA.2. ExceptionsinRMIservers SectionA.3. ExceptionsinRMIclients SectionA.4. Alphabeticlistofexceptions SectionA.5. RemarksonexceptionsinRMI AppendixB. Systemproperties SectionB.1. RMIsystemproperties SectionB.2. Implementationdependentsystemproperties AppendixC. References SectionC.1. Books SectionC.2. Papers SectionC.3. Webresources AppendixD. Glossary

ForewordBeforetheJavalanguagewasavailable,distributedsystemsengineeringwasgreatlyconcernedwith theproblemofheterogeneitythedifferencesbetweenCPUs,OSes,languages,anddataformats.The challengewastocreatearchitectureneutralformatsandprotocolswhichcouldbeadaptedtoany architecturewithoutburdeningtheprogrammer.RPCandCORBAIIOPrepresenttwosuch approaches. AftertheJavalanguagewasmootedasauniversallanguage,aninterestingquestionwasraised:how couldadistributedsystemdesignbesimplifiedbytheassumptionthateveryhostisJavacapable?The JavaRemoteMethodInvocation(RMI)APIisatonceaworkingdemonstrationoftheansweranda populartoolforbuildingrealworldJavabaseddistributedsystems. TheJavaRMIAPIwasoriginallydesignedbyAnnWollrath,RogerRiggs,andJimWaldoatSun MicrosystemsLaboratories,EastCoastDivision.Itwasdesignedwiththetwinaimsofsimplicity (easeofuse)andnaturalness(beingagoodfitwiththelanguage). RMIisnotjustaJavaRPC.ItsdistributedobjectmodelallowstheJavasoftwareengineertobuilda complexdistributedsysteminanefficient,maintainable,andobjectorientedway.Inparticular,the JavaRMIsemanticshavebeendesignedfor,andassumedby,theJinitechnologyunveiledbySun Microsystems.TheRMIdevelopmentteamisasubgroupoftheJiniteam,andthesamecarefuldesign philosophyappliestoRMIastoJinitechnology. ThemaindeficiencyoftheJavaRMItechnologyhasbeenitsdocumentation.Designdocumentswere hardtofindandoccasionallyhardtounderstand.Errormessageswereunhelpfultotheuninitiated. LearningRMIbecamemucheasierwhentheJavaRMItutorialswerewrittenbyprofessionals,and successivereleaseshavemadethecodemoreintuitive;however,inordertofindRMIesotericaand arcana,nottomentionbugworkarounds,therewasnoalternativebuttoconsulttheRMIUSERS discussiongroup,ortobuttonholeAnn,Jim,orPeterataJavaONEtalk. ThisbookcollectsanastonishingrangeofJavaRMImaterial,suitableforanyJavaprogrammer regardlessofexperiencewithRMI.TheRMInovicewillbeabletorunRMIprogramswithout excessivehairpulling;theaccomplishedRMIprogrammerwillfindenoughtechniquesand explanationstoimprovetheperformance,capability,oraestheticqualityofhisorhercode;andthe RMIexpertwillbeabletoperformgreatRMIbasedhackswithouttheJDKsourcecode.Finally,the RMIUSERSdenizenwillbeabletoanswermostquestionsbypointingtoasinglesource. So,ifyou'relookingatthisbookbecauseIdirectedyoutoitonthelist,then,yes,you'vefoundthe rightone. AdrianColley SunMicrosystemsIreland February2001

PrefaceAboutthisbookHowitisorganizedPrerequisiteknowledgeTerminologyand conventionsExamplesExercisesColophonAcknowledgements "Therecanbenothingintermediatebetweenthatwhichundergoesandthatwhichcauses alteration." Aristotle,Physics,BookVII,2.

About this bookThisbookisaboutRemoteMethodInvocation(RMI)inJava.Itbothclarifiesandextendsthe informationintheRMISpecification.Whileitisprimarilyaimedatsoftwaredevelopersandstudents, itwillbeusefultoJavaapplicationsarchitectsanddesignersaswell.Thebookhasgrownfromour ownexperienceindesigning,writing,anddeployingRMIapplications,andfromadetailed observationofcommonquestions,difficulties,anddiscussionsontheInternetandin"cyberspace" generally,especiallytheJavanetworkingandRMImailinglists.Wefeelconfidentthatitaddresses manyoftherealworldissuesfacingJavadevelopersprogrammingindistributedenvironments. ThisbookisanaccurateaccountofJavaRMIasatJava2JavaDevelopmentKit(JDK)1.3.It documentsRMIasitreallyis.Tothisend,wehavenotedanumberoferrorsandinconsistenciesin thespec