| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.j_spaces.core.client.NotifyDelegatorMultiplexer
EventSessionFactory instead.
@Deprecated public class NotifyDelegatorMultiplexer
Just like the call to JavaSpace.notify(), it serves to register interest
 in matching entries for a specific period of time. If a matching entry is written to the
 space before the notification request expires, then the notify() method on the given
 event listener will be called. In comparison to JavaSpace.notify() there is no
 need to set the client codebase. Both clients and server agree on this proxy object to be
 used for notifications.
 
 
 NotifyDelegatorMultiplexer ntfyDelegator =
        new NotifyDelegatorMultiplexer((IJSpace) spaceProxy,
                                                new MyEntry(),
                                                theTransaction,
                                                theListener,
                                                Lease.FOREVER,
                                                null,
                                                fifoEnabled,
                                                NotifyModifiers.NOTIFY_ALL);
 
 
 theListener has to implement RemoteEventListener and its inherited method notify().theTransaction could be either a null transaction or an obtained one from a TransactionManager.notify() method will be called by the delegator. From the notification event
 you can access the entry that triggered the event in the space, and act upon each interested
 notification.
 public void notify(RemoteEvent event)
 {
        EntryArrivedRemoteEvent arrivedRemoteEvent = (EntryArrivedRemoteEvent)event;
        int notifyType = arrivedRemoteEvent.getNotifyType();
 
        // section for write notifications
        if (notifyType == NotifyModifiers.NOTIFY_WRITE)
        {
                MyEntry myEntry = (MyEntry)((EntryArrivedRemoteEvent)event).getEntry();
                ...
        }
 }
 
 
 The following code demonstrates registering for 5 different template notification:
 // assuming MyListener implements RemoteEventListener 
 RemoteEventListener localListener = new MyListener(); 
 NotifyDelegatorMultiplexer nDelegator = new NotifyDelegatorMultiplexer(space); 
 for( int i = 0; i < 5; i++ )
 {
  Entry myTemplate = new MyTemplate( "MyTemplate: " + i );
  EventRegistration eventReg =
                nDelegator.notify( myTemplate,
                                        txn,
                                        localListener,
                                        lease,
                                        handback,
                                        fifoEnabled,
                                        NotifyModifiers.NOTIFY_WRITE );
  System.out.println("Notify registered successfully: " + eventReg);
 }
 
EntryArrivedRemoteEvent, 
NotifyDelegatorListener, 
Serialized Form| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface com.gigaspaces.events.ManagedRemoteEventListener | 
|---|
com.gigaspaces.events.ManagedRemoteEventListener.Feature | 
| Constructor Summary | |
|---|---|
NotifyDelegatorMultiplexer(IJSpace space)
Deprecated. This constructor is called by NotifyDelegatorMultiplexer Manager.  | 
|
NotifyDelegatorMultiplexer(IJSpace space,
                           Entry template,
                           Transaction txn,
                           long lease,
                           com.gigaspaces.events.NotifyInfo info)
Deprecated.  | 
|
NotifyDelegatorMultiplexer(IJSpace space,
                           Entry template,
                           Transaction txn,
                           RemoteEventListener listener,
                           long lease,
                           MarshalledObject handback,
                           boolean fifoEnabled,
                           int notifyMask)
Deprecated. Creates a new delegator that can receive notifications.  | 
|
NotifyDelegatorMultiplexer(RemoteEventListener listener)
Deprecated. Use this constructor when requesting notifications from supplied listener.  | 
|
| Method Summary | |
|---|---|
 void | 
close()
Deprecated. Cancels all the notify templates and unexport this instance of NotifyDelegatorMultiplex.  | 
 IJSpace | 
getSpace()
Deprecated. Returns space proxy or null if NotifyDelegatorMultiplexer was constructed as listener, not
 via constructor with spaceProxy as parameter. | 
 void | 
init(com.gigaspaces.events.GSEventRegistration registration)
Deprecated.  | 
 com.gigaspaces.events.GSEventRegistration | 
notify(Entry template,
       Transaction txn,
       RemoteEventListener listener,
       long lease,
       MarshalledObject handback,
       boolean fifoEnabled,
       int notifyMask)
Deprecated. Registers a notification with this space for the specified template.  | 
 com.gigaspaces.events.GSEventRegistration | 
notify(Object template,
       Transaction txn,
       long lease,
       com.gigaspaces.events.NotifyInfo info)
Deprecated.  | 
 void | 
notify(RemoteEvent theEvent)
Deprecated. This is a callback method invoked by the space when an entry that matches the notify templates is written to the space.  | 
 void | 
notifyBatch(com.gigaspaces.events.batching.BatchRemoteEvent theEvents)
Deprecated.  | 
 void | 
shutdown(com.gigaspaces.events.GSEventRegistration registration)
Deprecated.  | 
 boolean | 
