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

野草云提供适合入门建站香港云服务器 年付138元起 3M带宽 2GB内存

野草云服务商在前面的文章中也有多次提到,算是一个国内的小众服务商。促销活动也不是很多,比较专注个人云服务用户业务,之前和站长聊到不少网友选择他们家是用来做网站的。这不看到商家有提供香港云服务器的优惠促销,可选CN2、BGP线路、支持Linux与windows系统,支持故障自动迁移,使用NVMe优化的Ceph集群存储,比较适合建站用户选择使用,最低年付138元 。野草云(原野草主机),公司成立于20...

BuyVM商家4个机房的官方测试IP地址和测速文件

BuyVM 商家算是有一些年头,从早年提供低价便宜VPS主机深受广大网友抢购且也遭到吐槽的是因为审核账户太过于严格。毕竟我们国内的个人注册账户喜欢账户资料乱写,毕竟我们看英文信息有些还是比较难以识别的,于是就注册信息的时候随便打一些字符,这些是不能通过的。前几天,我们可以看到BUYVM商家有新增加迈阿密机房,而且商家有提供大硬盘且不限制流量的VPS主机,深受有一些网友的喜欢。目前,BUYVM商家有...

RAKsmart(年79元),云服务器年付套餐汇总 - 香港 美国 日本云服务器

RAKsmart 商家从原本只有专注于独立服务器后看到产品线比较单薄,后来陆续有增加站群服务器、高防服务器、VPS主机,以及现在也有在新增云服务器、裸机云服务器等等。机房也有增加到拥有洛杉矶、圣何塞、日本、韩国、中国香港等多个机房。在年前也有介绍到RAKsmart商家有提供年付129元的云服务器套餐,年后我们看到居然再次刷新年付云服务器低价格。我们看到云服务器低至年79元,如果有需要便宜云服务器的...

spaceos为你推荐
安徽汽车网想在合肥买辆二手车,想问在哪里买比较放心?kaixin.com人人网和开心网互通,可我用的是kaixin001的开心,和kaixin*com不是一个呀!百花百游迎得春来非自足,百花千卉共芬芳什么意思百度关键词分析百度竞价关键词分析需要从哪些数据入手?长尾关键词挖掘工具怎么挖掘长尾关键词,可以批量操作的那种mole.61.com摩尔庄园RK的秘密是什么?789se.com莫非现在的789mmm珍的com不管了www.ijinshan.com桌面上多了一个IE图标,打开后就链接到009dh.com这个网站,这个图标怎么删掉啊?bk乐乐《哭泣的Bk》是Bk乐乐唱的吗?朴容熙这个人男的女的,哪国人。叫什么。
青岛虚拟主机 中国域名交易中心 瓦工 winscp 主机评测 t牌 php主机 贵州电信宽带测速 免费ftp空间申请 电子邮件服务器 日本bb瘦 服务器维护方案 中国电信宽带测速网 服务器监测 免费mysql数据库 路由跟踪 免费asp空间申请 日本代理ip 双线空间 酸酸乳 更多