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.
.
.

virmach:AMD平台小鸡,赌一把,单车变摩托?$7.2/年-512M内存/1核/10gSSD/1T流量,多机房可选

virmach送来了夏季促销,价格低到爆炸,而且在低价的基础上还搞首年8折,也就是说VPS低至7.2美元/年。不过,这里有一点要说明:你所购买的当前的VPS将会在09/30/2021 ~ 04/30/2022进行服务器转移,而且IP还会改变,当前的Intel平台会换成AMD平台,机房也会变动(目前来看以后会从colocrossing切换到INAP和Psychz),采取的是就近原则,原来的水牛城可能...

hostkvm:美国VPS,三网强制CU-VIP线路,$5/月,1G内存/1核/15gSSD/500g流量

hostkvm在2021年3月新上线洛杉矶新VPS业务,强制三网接入中国联通优化线路,是当前中美之间性价比最高、最火热的线路之一,性价比高、速度非常好,接近联通AS9929和电信AS4809的效果,带宽充裕,晚高峰也不爆炸。 官方网站:https://hostkvm.com 全场优惠码:2021(全场通用八折,终身码,长期) 美国 US-Plan0【三网联通优化线路】 内存:1G CPU:...

TabbyCloud周年庆&七夕节活动 美國INAP 香港CN2

TabbyCloud迎来一周岁的生日啦!在这一年里,感谢您包容我们的不足和缺点,在您的理解与建议下我们也在不断改变与成长。为庆祝TabbyCloud运营一周年和七夕节,TabbyCloud推出以下活动。TabbyCloud周年庆&七夕节活动官方网站:https://tabbycloud.com/香港CN2: https://tabbycloud.com/cart.php?gid=16购买链...

spaceos为你推荐
梦之队官网史上最强的nba梦之队是哪一年留学生认证留学生前阶段双认证认证什么内容?广东GDP破10万亿想知道广东城市的GDP排名原代码什么是原代码lunwenjiancepaperfree论文检测安全吗百度关键词工具如何利用百度关键词推荐工具选取关键词www.522av.com现在怎样在手机上看AVwww.haole012.com012.qq.com是真的吗javmoo.com0904-javbo.net_avop210hhb主人公叫什么,好喜欢,有知道的吗javbibi日文里的bibi是什么意思
已备案未注册域名 域名备案网站 singlehop 256m内存 linode 私服服务器 新世界电讯 正版win8.1升级win10 java虚拟主机 全站静态化 坐公交投2700元 40g硬盘 免费mysql 秒杀预告 ntfs格式分区 泉州电信 网通服务器托管 国外ip加速器 raid10 免费ftp 更多