edu.vub.at.actors.natives
Class ELFarReference

java.lang.Object
  extended byedu.vub.at.actors.eventloops.EventLoop
      extended byedu.vub.at.actors.natives.ELFarReference
All Implemented Interfaces:
ConnectionListener

public final class ELFarReference
extends EventLoop
implements ConnectionListener

An instance of the class ELFarReference represents the event loop processor for a remote far reference. That is, the event queue of this event loop serves as an 'outbox' which is dedicated to a certain receiver object hosted by a remote virtual machine. This event loop handles event from its event queue by trying to transmit them to a remote virtual machine.

Author:
tvcutsem

Nested Class Summary
private  class ELFarReference.TransmissionEvent
          TransmissionEvent is a named subclass of event, which allows access to the message the packet it is trying to send which is used, should the event be retracted.
 
Nested classes inherited from class edu.vub.at.actors.eventloops.EventLoop
EventLoop.EventProcessor
 
Field Summary
private  boolean connected_
           
private  ATObjectID destination_
           
private  java.util.Vector disconnectedListeners_
           
private  org.jgroups.blocks.MessageDispatcher dispatcher_
           
private  BlockingFuture outboxFuture_
           
private  ELActor owner_
           
private  java.util.Vector reconnectedListeners_
           
 
Fields inherited from class edu.vub.at.actors.eventloops.EventLoop
eventQueue_, processor_
 
Constructor Summary
ELFarReference(ATObjectID destination, ELActor owner)
           
 
Method Summary
 void addDisconnectionListener(ATObject listener)
           
 void addReconnectionListener(ATObject listener)
           
 void connected()
           
 void disconnected()
           
 void event_transmit(ATAsyncMessage msg)
           
 void execute()
           
private  org.jgroups.Address getDestinationVMAddress()
           
 void handle(Event event)
          Process message transmission events only when the remote reference is connected.
 void handleRetractRequest()
          Resolves the current interrupt's future with the vector of transmission events that are in the event queue of the far reference.
 void removeDisconnectionListener(ATObject listener)
           
 void removeReconnectionListener(ATObject listener)
           
 ATTable retractUnsentMessages()
           
 BlockingFuture setRetractingFuture()
          Signals the far reference that its owning actor has requested to retract unsent messages.
 
Methods inherited from class edu.vub.at.actors.eventloops.EventLoop
currentEventLoop, 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

outboxFuture_

private BlockingFuture outboxFuture_

owner_

private final ELActor owner_

destination_

private final ATObjectID destination_

dispatcher_

private final org.jgroups.blocks.MessageDispatcher dispatcher_

connected_

private boolean connected_

disconnectedListeners_

private java.util.Vector disconnectedListeners_

reconnectedListeners_

private java.util.Vector reconnectedListeners_
Constructor Detail

ELFarReference

public ELFarReference(ATObjectID destination,
                      ELActor owner)
Method Detail

setRetractingFuture

public BlockingFuture setRetractingFuture()
Signals the far reference that its owning actor has requested to retract unsent messages. The interrupt will be handled as soon as the processing of the current event has finished

Returns:
a blocking future the ELActor thread can wait on.

handleRetractRequest

public void handleRetractRequest()
Resolves the current interrupt's future with the vector of transmission events that are in the event queue of the far reference. This is used to retrieve copies of all messages being sent through this far reference. Note that this method performs no deserialisation of the events into (copied) messages. Such deserialisation needs to be done by an ELActor, not the ELFarReference which will execute this method.


addDisconnectionListener

public void addDisconnectionListener(ATObject listener)

addReconnectionListener

public void addReconnectionListener(ATObject listener)

removeDisconnectionListener

public void removeDisconnectionListener(ATObject listener)

removeReconnectionListener

public void removeReconnectionListener(ATObject listener)

handle

public void handle(Event event)
Process message transmission events only when the remote reference is connected. Otherwise, wait until notified by the connected callback.

Specified by:
handle in class EventLoop
Parameters:
event - the event object which was dequeued and which should be processed

event_transmit

public void event_transmit(ATAsyncMessage msg)
                    throws XIOProblem
Throws:
XIOProblem

retractUnsentMessages

public ATTable retractUnsentMessages()
                              throws InterpreterException
Throws:
InterpreterException

connected

public void connected()
Specified by:
connected in interface ConnectionListener

disconnected

public void disconnected()
Specified by:
disconnected in interface ConnectionListener

getDestinationVMAddress

private org.jgroups.Address getDestinationVMAddress()

execute

public void execute()
Overrides:
execute in class EventLoop