Java does not have pointers, no way. Java does have references. A reference is an abstract identifier for an object. It is not a pointer. A reference tags a particular object with a name in the Java virtual machine so that the programmer may refer to it. How exactly the virtual machine implements references at the level of machine code is VM-dependent and completely hidden from the programmer in any case. Most VMs including Sun’s use handles, not pointers. A handle is a pointer to a pointer. At the level of machine code in the CPU a reference is an address in memory where the address of the object is stored. This way the objects can be moved around in memory and only the master pointer needs to be updated rather than all references to the object. This is completely hidden from the Java programmer, though. Only the implementer of the virtual machine needs to worry about it. Indeed, this is not the only way references can be implemented. Microsoft’s VM actually does use pointers rather than handles. Other schemes are possible.
Asynchronous Communication Advantages: Requests need not be targeted to specific server. Service need not be available when request is made. No blocking, so resources could be freed. Could use connectionless protocol Disadvantages: Response times are unpredictable. Error handling usually more complex. Usually requires connection-oriented protocol. Harder to design apps Synchronous Communication Advantages: Easy to program Outcome is known immediately Error recovery easier (usually) Better real-time response (usually) Disadvantages: Service must be up and ready. Requestor blocks, held resources are “tied up”. Usually requires connection-oriented protocol
Comments
Post a Comment