Index 01 (248) CHRZES~1.TXT Maiso433 (3) wiedza i zycie2 20 (122) 921 00 (3) Eisenbert Judaizm Vonnegut Kurt Tabakiera z Bagombo www nie com pl 1 13 (354) |
[ Pobierz całość w formacie PDF ] .[ Add Comment ]Abstracting distributed systemsJini attempts to raise the level ofabstraction for distributed systems programming, from the network protocol levelto the object interface level.In the emerging proliferation of embedded devicesconnected to networks, many pieces of a distributed system may come fromdifferent vendors.Jini makes it unnecessary for vendors of devices to agree onnetwork level protocols that allow their devices to interact.Instead, vendorsmust agree on Java interfaces through which their devices can interact.Theprocesses of discovery, join, and lookup, provided by the Jini run-timeinfrastructure, enable devices to locate each other on the network.Once theylocate each other, devices can communicate with each other through Javainterfaces.[ Add Comment ]SummaryAlong with Jini for local devicenetworks, this chapter has introduced some, but not all, of the components thatSun refers to as J2EE: the Java 2 Enterprise Edition.The goal of J2EE isto build create a set of tools that allows the Javadeveloper to build server-based applications much morequickly than before, and in a platform-independent way.It’s notonly difficult and time-consuming to build such applications, but it’sespecially hard to build them so that they can be easily ported to otherplatforms, and also to keep the business logic separated from the underlyingdetails of the implementation.J2EE provides a framework to assist in creatingserver-based applications; these applications are in demand now, and that demandappears to be increasing.[ Add Comment ]ExercisesSolutions to selected exercisescan be found in the electronic document The Thinking in Java AnnotatedSolution Guide, available for a small fee fromwww.BruceEckel.com.Compile and run theJabberServer and JabberClient programs in this chapter.Now editthe files to remove all of the buffering for the input and output, then compileand run them again to observe the results.[ Add Comment ]Createa server that asks for a password, then opens a file and sends the file over thenetwork connection.Create a client that connects to this server, gives theappropriate password, then captures and saves the file.Test the pair ofprograms on your machine using the localhost (the local loopback IPaddress 127.1 produced by callingInetAddress.getByName(null)).[ Add Comment ]Modifythe server in Exercise 2 so that it uses multithreading to handle multipleclients.[ Add Comment ]ModifyJabberClient.java so that output flushing doesn’t occur and observethe effect.[ Add Comment ]ModifyMultiJabberServer so that it uses thread pooling.Instead ofthrowing away a thread each time a client disconnects, the thread should putitself into an “available pool” of threads.When a new client wantsto connect, the server will look in the available pool for a thread to handlethe request, and if one isn’t available, make a new one.This way thenumber of threads necessary will naturally grow to the required quantity.Thevalue of thread pooling is that it doesn’t require the overhead ofcreating and destroying a new thread for each new client.[ Add Comment ]Startingwith ShowHTML.java, create an applet that is a password-protected gatewayto a particular portion of your Web site.[ Add Comment ]ModifyCIDCreateTables.java so that it reads the SQL strings from a text fileinstead of CIDSQL.[ Add Comment ]Configureyour system so that you can successfully execute CIDCreateTables.java andLoadDB.java.[ Add Comment ]ModifyServletsRule.java by overriding the destroy( ) method to savethe value of i to a file, and and the init( ) method torestore the value.Demonstrate that it works by rebooting the servlet container.If you do not have an existing servlet container, you will need to download,install, and run Tomcat from jakarta.apache.org inorder to run servlets.[ Add Comment ]Createa servlet that adds a cookie to the response object, thereby storing it on theclient’s site.Add code to the servlet that retrieves and displays thecookie.If you do not have an existing servlet container, you will need todownload, install, and run Tomcat from jakarta.apache.org in order to runservlets.[ Add Comment ]Createa servlet that uses a Session object to store session information of yourchoosing.In the same servlet, retrieve and display that session information.Ifyou do not have an existing servlet container, you will need to download,install, and run Tomcat from jakarta.apache.org in order to run servlets.[ Add Comment ]Createa servlet that changes the inactive interval of a session to 5 seconds bycalling getMaxInactiveInterval( ).Test to see that the session doesindeed expire after 5 seconds.If you do not have an existing servlet container,you will need to download, install, and run Tomcat fromjakarta.apache.org in order to run servlets [ Pobierz całość w formacie PDF ] |
||||
Wszelkie Prawa Zastrzeżone! Kawa była słaba i bez smaku. Nie miała treści, a jedynie formę. Design by SZABLONY.maniak.pl. | |||||