com.sun.jini.outrigger
Class AvailabilityRegistrationWatcher.VisibilityEventSender

java.lang.Object
  extended by com.sun.jini.outrigger.AvailabilityRegistrationWatcher.VisibilityEventSender
All Implemented Interfaces:
EventSender
Enclosing class:
AvailabilityRegistrationWatcher

private class AvailabilityRegistrationWatcher.VisibilityEventSender
extends Object
implements EventSender

Common implementation of EventSender for visibility events


Field Summary
private  boolean isVisible
          true if this is a visibility event
private  long ourSeqNumber
          the sequence number this event should have
private  EntryRep rep
          the EntryRep for the entry that became visible
 
Constructor Summary
private AvailabilityRegistrationWatcher.VisibilityEventSender(EntryRep rep, boolean isVisible, long ourSeqNumber)
          Create a new VisibilityEventSender that will send a new OutriggerAvailabilityEvent.
 
Method Summary
 void cancelRegistration()
          Called when the event sending infrastructure decides to give up on the event registration associated with this sender.
 boolean runAfter(EventSender other)
          Since we try to send every event that occurs, don't care which order they run.
 void sendEvent(JavaSpace source, long now, ProxyPreparer preparer)
          Send a remote event to the encapsulated listener of the encapsulated type, with the encapsulated handback, sequence number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rep

private final EntryRep rep
the EntryRep for the entry that became visible


ourSeqNumber

private final long ourSeqNumber
the sequence number this event should have


isVisible

private final boolean isVisible
true if this is a visibility event

Constructor Detail

AvailabilityRegistrationWatcher.VisibilityEventSender

private AvailabilityRegistrationWatcher.VisibilityEventSender(EntryRep rep,
                                                              boolean isVisible,
                                                              long ourSeqNumber)
Create a new VisibilityEventSender that will send a new OutriggerAvailabilityEvent.

Parameters:
rep - the EntryRep for the entry that became visible/available
isVisible - true if this is a visibility event
ourSeqNumber - the sequence number this event should have
Method Detail

sendEvent

public void sendEvent(JavaSpace source,
                      long now,
                      ProxyPreparer preparer)
               throws UnknownEventException,
                      IOException,
                      ClassNotFoundException
Description copied from interface: EventSender
Send a remote event to the encapsulated listener of the encapsulated type, with the encapsulated handback, sequence number. No locks should be held while calling the listener. This method may be called more than once if all previous tries failed. This call may do nothing and return normally if it is determined that delivering the event is no longer useful. It is assumed that once this method returns normally it will not be called again.

Specified by:
sendEvent in interface EventSender
Parameters:
source - the source the event object sent to the lister should have.
now - The current time.
preparer - to apply to the listener if it has been recovered from a store and not yet re-prepared in this VM.
Throws:
UnknownEventException - if the call to the listener does. Note, this will not cause the watcher to remove itself.
IOException - if the listener can not be unmarshalled. May throw RemoteException if the call to the listener or preparer does
ClassNotFoundException - if the listener needs to be unmarshalled and a necessary class can not be found.

cancelRegistration

public void cancelRegistration()
Description copied from interface: EventSender
Called when the event sending infrastructure decides to give up on the event registration associated with this sender.

Specified by:
cancelRegistration in interface EventSender

runAfter

public boolean runAfter(EventSender other)
Since we try to send every event that occurs, don't care which order they run.

Specified by:
runAfter in interface EventSender
Parameters:
other - the sender this object should compare itself too.
Returns:
true if this object should run after other.


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.