edu.vub.at.actors.natives
Class ELDiscoveryActor

java.lang.Object
  extended byedu.vub.at.actors.eventloops.EventLoop
      extended byedu.vub.at.actors.natives.ELActor
          extended byedu.vub.at.actors.natives.ELDiscoveryActor

public final class ELDiscoveryActor
extends ELActor

Every VM has an associated Discovery Actor. This is a regular actor (with a native Actor Mirror) which is responsible for matching local publications with local and remote subscriptions.

Author:
tvcutsem

Nested Class Summary
 
Nested classes inherited from class edu.vub.at.actors.eventloops.EventLoop
EventLoop.EventProcessor
 
Field Summary
private  DiscoveryManager discoveryManager_
          manages subscriptions and publications
 
Fields inherited from class edu.vub.at.actors.natives.ELActor
host_, receptionists_
 
Fields inherited from class edu.vub.at.actors.eventloops.EventLoop
eventQueue_, processor_
 
Constructor Summary
ELDiscoveryActor(ELVirtualMachine host)
           
 
Method Summary
 void event_batchRemotePublications(MultiMap matchingPublications)
          Received in response to the CMDJoinServices command of a remote VM
 void event_cancelPublication(DiscoveryManager.Publication pub)
          This event is fired whenever a service offer is being revoked.
 void event_cancelSubscription(DiscoveryManager.Subscription sub)
          This event is fired whenever a service request is being revoked.
 void event_clientSubscribed(DiscoveryManager.Subscription sub)
          This event is fired whenever an object requests a service using the require: language construct.
 void event_receiveNewSubscriptionsFrom(java.util.Set subscriptionTopics, org.jgroups.Address fromMember)
          When a VM is discovered by another VM, that VM can send its outstanding subscriptions to this VM.
 void event_remotePublication(Packet serializedProvidedTopic, Packet serializedProvidedService)
          Received in response to the CMDProvideService command of a remote VM
 void event_remoteSubscription(Packet serializedRequiredTopic, org.jgroups.Address replyTo)
          Received in response to the CMDRequireService command of a remote VM TODO: perhaps transform this into a sync_event and let CMDRequireService perform the reply
 void event_sendAllSubscriptionsTo(org.jgroups.Address newMember)
          When a new VM has been discovered, the discovery agent is responsible for sending all outstanding subscription topics to that VM, such that it can be checked whether the newcomer has some publications that can resolve outstanding requests.
 void event_servicePublished(DiscoveryManager.Publication pub)
          This event is fired whenever an object is being offered as a service provide using the provide: language construct.
 
Methods inherited from class edu.vub.at.actors.natives.ELActor
currentActor, event_accept, event_acceptSelfSend, event_init, event_serviceJoined, export, getActorMirror, getHost, handle, initRootObject, initSharedFields, resolve, setActorMirror, sync_event_eval, sync_event_performTest, sync_event_symbioticInvocation
 
Methods inherited from class edu.vub.at.actors.eventloops.EventLoop
currentEventLoop, execute, owner, receive, receiveAndWait, receivePrioritized, stopProcessing, toEventLoop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

discoveryManager_

private final DiscoveryManager discoveryManager_
manages subscriptions and publications

Constructor Detail

ELDiscoveryActor

public ELDiscoveryActor(ELVirtualMachine host)
Method Detail

event_servicePublished

public void event_servicePublished(DiscoveryManager.Publication pub)
This event is fired whenever an object is being offered as a service provide using the provide: language construct. The discovery actor keeps track of such services and is responsible for the matching between services and clients. When such matches are detected the VM will send a foundResolution event to both involved actors. If the VM detects that one partner has become unavailable it will send the lostResolution event

Parameters:
pub - - a publication containing the serialized forms of the topic and the exported service object

event_clientSubscribed

public void event_clientSubscribed(DiscoveryManager.Subscription sub)
This event is fired whenever an object requests a service using the require: language construct. The discovery manager keeps track of such requests and is responsible matching services and clients. When such matches are detected the VM will send a foundResolution event to both involved actors. If the VM detects that one partner has become unavailable it will send the lostResolution event

Parameters:
sub - - a subscription containing the serialized forms of the topic and the subscription handler

event_cancelPublication

public void event_cancelPublication(DiscoveryManager.Publication pub)
This event is fired whenever a service offer is being revoked. In this case, the discovery manager ensures that the object is no longer discoverable to new clients. However, it will not send disconnected events as these signal that an object has become unreachable. In other words: remote objects that had already discovered the object linked to this publication will maintain their connection.

Parameters:
pub - - the original publication object to cancel

event_cancelSubscription

public void event_cancelSubscription(DiscoveryManager.Subscription sub)
This event is fired whenever a service request is being revoked. In this case, the discovery manager ensures that the object will no longer discover new services. However, it will not send lostResolution events as these signal that the client has become unreachable.

Parameters:
sub - - the original subscription object to cancel

event_remotePublication

public void event_remotePublication(Packet serializedProvidedTopic,
                                    Packet serializedProvidedService)
Received in response to the CMDProvideService command of a remote VM


event_batchRemotePublications

public void event_batchRemotePublications(MultiMap matchingPublications)
Received in response to the CMDJoinServices command of a remote VM

Parameters:
matchingPublications - - a map from serialized ATStripe topics to Sets of serialized ATObjects that provide the serialized topic.

event_remoteSubscription

public void event_remoteSubscription(Packet serializedRequiredTopic,
                                     org.jgroups.Address replyTo)
Received in response to the CMDRequireService command of a remote VM TODO: perhaps transform this into a sync_event and let CMDRequireService perform the reply


event_sendAllSubscriptionsTo

public void event_sendAllSubscriptionsTo(org.jgroups.Address newMember)
When a new VM has been discovered, the discovery agent is responsible for sending all outstanding subscription topics to that VM, such that it can be checked whether the newcomer has some publications that can resolve outstanding requests.


event_receiveNewSubscriptionsFrom

public void event_receiveNewSubscriptionsFrom(java.util.Set subscriptionTopics,
                                              org.jgroups.Address fromMember)
When a VM is discovered by another VM, that VM can send its outstanding subscriptions to this VM. This event is received by an incoming CMDInitRequireServices command. The local discovery manager should, for each incoming subscription topic, assemble all matching local publication objects. A map of topic -> Set of publication objects is then returned to the sender VM.

Parameters:
subscriptionTopics - - a Set of Packet objects representing serialized ATStripe topics