Generic FunctionPackage: net.rpcToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version

import-remote-class

Arguments: home-location class-name import-name &optional propagate

This function defines a mapping from the string to the local class named by class-name. It returns the class name. This class must be a sub-class of rpc-remote-ref or an error is signaled. home-location must be an instance of rpc-port or of rpc-port-server (its presence allows the generic function to behave differently on the two classes).

When a remote reference to a class arrives at a port, the class is identified by a string. This string is compared (with string-equal) to the import-name strings defined by this function. If a match occurs, an instance of the corresponding class-name is created instead of a direct instance of rpc-remote-ref.

To avoid ambiguities or conflicts caused by package and case differences between remote images, an application can use export-remote-symbol in the sender to define unique class identifier strings and import-remote-class in the receiver to interpret these unique strings.

Method: (rpc-port-server t t)

This method updates the table stored in the rpc-port-server instance. The table is copied to any new rpc-port instances created from the server. If the propagate argument is non-nil, then all active ports created from this server are updated as well.

Method: (rpc-port t t)

This method updates the table in the specified rpc-port instance. The propagate argument is ignored.

Programming Note and Warning:

Subclasses of rpc-remote-ref must not be instantiated by application programs. Any instance of rpc-remote-ref created by a direct call to make-instance will cause serious errors in the application.

Instances of rpc-remote-ref (and any subclasses) are only created when a remote reference arrives at an rpc-port, or when an application needs to create an explicit wrapper with a call to rref or rpc-ref.

Example

Image A calls image B with:

(rcall 'foo (make-instance 'bar))

In image B, the function foo gets an instance of rpc-remote-ref as its one argument x. (rr-type x) returns the string "bar". Image B can only obtain additional information about the object x by calling back to A.

But image B could also do as follows:

(defclass far-bar (rpc-remote-ref) ())
(import-remote-class port-to-a 'far-bar "bar")

At this point, the function foo gets an instance of far-bar as an argument. This is a local class that may be used to dispatch appropriate methods in image B.

For example, in image A, the class bar may have a slot accessed with accessor count. One way to call this accessor from image B is to use

(rcall 'count x)

But since import-remote-class caused a local class to be instantiated, we can define in image B

(defmethod count ((x far-bar)) (rcall 'count x))

and access the slot with (count x).

See export-remote-symbol for what to do if the class name represented simply as the symbol name might cause ambiguity.

See also rpc.htm for general information on the Remote Procedure Call utility in Allegro CL.


Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version