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.
.
.
Webhosting24宣布自7月1日起开始对日本机房的VPS进行NVMe和流量大升级,几乎是翻倍了硬盘和流量,价格依旧不变。目前来看,日本VPS国内过去走的是NTT直连,服务器托管机房应该是CDN77*(也就是datapacket.com),加上高性能平台(AMD Ryzen 9 3900X+NVMe),还是有相当大的性价比的。此外在6月30日,又新增了洛杉矶机房,CPU为AMD Ryzen 9...
Hostiger商家我们可能以前也是有见过的,以前他们的域名是Hostigger,后来进行微调后包装成现在的。而且推出Columbus Day哥伦布日优惠活动,提供全场的VPS主机首月7折月付2.79美元起的优惠。这里我们普及一下基础知识,Columbus Day ,即为每年10月12日,是一些美洲国家的节日,纪念克里斯托弗·哥伦布在北美登陆,为美国的联邦假日。Hostiger 商家是一个成立于2...
IMIDC是一家香港本土运营商,商家名为彩虹数据(Rainbow Cloud),全线产品自营,自有IP网络资源等,提供的产品包括VPS主机、独立服务器、站群独立服务器等,数据中心区域包括香港、日本、台湾、美国和南非等地机房,CN2网络直连到中国大陆。目前主机商针对日本独立服务器做促销活动,而且提供/28 IPv4,国内直连带宽优惠后每月仅88美元起。JP Multiple IP Customize...
spaceos为你推荐
今日油条油条每周最多能吃多少商标注册流程及费用我想注册商标一般需要什么流程和费用?地陷裂口山崩地裂的意思partnersonline国外外贸平台有哪些?javlibrary.comImage Library Sell Photos Digital Photos Photo Sharing Photo Restoration Digital Photos Photo Albumswww.147.qqq.comWWW147EEE.COM这个网站现在改哪个网址了铂金血痕身上血痕怎么回事凤阙寒宫男主是凤倾城女主叫凤官官的小说叫什么carlymilocarly rae jepsen身高是多少源代码什么是源代码
唯品秀 美国主机网 免费名片模板 http500内部服务器错误 ssh帐号 12306抢票助手 免费博客空间 亚洲小于500m bgp双线 免费吧 腾讯实名认证中心 服务器是干什么的 33456 服务器硬件防火墙 360云服务 1元域名 架设邮件服务器 新加坡空间 中国linux photobucket 更多