|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ScreenDiscovery
Interface ScreenDiscovery is the remote interface for an exported screen discovery object in the Slides application. A screen discovery object is used to discover groups of screen objects.
The discovery process works this way. A group of one or more screen objects
is attached to a multihandle for interface Screen
; a group of screen objects is also known as a
theatre. Using the multihandle, a client can invoke methods on all
screens in the theatre. Each screen object that can be discovered implements
interface
DiscoverableScreen
in
addition to interface
Screen
. To find screen
objects, a client application has a screen discovery object which implements
interface ScreenDiscovery. Interface ScreenDiscovery defines a
report() method. Interface
DiscoverableScreen
extends interface ScreenDiscovery and
defines an additional request() method.
Each discoverable screen object repeatedly invokes the report() method on an omnihandle for interface ScreenDiscovery, passing in the theatre's name and the theatre's multihandle for the theatre to which the screen object belongs. Executing these report() method calls, all the screen discovery objects build up a list of the theatres that are out there.
If no report() method calls arrives for a certain theatre within a certain leasetime (for example, leasetime = 30 seconds), the screen discovery objects conclude that all members of that theatre have gone away, so the theatre no longer exists. To avoid correlated broadcasts, each discoverable screen object calls report() at intervals chosen at random in the range (0.2 leasetime) to (0.4 leasetime) (for example, 6 to 12 seconds). Thus, a screen discovery object should receive at least two report() method calls for a theatre before timing out. This lets the discovery process tolerate the occasional loss of one report() method call.
The discoverable screen objects also receive the report() method
calls (since interface DiscoverableScreen
extends interface ScreenDiscovery). Why? If
a discoverable screen object receives a report() method call for
its own theatre -- that is, a report() method call performed by
some other member of its own theatre -- the discoverable screen object
reschedules its own next report() method call for a new randomly
chosen interval. In this way only one theatre member at a time calls
report(), reducing the network traffic.
When a new device arrives and wants to find out which theatres are out there,
the device can call request() on an omnihandle for interface DiscoverableScreen
. In response, each
discoverable screen object reschedules its next report() method call
for one-tenth the usual interval -- that is, a random interval in the range
(0.02 leasetime) to (0.04 leasetime) (for example, 0.6 to 1.2
seconds). This lets the new device find theatres more quickly.
Field Summary | |
---|---|
static int |
LEASE_TIME
Lease time in milliseconds, 30000 msec (30 sec). |
Method Summary | |
---|---|
void |
report(Screen theHandle,
String theName)
Report that a theatre exists. |
Field Detail |
---|
static final int LEASE_TIME
Method Detail |
---|
void report(Screen theHandle, String theName)
theHandle
- The
Screen
multihandle used for
performing method calls on all screen objects in the theatre.theName
- Theatre name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |