DOC PREVIEW
TRINITY CSCI 1321 - Heap Based Priority Queues

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Heap Based Priority Queues4/16/20072Opening Discussion■Do you have any questions about the quiz?■Do you have any questions about the assignment?■What is a heap?■What are the properties of a heap?■How do we typically program a heap?■What is the order of the various operations on a heap?■Will using a heap benefit your game?3Networking with Multiple Messages■We have played some with networking code now and seen how we can get computers to talk to one another.■The socketing code we wrote is basically the way that networking really happens. Then again, machine language is the way programs really run, but that doesn't mean you want to write everything in machine code.■Consider what we would need to do if we had programs that could send multiple types of information between them. For example, if our drawing program also had text chat and possibly sound clips and a whiteboard.4Remote Method Invocation (RMI)■For complex networked applications Java has a wonderful package that allows “Remote Method Invocations”. This allows you to write code that looks like any normal code calling a method on an object, but the object might be located on a different machine.■The RMI code will go through the effort of bundling information, sending it across the network, making the method call on the other machine, and sending the information back across the network.■On the local machine you just call methods like normal with the exception they can throw a RemoteMethodInvocation.5Steps with RMI■To use RMI there are a few steps you have to take.In your code you create remote interfaces that extend java.rmi.Remote. These specify the methods that can be called from other computers.You then implement these interfaces with classes that extend a subclass of RemoteObject. Typically you extend UnicastRemoteObject.Run rmiregistry on the server machine and using java.rmi.Naming to bind your primary class.On the client use java.rmi.Naming to look up the server object and ask it for other objects you might need.■Prior to Java 1.5 you had to use rmic to compile remote classes, but that is now automated.6Object Passing in RMI■Not everything can be passed or returned with RMI methods and different types are passed differently.Primitives and Serializable objects are passed by value.Remote objects are passed as by remote references.Objects that aren't Serializable can't be passed and trying to do so will lead to an exception.■These rules should make intuitive sense when you think about it. Inevitably RMI is using object serialization to pass things around. Primitives and normal serializable objects are passed completely across. Remote objects have stubs that are passed across.7Code■Let's try to think of something fun to do with RMI now. There is a bit of a mental learning curve, but once you get over that RMI makes it very easy to code networked applications of significant complexity.8Minute Essay■What are the costs and benefits of using RMI as compared to more standard forms of


View Full Document

TRINITY CSCI 1321 - Heap Based Priority Queues

Documents in this Course
Recursion

Recursion

11 pages

Iterators

Iterators

10 pages

Actors

Actors

9 pages

Recursion

Recursion

15 pages

Recursion

Recursion

10 pages

Threads

Threads

7 pages

Trees

Trees

11 pages

Load more
Download Heap Based Priority Queues
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Heap Based Priority Queues and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Heap Based Priority Queues 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?