supports(com.gigaspaces.events.ManagedRemoteEventListener.Feature feature)
Deprecated.  | 
| Methods inherited from class java.lang.Object | 
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public NotifyDelegatorMultiplexer(IJSpace space)
                           throws RemoteException
space - Space proxy.
RemoteExceptionpublic NotifyDelegatorMultiplexer(RemoteEventListener listener)
listener - Supplied listener to notify delegator.NotifyModifiers
public NotifyDelegatorMultiplexer(IJSpace space,
                                  Entry template,
                                  Transaction txn,
                                  RemoteEventListener listener,
                                  long lease,
                                  MarshalledObject handback,
                                  boolean fifoEnabled,
                                  int notifyMask)
                           throws TransactionException,
                                  RemoteException
Creates a new delegator that can receive notifications.Equivalent to calling: NotifyDelegatorMultiplexer nDelegator = new NotifyDelegatorMultiplexer(space); nDelegator.notify( template, txn, listener, lease, handback, fifoEnabled, notifyMask );
space - the space to register for notification.template - the template to use for notification.txn - the transaction to use for notification.lease - the lease of the notification template.handback - the handback to use for notification.fifoEnabled - enables/disables ordered notifications.notifyMask - Available Notify Types:
                    NotifyModifiers.NOTIFY_WRITE
                    NotifyModifiers.NOTIFY_UPDATE
                    NotifyModifiers.NOTIFY_TAKE
                    NotifyModifiers.NOTIFY_LEASE_EXPIRATION
                    NotifyModifiers.NOTIFY_ALL
                    
                    
TransactionException - if the transaction is not valid
RemoteException - if a communication error occursNotifyModifiers
public NotifyDelegatorMultiplexer(IJSpace space,
                                  Entry template,
                                  Transaction txn,
                                  long lease,
                                  com.gigaspaces.events.NotifyInfo info)
                           throws TransactionException,
                                  RemoteException
TransactionException
RemoteException| Method Detail | 
|---|
public void init(com.gigaspaces.events.GSEventRegistration registration)
          throws RemoteException
init in interface com.gigaspaces.events.ManagedRemoteEventListenerRemoteExceptionpublic IJSpace getSpace()
null if NotifyDelegatorMultiplexer was constructed as listener, not
 via constructor with spaceProxy as parameter.
public boolean supports(com.gigaspaces.events.ManagedRemoteEventListener.Feature feature)
supports in interface com.gigaspaces.events.ManagedRemoteEventListener
public com.gigaspaces.events.GSEventRegistration notify(Entry template,
                                                        Transaction txn,
                                                        RemoteEventListener listener,
                                                        long lease,
                                                        MarshalledObject handback,
                                                        boolean fifoEnabled,
                                                        int notifyMask)
                                                 throws TransactionException,
                                                        RemoteException
EventRegistration object is returned that can be used to cancel,
 renew the notification lease, aquire the unique id of the registration, or the
 sequence number at the time of registration and the space that is the source of
 the registration.
 
 
 EventRegistration eventReg =
        nDelegator.notify( myTemplate,
                txn,
                localListener,
                lease,
                handback,
                fifoEnabled,
                NotifyModifiers.NOTIFY_WRITE );
 
 System.out.println("Notify registered successfully: " + eventReg);
 
template - The Entry template to be notified of.txn - When notifications are under transaction.listener - The RemoteEventListener implementor.lease - The lease timeout for the template notification.handback - the handback to use for notification.fifoEnabled - enables/disables ordered notifications.notifyMask - notification interest mask specified by NotifyModifiers constants.
TransactionException
RemoteException
public com.gigaspaces.events.GSEventRegistration notify(Object template,
                                                        Transaction txn,
                                                        long lease,
                                                        com.gigaspaces.events.NotifyInfo info)
                                                 throws TransactionException,
                                                        RemoteException
TransactionException
RemoteException
public void notifyBatch(com.gigaspaces.events.batching.BatchRemoteEvent theEvents)
                 throws UnknownEventException,
                        RemoteException
notifyBatch in interface com.gigaspaces.events.batching.BatchRemoteEventListenerUnknownEventException
RemoteException
public void notify(RemoteEvent theEvent)
            throws UnknownEventException,
                   RemoteException
notify in interface RemoteEventListenertheEvent - the event that the space sent. This event includes
                 the event id, the source, the handback and the sequence number of
                 the notification and the referent Uuid.
UnknownEventException - if the user-supplied listener throws
                               this event.
RemoteException - if the user-supplied listener throws
                               this event.
public void shutdown(com.gigaspaces.events.GSEventRegistration registration)
              throws RemoteException
shutdown in interface com.gigaspaces.events.ManagedRemoteEventListenerRemoteExceptionpublic void close()
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||