com.sun.jini.outrigger
Class TransactableAvailabilityWatcher

java.lang.Object
  extended by com.sun.jini.outrigger.TransitionWatcher
      extended by com.sun.jini.outrigger.AvailabilityRegistrationWatcher
          extended by com.sun.jini.outrigger.TransactableAvailabilityWatcher
All Implemented Interfaces:
LeasedResource, EventRegistrationRecord, Transactable, Comparable, TransactionConstants

 class TransactableAvailabilityWatcher
extends AvailabilityRegistrationWatcher
implements Transactable

Subclass of AvailabilityRegistrationWatcher for transactional availability event registrations.


Field Summary
private  RemoteEventListener listener
          The listener that should be notified of matches
private  Txn txn
          The transaction (represented as a Txn) this event registration is associated with.
 
Fields inherited from class com.sun.jini.outrigger.AvailabilityRegistrationWatcher
cookie, eventID, expiration, handback, visibilityOnly
 
Fields inherited from class com.sun.jini.outrigger.TransitionWatcher
startOrdinal
 
Fields inherited from interface net.jini.core.transaction.server.TransactionConstants
ABORTED, ACTIVE, COMMITTED, NOTCHANGED, PREPARED, VOTING
 
Constructor Summary
TransactableAvailabilityWatcher(long timestamp, long startOrdinal, Uuid cookie, boolean visibilityOnly, MarshalledObject handback, long eventID, RemoteEventListener listener, Txn txn)
          Create a new TransactableAvailabilityWatcher.
 
Method Summary
 void abort(TransactableMgr mgr, OutriggerServerImpl space)
          Just need to terminate this registration.
 void commit(TransactableMgr mgr, OutriggerServerImpl space)
          This should never happen since we always return NOTCHANGED from prepare.
(package private)  RemoteEventListener getListener(ProxyPreparer preparer)
          Return the remote listener associated with this EventRegistrationWatcher.
(package private)  boolean isInterested(EntryTransition transition, long ordinal)
          Return true if this watcher cares about a given visibility transition.
 int prepare(TransactableMgr mgr, OutriggerServerImpl space)
          Just need to terminate this registration and return NOTCHANGED.
 
Methods inherited from class com.sun.jini.outrigger.AvailabilityRegistrationWatcher
addTemplateHandle, cancel, cleanup, getCookie, getExpiration, process, removeIfExpired, setExpiration
 
Methods inherited from class com.sun.jini.outrigger.TransitionWatcher
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listener

private final RemoteEventListener listener
The listener that should be notified of matches


txn

private final Txn txn
The transaction (represented as a Txn) this event registration is associated with.

Constructor Detail

TransactableAvailabilityWatcher

TransactableAvailabilityWatcher(long timestamp,
                                long startOrdinal,
                                Uuid cookie,
                                boolean visibilityOnly,
                                MarshalledObject handback,
                                long eventID,
                                RemoteEventListener listener,
                                Txn txn)
Create a new TransactableAvailabilityWatcher.

Parameters:
timestamp - the value that is used to sort TransitionWatchers.
startOrdinal - the highest ordinal associated with operations that are considered to have occurred before the operation associated with this watcher.
cookie - The unique identifier associated with this watcher. Must not be null.
visibilityOnly - pass true if client only wants visibility events
handback - The handback object that should be sent along with event notifications to the the listener.
eventID - The event ID for event type represented by this object.
listener - The object to notify of matches.
txn - The transaction this registration is associated with.
Throws:
NullPointerException - if the cookie, listener, or txn arguments are null.
Method Detail

isInterested

boolean isInterested(EntryTransition transition,
                     long ordinal)
Description copied from class: TransitionWatcher
Return true if this watcher cares about a given visibility transition. Assumes the transitioning entry matches the template in the TemplateHandle associated with this watcher. This method should return a value even if the expiration time has been reached or remove has been called. This call should not obtain any locks.

Specified by:
isInterested in class TransitionWatcher
Parameters:
transition - A EntryTransition that describes the transition and what entry is transitioning. This method will assume that transition.getHandle returns a non-null value.
ordinal - The ordinal associated with transition.
Returns:
true if this watcher is interested in the indicated transition and false otherwise.

getListener

RemoteEventListener getListener(ProxyPreparer preparer)
Description copied from class: AvailabilityRegistrationWatcher
Return the remote listener associated with this EventRegistrationWatcher. Optionally prepare the listener if it has been recovered from the store and not yet re-prepared.

Specified by:
getListener in class AvailabilityRegistrationWatcher
Returns:
the remote listener associated with this EventRegistrationWatcher

prepare

public int prepare(TransactableMgr mgr,
                   OutriggerServerImpl space)
Just need to terminate this registration and return NOTCHANGED.

Specified by:
prepare in interface Transactable

commit

public void commit(TransactableMgr mgr,
                   OutriggerServerImpl space)
This should never happen since we always return NOTCHANGED from prepare.

Specified by:
commit in interface Transactable

abort

public void abort(TransactableMgr mgr,
                  OutriggerServerImpl space)
Just need to terminate this registration.

Specified by:
abort in interface Transactable


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