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

DiyVM:2G内存/50G硬盘/元起线路香港vps带宽CN2线路,香港VPS五折月付50元起

DiyVM是一家低调国人VPS主机商,成立于2009年,提供的产品包括VPS主机和独立服务器租用等,数据中心包括香港沙田、美国洛杉矶、日本大阪等,VPS主机基于XEN架构,均为国内直连线路,主机支持异地备份与自定义镜像,可提供内网IP。最近,商家对香港机房VPS提供5折优惠码,最低2GB内存起优惠后仅需50元/月。下面就以香港机房为例,分享几款VPS主机配置信息。CPU:2cores内存:2GB硬...

御云(RoyalYun):香港CN2 GIA VPS仅7.9元每月起,美国vps仅8.9/月,续费同价,可叠加优惠

御云怎么样?炎炎暑期即将来临,御云(royalyun)香港、美国服务器开启大特惠模式。御云是新成立的云服务提供商,主要提供香港、美国的云服务器,不久将开启虚拟主机业务。我们的香港和美国主机采用CN2 GIA线路。目前,香港cn2 gia vps仅7.9元每月起,美国vps仅8.9/月,续费同价,可叠加优惠,香港云服务器国内延迟一般在50ms左右,是搭建网站的最佳选择,但是请不要用于违法用途。点击进...

PIGYun月付14.4元起,美国洛杉矶/韩国VPS七月6折

PIGYun是成立于2019年的国人商家,提供香港、韩国和美西CUVIP-9929等机房线路基于KVM架构的VPS主机,本月商家针对韩国首尔、美国洛杉矶CUVIP-AS29、GIA回程带防御等多条线路VPS提供6-8.5折优惠码,优惠后韩国首尔CN2混合BGP特惠型/美国洛杉矶GIA回程带10Gbps攻击防御VPS主机最低每月14.4元起。下面列出几款不同机房VPS主机配置信息,请留意不同优惠码。...

spaceos为你推荐
公司网络被攻击受到网络人身攻击如何处理?曲妙玲张婉悠香艳版《白蛇传》是电影还是写真集?www.hhh258comwww.tx88d.com 有这个网站吗?www.javmoo.comJAV编程怎么做?avtt4.comwww.51kao4.com为什么进不去啊?www.22zizi.com乐乐电影天堂 http://www.leleooo.com 这个网站怎么样?javlibrary.comImage Library Sell Photos Digital Photos Photo Sharing Photo Restoration Digital Photos Photo Albums百度关键字百度推广多少关键词合适猴山条约猴山条约是怎么回事啊?有知道的吗?苗惟妮绝对搭档全部演员表
域名空间购买 新网域名管理 burstnet 国外私服 日志分析软件 512m内存 怎么测试下载速度 ntfs格式分区 域名评估 四核服务器 银盘服务是什么 in域名 太原联通测速 789 supercache 七牛云存储 移动王卡 hdchina web服务器 发证机构 更多