Pluginsspaceos
spaceos 时间:2021-03-28 阅读:(
)
RajkumarSchoolofComputingQueenslandUniversityofTechnologyBrisbane,AustraliaEmail:rajkumar@fit.
qut.
edu.
auURL:http://www.
fit.
qut.
edu.
au/~rajkumarInternetandJavaRevolutionsImpactonEducationMotivationPotentialdeliverysitesarewidelydistributedInformationisrapidlychangingConnectionstotheInternethavebecomeubiquitousDifferentlearnershavedifferentneedsAgendaInternetanditsEvolutionInternetToolsWebanditsProgrammingInternetasadeliveryVehicleJavaforInternetProgrammingJavaNutsandBoltsJavaPlatformDevelopingAppletsandApplicationsChallengesandFutureDirectionsWhatistheInternetItisaglobalnetworkofcomputersthatcommunicatewitheachotherusingavarietyofprotocolsandovercomingvariouscommunicationbarriers.
ItislikeInternationalTelephoneSystemInternetTechnologyEvolutionInternetismuchbiggerthanwhatwethinkMorethan25yearsoldMorethandoublingeveryyearTechnologyeffectsuddenlyeverybodyseestheneedforatechnologyliketheradioortheTV10terabytesflowseverydayInstalledbaseandGrowthratefortelephonelines,mobilephones,andInternethotsInstalled,19951994-95GrowthRates(%)IncomeGroup/PhoneMobileInternetPhoneMobileInternetRegionLinesPhonesHostsLinesPhonesHostsLowerIncome2.
00.
121.
3535.
7135.
1246.
0Lower-Middle9.
10.
3373.
318.
7105.
1167.
0Upper-Middle14.
51.
34380.
136.
466.
8111.
9High53.
28.
7010749.
233.
655.
697.
0Africa1.
70.
0969.
147.
960.
581.
4Americas29.
05.
178359.
585.
442.
391.
5Asia5.
40.
62121.
7014.
7108.
3150.
0Europe33.
03.
042732.
243.
659.
5112.
2Oceans39.
79.
5512845.
554.
085.
788.
8World12.
11.
561661.
897.
060.
497.
8Source:ACM,Nov,97(phones,internationaltelecommunicationunion,hosts,networkWizardsInternetUseofinternetadvertisement/elections/newspapersinformationispublicUbiquitoustechnologyNetworkisthecomputerIntranets-internalTCP/IPnetsPCaccountsfor55%oftotalITApplicationstiedtoplatform-APIlock-inInternetEvolutionFile&mailTCP/IPWebpagesNetscapeOnlineconnectstointernetSecurepaymentsMultimediaAuthoringJavaVRMLHTMLInterneteverywhereInternetappliancesPricebasedservicesLivecommunities10%ofMarket20%ofMarketTotalMarketEarlyInternetEarlyInternetsupportedonlyemail.
FileTransferProtocoldevelopment-ftpsites.
NetworkNewswasaddedtotheInternet.
Archie-AprogramtocanvassanonymousftpsitesandcreateadatabaseofwhatisavailableGopher-Amenu-driveninterfaceusedtosearchforinformation.
ArchieandGophercouldanswerquestionsonlylike'whatFTPservercontainsinfoabout"xxxx"'WorldWideWebWorldWideWebconceptualizedbyTimBerners-LeeatCERNinSwitzerlandConceptofHypertextledtothedevelopmentoftheHypertextMarkupLanguage(HTML)TimBerners-Leeproposedthe'Browser'programScientistsatCERNdesignedaTCP/IPbasedprotocoltoshareHypertextinformationcalledHTTP.
WWWofficiallyisdescribedasa"Wide-areahypermediainformationretrievalinitiativeaimingtogiveuniversalaccesstoalargeuniverseofdocuments.
ViewingWWWpagesViewtext,graphics,pictures,sounds,videoWebBrowserHyperTextMarkupLanguage(HTML)ComputerIndependentOperatingSystemIndependentWebBrowsersNetscapeNavigatorMicrosoftInternetExplorerOmniWebNCSAMosaicLynx(textonly)InternetOrganizationTrulyworld-wideMultiplecommunicationmediatypesInternetOrganizationDomains:.
edu.
org.
com.
mil.
bizComputers:fife.
engr.
vt.
eduwww.
engr.
vt.
eduWWWOrganizationServerServerServerServerClientClientClientClientClientGeneratingWebPagesSimpleTextEditorWordProcessororothertoolexporte.
g.
,InternetAssistantforMicrosoftWordHTMLEditorOpenfileinNetscapeComposerLaststepistoputthefile(s)onanHTMLserverHTMLHypertext-AlittleHypeandaLittleText.
Hypertextpointtoinformationwhichcanbelocalorremotelylocated.
HTML-DerivativeoftheSGML(StandardGeneralizedMarkupLanguage).
HTML-information,commandsfortheBrowserforformattingdocuments.
HTML-Thede-factolanguageforpublishingontheInternet.
Hypermedia-Hyper-linkstoMultimedia.
InternetToolsBrowsers-AtoolusedtoviewdocumentsontheWWWWebservers-MachineswhichruntheHTTP-serverSoftwarethatrespondtoHTTPrequestswhichitreceivesAuthoringTools-EditorsspeciallymadeforeditingHTMLdocumentsFilters-ToolstoconvertlegacydocumentstoHTMLformatScripting-LanguagesusedforscriptingWAIS-WideAreaInformationServers(WAIS)forindexinganddoingfulltextsearchesHowdoestheWebworkWeb-DesignedaroundClient/ServerArchitectureWebClients(WebBrowsers)-sendrequestsfordocumentstoanyWebServerWebServer-ProgramthatrespondstoHTTPrequestsHyperlinkWebclientconnectstothespecifiedWebServerTheserverrespondsbysendingtheinformationaskedforTheBrowserformatsthereceivedHTMLdataanddisplaysitHTTPSendthe"INFORMATIONABOUTC-DACACTS"TheinformationaboutC-DACACTSTheclientsendsanHTTPmessagetoacomputerrunningaWebServerprogramandasksforadocumentThewebserversendsthehypermediaHTMLdocumentstotheclient.
YouendupseeingthedocumentonyourscreenHowdoestheWebWorkHTMLdocumentCentreforDevelopmentofAdvancedComputingwebmasterURLsURLs-TheHypertextlinksweusetodayareknownasUniversalResourceLocatorURLs-EachnameisuniqueacrosstheInternetAnURLlookslikethishttp://system.
domain.
ext:999/dir1/dir2/dir3/file.
htmlblue#PartsofaURLare,Servicetype,SystemName,Port,Directorypath,Filename,SearchComponentsorVariablesServicetype,SystemName,DirectorypatharetherequiredpartsoftheURLCGI(CommonGatewayInterface)CGImakestheWebaTwo-wayinterfaceCGI-letstheuserrunascriptwhenawebpageisaccessedInformationfromtheWebClientisreceivedthroughsimple'fill-in-the-forms'kindofinterfaceFORMS-Integratesdatasheets,menus,checkboxesCGImakestheWebinteractiveCGI-complicatedtosetup,requiresPERLknowledgeHTMLbookstalklessaboutCGIAuthoringtoolsandFiltersAuthoringtools-EditorsforHTMLdocumentsEditorssimilartoWYSIWYGwordprocessingprogramsSemi-WYSIWYGorcompletelyWYSIWYGProvidesyntaxcheckingandcorrectionFilters-ConvertlegacydocumentstoHTMLformatFiltersareusefulwhenthedocumentsalreadyexistAuthoringtools-HoTMetaL,HTMLAssistant-SharewarePreconfiguredv/sIntegratedInternetProductsIntegratedInternetProducts-FrommultiplevendorsPreconfiguredSystems-WebServerandaClientreadytouseSun'sNetraInternetServerSGI'sWebFORCEIndyandWebFORCEChallengeSApple'sInternetServerSolutionDEC'sInternetAlphaServerIntegraph'sWebServer10FutureDirectionsAdditionstoHTML(Grammar,Maths,Displaycontrol)VRML(VirtualRealityMarkupLanguage)Security-UsingScramblingandEncryptionCommonClientInterface(CCI)-AllowsClientstopassinformationbackandforthbetweentheBrowserandtheExternalViewerChargeMechanismsPerformanceEnhancements-SendingapageandgraphicsforthatpageinoneconnectionInternetinEducation*InstitutionWebSite:-abouttheuniversity-facultiesanddepartmentdetails-researchfacilities,area,andgroups-facultymembersdetailswiththeirpublications*AdmissionProcess:-courseannouncement,-makingavailabledetailsofcourse-admissionapplications,-announcementofselection*UniversityFacilities:-computingfacilities,accommodation,recreation,etc.
.
*TeachingProcess:-UseofWWWintheCurriculum-HomeworkandQuizzes-VirtualClassroom-VirtualLectures-StudentInteraction-Q&A*CreatingYourOwnPageHTMLTags(Title,Body,images,etc.
)BasicHTMLcode&filestructureLinksandAnchors;Linkingitelsewhere:MovingaroundtheWWWMakingitallLook'Pretty'*Usecomponentssuchas:-WWWForms,Frames,Sound,Video,-Animation,WWWPlugins*Makewebattractivethrough:Addingwebapplications:-customerenquiry-FreeapplicationsInternetasadeliveryVehicleInterestingURLshttp://www.
whitehouse.
gov(TheWhiteHouse)http://www.
w3.
org(EverythingabouttheWWW)http://sunsite.
unc.
edu(SoftwareonSun)http://www.
indnet.
org(IndiaNetFoundationServices)telnet://www.
arbornet.
org(FreePublicAccessUnixSystem)http://www.
infoseek.
com(Searchengines,AddURL)http://www.
infophil.
com(WorldAlumnionthenet)http://www.
rocketmail.
com(FreeEmail)http://members.
tripod.
com(FreeWebsite,2MBspace)http://www.
bangaloreonline.
com(Offersvirtualwebservvicesforcompiniestohosttheirwebsite).
http://www.
prajavani.
com(Kannadanewspaperonweb)ClassSitesToVisithttp://truth.
phil.
vt.
edu/wwwcourses.
htmlhttp://http://fiddle.
visc.
ece.
vt.
edu/courses/ee2504/http://adept.
stanford.
edu/http://www.
aoe.
vt.
edu/aoe5104.
htmlhttp://nersp.
nerdc.
ufl.
edu/~cgs2422/http://www.
sloan.
org/oakley/misc/IMNews.
htmlhttp://www.
eng.
fsu.
edu/net98.
htmlAPIBottleneckNetworkLANLANPCSUNMACServerTheOS-PlatformlockApplicationApplicationApplicationApplicationApplicationOSApplicationstiedtoOSOStiedtoPlatformApplicationApplicationApplicationApplicationApplicationBROWSEROSOSOSOSTheWeb*SeededbyHTMLfromCERN*RevolutionisedbyMOSAIC*Standardised,universalinterfacetodata*Graphical*Broadcastcapability-publishonce,reachmillionsMakinglifeeasier!
DataonthewebBrowserplatformindependentClickonapplication-runonanymachineJavatheprogramminglanguageofthe21centuryJavaandJavaComputingJava-AnIntroductionJava-ThenewprogramminglanguagefromSunMicrosystemsJava-AllowsanyonetopublishawebpagewithJavacodeinitJava-CPUIndependentlanguageCreatedforconsumerelectronicsJava-James,ArthurVan,andothersJava-ThenamethatsurvivedapatentsearchOak-ThepredecessorofJavaJavais"C+JavaFrom10,000Ft.
Accordingtotheworld,Javais.
.
.
AccordingtoSun,Javais.
.
.
Oncloserinspection,JavaisAccordingtotheWorld,JavaIs.
.
.
SnazzyWebpagesThecross-platformlanguagewewantTherest-of-the-worldsanswertoBillTheC++replacementweneedTheC++replacementwedontneedAbunchofhypeAccordingtoSun,Javais.
.
.
SimpleandPowerfulObjectOrientedPortableArchitectureNeutralDistributedMulti-threadedRobust,Secure/SafeInterpretedHighPerformanceDynamicpogramminglanguage/platform.
Buzzwordcompliant!
OnCloserInspection,Javais.
.
.
SimplePurePortableSurprisinglyeffectiveAsawhole,JavaisaComprehensiveProgrammingSolutionObjectOrientedPortableHighPerformanceGearedforDistributedEnvironmentsSecureJavaasObjectOriented"Objectsallthewaydown"SimpleandFamiliar:"C++Lite"NoPointers!
GarbageCollectorDynamicBindingSingleInheritancewith"Interfaces"JavaasPortableUnlikeotherlanguagecompilers,Javacompliergeneratescode(bytecodes)forUniversalMachine.
JavaVirtualMachine(JVM):InterpretsbytecodesatruntimeArchitectureNeutralNoLinkPhaseHigherLevelPortableFeatures:AWT,UnicodeTotalPlatformIndependenceJAVACOMPILERJAVABYTECODEJAVAINTERPRETERWindows95MacintoshSolarisWindowsNT(translator)(sameforallplatforms)(oneforeachdifferentsystem)JavaWriteOnce,RunAnywhereArchitectureNeutral&PortableJavaCompiler-JavasourcecodetobytecodeBytecode-anintermediateform,closertomachinerepresentationAvirtualmachineonanytargetplatforminterpretsthebytecodePortingthejavasystemtoanynewplatforminvolveswritinganinterpreterthatsupportstheJavaVirtualMachineTheinterpreterwillfigureoutwhattheequivalentmachinedependentcodetorunJavaasHighPerformanceJVMuses"leanandmean"bytecodesSmallbinaryclassfiltesJust-in-timeCompilersMultithreadingNativeMethodsJavaintheWorldofDistributedComputingClassLoaderLightweightBinaryClassFilesMultithreadingDynamicGoodcommunicationconstructsSecureJavaasSecureLanguagedesignedassafeStrictcompilerDynamicRuntimeLoading(Verifier)RuntimeSecurityManagerObjectOrientedLanguages-aComparisonFeatureC++ObjectiveCAdaJavaEncapsulationYesYesYesYesInheritanceYesYesNoYesMultipleInherit.
YesYesNoNoPolymorphismYesYesYesYesBinding(Early/Late)BothBothEarlyLateConcurrencyPoorPoorDifficultYesGarbageCollectionNoYesNoYesGenericityYesNoYesNoClassLibrariesYesYesLimitedYesJavabetterthanC++NoTypedefs,Defines,orPreprocessorNoGlobalVariablesNoGotostatementsNoPointersNoUnsafeStructuresNoMultipleInheritanceNoOperatorOverloadingNoAutomaticCoercionsNoFragileDataTypesBasicDataTypesTypesbooleaneithertrueoffalsechar16bitUnicode1.
1byte8-bitinteger(signed)short16-bitinteger(signed)int32-bitinteger(signed)long64-bitinteger(singed)float32-bitfloatingpoint(IEEE754-1985)double64-bitfloatingpoint(IEEE754-1985)String(classformanipulatingstrings)JavausesUnicodetorepresentcharactersinternallyJavaIntegratesPowerofCompiledLanguagesandFlexibilityofInterpretedLanguagesTwoTypesofJavaApplicationsDifferentwaystowrite/runaJavacodesare:Application-Astand-aloneprogramthatcanbeinvokedfromcommandline.
Aprogramthathasa"main"methodApplet-Aprogramembeddedinawebpage,toberunwhenthepageisbrowsed.
Aprogramthatcontainsno"main"methodApplication-JavainterpreterApplets-Javaenabledwebbrowser(LinkedtoHTMLviatag.
inhtmlfile)JavaBytecodesmovelocallyorthroughnetworkJavaSource(.
java)JavaCompilerJavaBytecode(.
class)JavaInterpreterJustinTimeCompilerRuntimeSystemClassLoaderBytecodeVerifierJavaClassLibrariesOperatingSystemHardwareJavaVirtualmachineRuntimeEnvironmentCompile-timeEnvironmentJavaEnvironment/LifeCycleofJavaCodeJavaDevelopmentKitjavac-TheJavaCompilerjava-TheJavaInterpreterjdb-TheJavaDebuggerappletviewer-Tooltoruntheappletsjavap-toprinttheJavabytecodesjavaprof-Javaprofilerjavadoc-documentationgeneratorjavah-createsCheaderfilesHelloInternet//hello.
java:HelloInternetprogramclassHelloInternet{publicstaticvoidmain(Stringargs[System.
out.
println("HelloInternet"ProgramProcessingCompilation#javachello.
javaresultsinHelloInternet.
classExecution#javaHelloInternetHelloInternet#SimpleJavaApplet//HelloWorld.
java:Asampleappletimportjava.
applet.
Applet;publicclassHelloWorldextendsApplet{publicvoidpaint(Graphicsg){g.
drawString("HelloWorld!
",25,25);}}CallinganAppletHelloWorlsAppletExecutionofAppletsHelloHelloJava4APPLETDevelopment"hello.
java"ATCDAC-IndiaTheInternethello.
classATC-DAC'SWEBSERVER2315CreateApplettaginHTMLdocumentAccessingfromCRAYCorp.
(USA)ThebrowsercreatesanewwindowandanewthreadandthenrunsthecodeWebPerspectiveHowdidWebinteractionsworkHowdotheyworkwithJavaDistributedJavaobjectsandtheWebClassicalWebPerspectiveJavaWebPerspectiveSignificanceofdownloadingAppletsInteractiveWWWFlashyanimationinsteadofstaticwebpagesAppletsreacttousersinputanddynamicallychangeDisplayofdynamicdataWWWwithJava-morethanadocumentpublishingmediumhttp://www.
javasoft.
com/applets/alpha/applets/StockDemo/standalone.
htmlPowerofJavaandtheWebDeliverapplications,notjustinformationEliminateportingEliminateend-userinstallationSlashsoftwaredistributioncostsReachmillionsofcustomers-instantlyLifecycleofJavaCodeBytecodeVerifierCalledwhenclassisfirstloadedinruntimeenvironmentVerifiesbytecodesmeetcertainsetofpropertiesVerifierusesTheoremProverVerifiedcoderunsfasterAfterverification,interpreterdefinesmemorylayoutClassLoaderUnique"Namespace"foreachoriginLocalnamespaceclassesarecalled"built-ins"Preventsclass"spoofing"SecurityManagerPreventsunauthorizeddiskread/writesRestrictsnetworkaccessOtheraccessrestrictions(nativemethods)ImplementationisbrowserdependentGeneralLanguageFeaturesC/C++likesyntaxNopointersObjectsallthewaydownObjectsrequestservicesofotherobjectsthroughmessagesMessagesresultininvocationofclassmethodsRemovedFromC++OperatoroverloadingPointersandArray/pointersMultiple-inheritanceofimplementationEnum,typedef,#defineCopyconstructors,destructorsTemplatesAndotherstuff.
.
.
.
AddedorImprovedoverC++Interfaces:typeVs.
classGarbagecollectionExceptions(MorepowerfulthanC++)StringsInstanceofPackageMulti-threadsDeclaringClassesclassQueue{Objectdata[];Queue(intsize)Constructordata=newObject[size];}voidadd(Objecto)addtoarrayinclassspecificmanner.
othermethods…}InheritanceinJavaclassPriorityQueueextendsQueue{PriorityQueue(intsize)Constructorsuper(size);//CallQueueconstructor:usedata[]//Classspecificinitialization}voidadd(Objecto)Overridenmethod//addtoarrayinclassspecificmanner.
othermethods…}CreatingandUsingObjectsPriorityQueuep=newPriorityQueue(10);//Qofsize10Strings="Thisisastring";p.
add(s);//Addstringtopriorityqueue…p.
add(this);//Addobjectcallingthiscodetoqueue.
.
.
ClassMethodsandVariablesintpi=Math.
PI;inttheMax=Math.
max(x,6);Definitions:publicfinalstaticdoublePI=3.
14159265358979323846;publicstaticintmax(inta,intb);AccessRulespublicprivateprotectedpackage(Default-nokeyword)UsingThreadsDefineaThreadclasspublicMyThreadextendsThread{publicvoidrun(Overridedefaultmethodwhile(true){//docustomcode…….
UsingthethreadMyThreadt=newMyThread();t.
start();//Startthethread.
.
.
DetaileddiscussiononThreads,laterStringsThelanguagedefinesstringsasobjectsdoSomething("abc"+"cde");doSomething(Strings){.
.
}Stringabc=newString("Hello");System.
out.
println(abc);ExceptionsTry,catch,throw,finallytry{failure_Prone_Call();}catch(File_Exceptionf){.
.
.
.
Handlef.
.
.
.
}finally{do_This_Regardless();}Exceptionsignaturesarechecked:voidfoo()throwsTypeC;ExceptionsmustbecaughtordeclaredErrorsdonothavetobecaughtSurprisinglyeffectiveatproducingrobustcodeExceptionHandlingtry{//…somecodehere.
.
.
intx=y/z;}catch(ArithmeticExceptione){System.
out.
println("Dividebyzeroerror!
")}catch(Exceptione){System.
out.
println("Someothererror!
")}finally{//Optional.
.
.
++z;}MoreaboutExceptionsVeryStrictExceptionHandlingRules:Allmethodsthatthrowanexceptionmustbecaughtorrethrown(exceptforruntimeexceptions)HierarchyofExceptionclassesCancreatecustomExceptionclassesCauseownexceptionwith"throw"clauseInterfacesInterfacesareawaytodeclareanAbstracttypewithoutimplementationInterfacesarelikeclassesbutwithoutimplementationInterfacesareexpressionsofpuredesignsonlyExampleInterfaceinterfacesqrt{intsqrt(intnewint)Implementinganinterfaceclassmyclassimplementssqrt{Interface:TypeandSub-TypePuretypeofasetofobjectsinterfaceObserver{voidupdate(Observableo);}InterfacescanformagraphinterfaceList_ObserverextendsObserver{voidupdateItem(intposition);}ClassImplementsInterfaceCompletetype/classseparationpossibleclassOrderimplementsObserver{publicvoidupdate(Objecto)dostufftoupdatedataandotherimplementation}AnyobjectcansupportmultipleinterfacesClientcanseeitstypesseparatelyorconjoinedApowerfulapproachtodesign,roles,distribution,designpatternsTakesalittlebitofgettingusedtoImplementationInheritanceSingleinheritanceofimplementationclassXextendsWimplementsE,F{//StuffinclassX}InterfacesandClasses!
UsesofInterfacesThereareconsiderableproblemsduetoMultipleInheritanceInterfacesinawayaddmultipleinheritancetoJavaInterfacesmaybeextendedtoo,morethanonceGarbageCollectedNomoremanualmemorymanagementclassRecycler{publicvoidrecycle(){Hashtablet;for(inti=0;iStringline=kbd.
readLine(os.
writeBytes(line+"\n");EchoServerClient.
.
if(line.
equals("end"os.
close();is.
close();slink.
close(break;}Stringline2=is.
readLine();System.
out.
println("Output:"+line2);}catch(IOExceptione){System.
out.
println(e);}}}publicstaticvoidmain(String[]args){if(args.
lengthnoofCPUsP1P2P3timeCPUMultithreading-MultiprocessorsConcurrencyVsParallelismP1P2P3timeNoofexecutionprocess=noofCPUsCPUCPUCPUThreadsJavahasbuiltinthreadsupportforMultithreadingSynchronizationThreadSchedulingInter-ThreadCommunication:currentThreadstartsetPriorityyieldrungetPrioritysleepstopsuspendresumeJavaGarbageCollectorisalow-prioritythreadThreadingMechanisms.
.
.
CreateaclassthatextendstheThreadclassCreateaclassthatimplementstheRunnableinterface1stmethod:ExtendingThreadclass1stMethod:ExtendingtheThreadclassclassMyThreadextendsThread{publicvoidrun(threadbodyofexecution}}Creatingthread:MyThreadthr1=newMyThread();StartExecution:thr1.
start();2ndmethod:ThreadsbyimplementingRunnableinterfaceclassClassNameimplementsRunnable{publicvoidrun(threadbodyofexecution}}CreatingObject:ClassNamemyObject=newClassName();CreatingThreadObject:Threadthr1=newThread(myObject);StartExecution:thr1.
start();Multi-ThreadedThreadanditssubclassesrunonethreadperinstanceclassMyThreadextendsThread{publicvoidrun(){.
.
.
Startrunning}}AnyRunnableobjectcanwrapathreadarounditselfclassServerimplementsRunnable{Threadt;Server(){t=newThread(this);.
}publicvoidrun(){.
.
.
Startrunning}}Threadcontrol:Thread.
start(),Thread.
stop()ManipulationofCurrentThread//CurrentThreadDemo.
javaclassCurrentThreadDemo{publicstaticvoidmain(Stringarg[Threadct=Thread.
currentThread(ct.
setName("MyThread"System.
out.
println("CurrentThread:"+ct);tryfor(inti=5;i>0;i-System.
out.
println(""+i)Thread.
sleep(1000)catch(InterruptedExceptione)System.
out.
println("Interrupted.
Run:CurrentThread:Thread[MyThread,5,main]54321CreatingnewThread.
.
.
//ThreadDemo.
javaclassThreadDemoimplementsRunnable{ThreadDemo(Threadct=Thread.
currentThread(System.
out.
println("CurrentThread:"+ct);Threadt=newThread(this,"DemoThread"t.
start(tryThread.
sleep(3000)catch(InterruptedExceptione)System.
out.
println("Interrupted.
System.
out.
println("Exitingmainthread.
");}.
.
.
CreatingnewThread.
publicvoidrun(tryfor(inti=5;i>0;i-System.
out.
println(""+i)Thread.
sleep(1000)catch(InterruptedExceptione)System.
out.
println("Childinterrupted.
System.
out.
println("Exitingchildthread.
publicstaticvoidmain(Stringargs[newThreadDemo();}}Run:CurrentThread:Thread[main,5,main]543Exitingmainthread.
21Exitingchildthread.
ThreadPriority.
.
.
//HiLoPri.
javaclassClickerimplementsRunnable{intclick=0;privateThreadt;privatebooleanrunning=true;publicClicker(intp)t=newThread(this);t.
setPriority(p)publicvoidrun(while(running)click+publicvoidstart(t.
start(publicvoidstop(running=false;}}.
.
.
ThreadPriorityclassHiLoPri{publicstaticvoidmain(Stringargs[Thread.
currentThread().
setPriority(Thread.
MAX_PRIORITY);ClickerHi=newClicker(Thread.
NORM_PRIORITY+2);ClickerLo=newClicker(Thread.
NORM_PRIORITY-2);Lo.
start(Hi.
start(try{Thread.
sleep(10000)catch(Exceptione)Lo.
stop(Hi.
stop(System.
out.
println(Lo.
click+"vs.
"+Hi.
click);}}Run1:(onSolaris)0vs.
956228Run2:(Window95)304300vs.
4066666ThreadsNeedSynchronizationServerinstanceslockthemselvesatmethod-levelclassBuffer{//synchronizeonbufferinstancepublicsynchronizedvoidput(inti).
.
.
publicsynchronizedintget().
voidsafe().
}Clientinstancelocksaserverobjectbeforeusingitsynchronized(array_to_sort)wait();//withinsynchronizedmethodnotify();notifyall();//wakeupfromawaitMonitormodel(forSyncronisation)Method1Method2Block1KeyThreadsMonitor(synchronised)solvesrace-conditionproblemThreadsSynchronisation.
.
.
//Synch.
java:race-conditionwithoutsynchronisationclassCallme{//Checksynchronizedandunsynchronizedmethods/*synchronized*/voidcall(Stringmsg)System.
out.
print("["+msg);try{Thread.
sleep(1000)catch(Exceptione)System.
out.
println(classCallerimplementsRunnable{Stringmsg;CallmeTarget;publicCaller(Callmet,Strings)Target=t;msg=s;newThread(this).
start();}.
.
.
ThreadsSynchronisation.
publicvoidrun(Target.
call(msg);}}classSynch{publicstaticvoidmain(Stringargs[CallmeTarget=newCallme(newCaller(Target,"Hello"newCaller(Target,"Synchronized"newCaller(Target,"World");}}Run1:Withunsynchronizedcallmethod(racecondition)[Hello[Synchronized[World]]]Run2:Withsynchronizedcallmethod[Hello][Synchronized][World]Run3:Synchronizedobjectinrun():synchronized(Target){Target.
call(msg);}TheoutputisthesameasRun2Queue(nointer-threadedcommunication).
.
.
//pc.
java:produceandconsumerclassQueue{intn;synchronizedintget(System.
out.
println("Got:"+n);returnn;}synchronizedvoidput(intn){this.
n=n;System.
out.
println("Put:"+n);}}classProducerimplementsRunnable{QueueQ;Producer(Queueq)Q=q;newThread(this,"Producer").
start();}Queue(nointer-threadedcommunication).
.
.
publicvoidrun(inti=0;while(true)Q.
put(i+classConsumerimplementsRunnable{QueueQ;Consumer(Queueq)Q=q;newThread(this,"Consumer").
start(publicvoidrun(while(true)Q.
get();}}.
.
.
Queue(nointer-threadedcommunication).
classPC{publicstaticvoidmain(String[]args)QueueQ=newQueue(newProducer(Q);newConsumer(Q);}}Run:Put:1Got:1Got:1Got:1Put:2Put:3Got:3^CQueue(interthreadcommunication).
.
.
//PCnew.
java:produce-consumenrwithinterthreadcommunicationclassQueue{intn;booleanValueSet=false;synchronizedintget(tryif(!
ValueSet)wait(catch(InterruptedExceptione)System.
out.
println("Got:"+n);ValueSet=false;notify(returnn;}Queue(interthreadcommunication).
.
.
synchronizedvoidput(intn)tryif(ValueSet)wait(catch(InterruptedExceptione)this.
n=n;System.
out.
println("Put:"+n);ValueSet=true;notify();}}classProducerimplementsRunnable{QueueQ;Producer(Queueq)Q=q;newThread(this,"Producer").
start();}Queue(interthreadcommunication).
.
.
publicvoidrun(inti=0;while(true)Q.
put(i+classConsumerimplementsRunnable{QueueQ;Consumer(Queueq)Q=q;newThread(this,"Consumer").
start(publicvoidrun(while(true)Q.
get();}}.
.
.
Queue(nointerthreadcommunication).
classPCnew{publicstaticvoidmain(String[]args)QueueQ=newQueue(newProducer(Q);newConsumer(Q);}}Run:Put:0Got:0Put:1Got:1Put:2Got:2Put:3Got:3Put:4Got:4^CDeadlock.
.
.
//DeadLock.
javaclassA{synchronizedvoidfoo(Bb)Stringname=Thread.
currentThread().
getName(System.
out.
println(name+"enteredA.
foo"tryThread.
sleep(1000)catch(Exceptione)System.
out.
println(name+"tryingtocallB.
last(b.
last(synchronizedvoidlast(System.
out.
println("InsideA.
last");}}Deadlock.
.
.
classB{synchronizedvoidbar(Aa)Stringname=Thread.
currentThread().
getName(System.
out.
println(name+"enteredB.
bar"tryThread.
sleep(1000)catch(Exceptione)System.
out.
println(name+"tryingtocallA.
last(a.
last(synchronizedvoidlast(System.
out.
println("InsideB.
last");}}.
.
.
Deadlock.
classDeadLockimplementsRunnable{Aa=newA();Bb=newB();DeadLock(Thread.
currentThread().
setName("MainThread"newThread(this).
start(a.
foo(b);System.
out.
println("Backinthemainthread.
publicvoidrun(Thread.
currentThread().
setName("RacingThread"b.
bar(a);System.
out.
println("Backintheotherthread"publicstaticvoidmain(Stringargs[newDeadLock();}}Run:MainThreadenteredA.
fooRacingThreadenteredB.
barMainThreadtryingtocallB.
last()RacingThreadtryingtocallA.
last()^CThreadsinAction.
.
.
Cooperativethreads-FileCopyreader(lock(buff[i]);read(src,buff[i]);unlock(buff[i]writer(lock(buff[i]);write(src,buff[i]);unlock(buff[i]buff[0]buff[1]CooperativeParallelSynchronizedThreadsServerThreadsMessagePassingFacilityServerProcessClientProcessClientProcessUserModeKernelModeThreadsinAction.
.
.
MultithreadedServerALookInsidetheJavaPlatformJavaVirtualMachinePortingInterfaceAppletsandApplicationsJavaBaseAPIJavaBaseClassesJavaStandardExtensionAPIJavaStandardExtensionClassesAdapterOSHardwareAdapterOSHardwareJavaOSHardwareTheJavaBasePlatform(inblack)AdapterBrowserOSHardwareNetworkJavaonaBrowserJavaonaDesktopOSJavaonaSmallerOSJavaonJavaOSJavaApplications!
JavaapplicationsarenowavailableCostofmanfgzero,costofdistributionzero,costofmarketingzero!
HotJavaislean-loadseverythingelsefromthenet.
Javaitselfissmall-40kto225kNewclassofsmallmachineswillemergeJavaoncellularphones,creditcards,washingmachines,andeverywhereInternetUniversalInterfaceWebServerswithJAVAapplicationsClientsrunninganyOSonanyplatformJavaonmyplatformSun(SPARC)ftp://java.
sun.
comSun(x86)ftp://xm.
com:/pub/IBM(Aix,OS/2)ftp://ncc.
hursley.
ibm.
com/javainfoDEC(AlphaOSF/1)http://www.
gr.
osf.
org:8001/projects/web/java/SGIhttp://liawww.
epfl.
ch/~simon/java/irix-jdk.
htmlHPhttp://www.
gr.
osf.
org:8001/projects/web/javaLinuxhttp://www.
blackdown.
orgAT&Thttp://www.
gr.
osf.
org:8001/projects/web/javaWindows3.
1http://www.
alphaworks.
ibm.
comJavaDevelopmentTools(PresentandPlanned)Sun'sJavaWorkShopJDK:CompilerandruntimeenvironmentClassLibrariesDocumentationjavadoc-AutomatedDocumentationTakescommentsandconvertstoHTMLIDE:VisualJava,andintegratedtools,JavaBeansOtherProductsandAPI:JavaHelp,JavaCard,JavaBlend,JavaOS,JavaMail,JavaManagement,JavaElectronicCommerceFrameworkJavaEnterpriseAPI:JavaNamingandDirectoryInterface,JavaIDL,JDBC,RMIandObjectSerializationSymantecCafe1.
0(Released)FullIDEforWindows95/NTGraphicDevelopmentToolsTwoCompilersDebuggerClassBrowserMicrosoftJakarta(Planned)VisualC++typeinterfaceWillSupportActiveX/COMInternetExplorer3.
0willhaveJust-In-TimeJavacompilerBorlandJBuilderVisualRADworkbenchformaximumproductivity.
RapidApplicationDevelopment(RAD)andOpenComponentArchitecturepatternedafterDelphi.
100+JavaBeancomponents,withsourcecode,fordrag-and-dropapplications.
BeansExpress--easiestwaytocreateindustry-standardJava-Beancomponents.
DataExpress--thefastestwaytobuildbusinessanddatabaseappplications.
BorlandDataGatewayforJavaconnectivitytoallmajordatabaseservers.
Multi-tierapplicationswithintegratedRMIandCORBA.
Versions:Standard,Professional,&Client/ServerChallenges&PossibleDirectionsPerformanceAWT-needbetterGUI!
MaintainingInteroperabilitySecurity-currentrestrictionslimitwhatcanbedoneNativeCompilersIsPortabilitythatImportantCommentsJavaisafunandeasyprogramminglanguagePortability=MediocrityJavawillbecomeaprogramminglanguageofchoice,butmaytakeonafinalformthatwillsurprisemany!
JDBCJavaAPIforRelationalDatabasesBeingstandardizedbyallmajorplayersJavascriptandJava(Preview)JavascriptcancontrolJavaappletsStaticdataaccessibleaspropertiesofappletvari=Bank.
Account.
countPublicmethodsinvocableonJavainstancesProvidedthoseinstancesareaccessiblethroughtheAppletAppletisaccessiblethroughdocumentdocument.
applet_Name_Attribute.
do_Stuff()JavaforHPC!
Manyeffortsareininprogressformakingjavaasalanguageforparallelprogramming.
Javacomputingframeworks(HPC,numeric,dataparallel)Javaindistributedsimulationsandapplications(e.
g.
,real-worldHPC,grandchalenge)Sourcetosourcetranslators(C,Fortran,C++toJava)WebbasedcomputationenvironmentinJavaJavaforHPCconference:http://www.
cs.
ucsb.
edu/conferences/java98JavaforScienceandEngineeringcomputing:subscribejava-for-csetomajordomo@npac.
syr.
eduhttp://www.
jhpc.
orgHowtoConvertProgramstoAWT1.
1.
.
.
1.
Changesourcecodesothatitimporteventpackage:importjava.
awt.
event.
*;2.
Figureoutwhichcomponentgenerateseacheventtype:(1.
0useshandleEvent()andaction())Button,List,MenuItem,TextField:Interface:ActionListenerMethod:actionPerformed(ActionEventevent)Checkbox,CheckboxMenuItem,Choice:Interface:ItemListenerMethod:itemStateChanged(.
.
)Dialog,Frame:Interface:WindowListenerMethod:windowClosing(),windowOpened(),.
.
.
HowtoConvertProgramstoAWT1.
1.
.
.
3.
ChangeclassdeclarationsothatclassimplementspublicclassMyClassextendsSomeComponentimplementsActionListener4.
RegisteractionListenernewComponentObject.
addActionListener(this);5.
Changeeventhandlingmethod:Old:publicbooleanaction(Evente,Objectarg)New:publicvoidactionPerformed(ActionEvente)HowtoConvertProgramstoAWT1.
16.
Deletetheeventhandlingcodeinthisway(a)Deleteallreturnstatements(b)Changee.
targettoe.
getSource()(c)Deleteallcodetheunnecessarilytestsforwhichcomponenttheeventcomefrom(d)PerformanyothermodificationrequiretomaketheprogramcompileJusttoSummarizeJavaasaComprehensiveProgrammingSolutionObjectOrientedPortableHighPerformanceGearedforDistributedEnvironmentsSecureHighlysuitableforInternetprogrammingSummaryJavaisreallyverywellpoisedIncredibleleveragefromtheWebWillimpacttheC++andSmalltalkmarketsRateofprogressisastonishinglyhighDevelopmentenvironmentsCORBAlinkagesComponentsFastenyouseat-belts!
TheEndQuestionsThankYou.
.
.
RAKsmart 商家我们肯定不算陌生,目前主要的营销客户群肯定是我们。于是在去年的时候有新增很多很多的机房,比如也有测试过的日本、香港、美国机房,这不今年有新增韩国机房(记得去年是不是也有增加过)。且如果没有记错的话,之前VPS主机也有一次磁盘故障的问题。
这不今天有看到商家新增韩国服务器产品,当然目前我还不清楚商家韩国服务器的线路和速度情况,后面我搞一台测试机进行...
imidc怎么样?imidc彩虹数据或彩虹网络现在促销旗下日本多IP站群独立服务器,原价159美元的机器现在只需要88美元,而且给13个独立IPv4,30Mbps直连带宽,不限制月流量!IMIDC又名为彩虹数据,rainbow cloud,香港本土运营商,全线产品都是商家自营的,自有IP网络资源等,提供的产品包括VPS主机、独立服务器、站群独立服务器等,数据中心区域包括香港、日本、台湾、美国和南非...
俄罗斯vps云服务器商家推荐!俄罗斯VPS,也叫毛子主机(毛子vps),因为俄罗斯离中国大陆比较近,所以俄罗斯VPS的延迟会比较低,国内用户也不少,例如新西伯利亚机房和莫斯科机房都是比较热门的俄罗斯机房。这里为大家整理推荐一些好用的俄罗斯VPS云服务器,这里主要推荐这三家:justhost、ruvds、justg等俄罗斯vps主机,方便大家对比购买适合自己的俄罗斯VPS。一、俄罗斯VPS介绍俄罗斯...
spaceos为你推荐
阿丽克丝·布莱肯瑞吉阿丽克斯布莱肯瑞吉演的美国恐怖故事哪两集bbs.99nets.com做一款即时通讯软件难吗 像hi qq这类的杰景新特杰德特这个英雄怎么样冯媛甑尸城女主角叫什么名字xyq.163.cbg.com梦幻西游里,CBG是什么?在那里,能帮忙详细说一下吗月神谭求古典武侠类的变身小说~!百花百游百花百游的五滴自游进程www.99cycy.com谁在这个http://www.sifangmall.com网站上买过东西?mole.61.com摩尔庄园RK的秘密是什么?www.33xj.compro/engineer 在哪里下载,为什么找不到下载网站?
cn域名价格 罗马假日广场 圣迭戈 paypal认证 60g硬盘 万网优惠券 国内加速器 193邮箱 申请个人网站 韩国名字大全 最好的qq空间 web服务器搭建 架设邮件服务器 starry 云服务器比较 工信部网站备案查询 注册阿里云邮箱 114dns 购买空间 锐速 更多