In a
distributed computing
A distributed system is a system whose components are located on different computer network, networked computers, which communicate and coordinate their actions by message passing, passing messages to one another from any system. Distributed com ...
environment, distributed object communication realizes communication between
distributed object
In distributed computing, distributed objects are objects (in the sense of object-oriented programming) that are distributed across different address spaces, either in different processes on the same computer, or even in multiple computers conn ...
s. The main role is to allow objects to access data and invoke
method
Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to:
*Scien ...
s on remote objects (objects residing in non-local
memory space). Invoking a method on a remote object is known as remote method invocation (RMI) or remote invocation, and is the
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
analog of a
remote procedure call
In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (l ...
(RPC).
Class stubs and skeletons
The widely used approach on how to implement the communication channel is realized by using
stubs and
skeletons
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
. They are generated objects whose structure and behavior depends on chosen communication protocol, but in general provide additional functionality that ensures reliable communication over the network.
In RMI, a stub (which is the bit on the client) is defined by the programmer as an
interface
Interface or interfacing may refer to:
Academic journals
* ''Interface'' (journal), by the Electrochemical Society
* ''Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics''
* '' Inte ...
. The rmic (rmi compiler) uses this to create the class stub. The stub performs type checking. The skeleton is defined in a class which
implements the interface stub.
When a caller wants to perform remote call on the called object, it delegates requests to its
stub which initiates communication with the remote
skeleton
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
. Consequently, the stub passes caller arguments over the network to the server skeleton. The skeleton then passes received data to the called object, waits for a response and returns the result to the client stub. Note that there is no direct communication between the caller and the called object.
In more details, the communication consists of several steps:
# caller calls a local
procedure implemented by the stub
# stub
marshalls
Marshalls is an American chain of off-price department stores owned by TJX Companies. Marshalls has over 1,000 American stores, including larger stores named Marshalls Mega Store, covering 42 states and Puerto Rico, and 61 stores in Canada. Mar ...
call type and the input arguments into a request message
# client stub sends the message over the network to the server and blocks the current execution
thread
# server skeleton receives the request message from the network
# skeleton unpacks call type from the request message and looks up the
procedure on the called object
# skeleton
unmarshalls procedure arguments
# skeleton executes the
procedure on the called object
# called object performs a computation and returns the result
# skeleton packs the output arguments into a response message
# skeleton sends the message over the network back to the client
# client stub receives the response message from the network
# stub unpacks output arguments from the message
# stub passes output arguments to the caller, releases execution
thread and caller then continues in execution
The advantage of this architecture is that neither the caller nor the called object has to implement network related logic. This functionality, that ensures reliable communication channel over the network, has been moved to the
stub and the
skeleton
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
layer.
Stub
The client side object participating in distributed object communication is known as a stub or proxy, and is an example of a
proxy object In computer programming, the proxy pattern is a software design pattern. A ''proxy'', in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in ...
.
The stub acts as a gateway for client side objects and all outgoing requests to server side objects that are routed through it. The stub wraps client object functionality and by adding the network logic ensures the reliable communication channel between client and server. The stub can be written up manually or generated automatically depending on chosen communication protocol.
The stub is responsible for:
* initiating the communication towards the server
skeleton
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
* translating calls from the caller object
*
marshalling of the parameters
* informing the
skeleton
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
that the call should be invoked
* passing arguments to the
skeleton
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
over the network
*
unmarshalling In computer science, marshalling or marshaling ( US spelling) is the process of transforming the memory representation of an object into a data format suitable for storage or transmission. It is typically used when data must be moved between differ ...
of the response from the
skeleton
A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
* informing the caller that the call is complete
Skeleton
The server side object participating in distributed object communication is known as a skeleton (or stub; term avoided here).
A skeleton acts as gateway for server side objects and all incoming clients requests are routed through it. The skeleton
wraps server object functionality and exposes it to the clients, moreover by adding the network logic ensures the reliable communication channel between clients and server. Skeletons can be written up manually or generated automatically depending on chosen communication protocol.
The skeleton is responsible for:
* translating incoming data from the
stub to the correct up-calls to server objects
*
unmarshalling In computer science, marshalling or marshaling ( US spelling) is the process of transforming the memory representation of an object into a data format suitable for storage or transmission. It is typically used when data must be moved between differ ...
of the arguments from received data
* passing arguments to server objects
*
marshalling of the returned values from server objects
* passing values back to the client
stub over the network
Protocols using stub/skeleton approach
*
Portable Distributed Objects
Portable Distributed Objects (PDO) is an application programming interface (API) for creating object-oriented code that can be executed remotely on a computer network, network of computers. It was created by NeXT Computer, Inc. using their OpenStep ...
(PDO) -
Objective-C
Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTS ...
*
Common Object Request Broker Architecture
The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between sys ...
(CORBA) – inter-language
*
Java remote method invocation
In computing, the Java Remote Method Invocation (Java RMI) is a Java API that performs remote method invocation, the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes and dist ...
(Java RMI) – Java
*
Distributed Component Object Model
Distributed Component Object Model (DCOM) is a proprietary Microsoft technology for communication between software components on networked computers. DCOM, which originally was called "Network OLE", extends Microsoft's COM, and provides the comm ...
(DCOM) – Microsoft, inter-language
*:(note that the stub is called "proxy" and the skeleton is called "stub"
MSDN: Marshalling details.
/ref>)
* .NET Remoting
.NET Remoting is a Microsoft application programming interface (API) for interprocess communication released in 2002 with the 1.0 version of .NET Framework. It is one in a series of Microsoft technologies that began in 1990 with the first version ...
– Microsoft, inter-language
* DDObjects
DDObjects is a remoting framework for Borland Delphi and C++ Builder. A main goal while developing DDObjects has not been only to keep the code one has to implement in order to utilize DDObjects as simple as possible but also very close to Delp ...
– Borland Delphi
Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, ...
* Distributed Ruby
Distributed Ruby or DRb allows Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties ...
(DRb) – Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sa ...
See also
*Object request broker In distributed computing, an object request broker (ORB) is a middleware which allows program calls to be made from one computer to another via a computer network, providing location transparency through remote procedure calls. ORBs promote interop ...
*Distributed object
In distributed computing, distributed objects are objects (in the sense of object-oriented programming) that are distributed across different address spaces, either in different processes on the same computer, or even in multiple computers conn ...
References
* Plášil, František and Stal, Michael
"An Architectural View of Distributed Objects and Components in CORBA, Java RMI, and COM/DCOM"
''Software Concepts & Tools (vol. 19, no. 1)'', January, 1998.
* Druschel, Pete
* Farley, Jim.
', O'Reilly, January, 1998.
Research Papers
Distributed Systems Research Group, Charles University Prague
{{Authority control
Inter-process communication