|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 FormNested 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,
net.jini.core.entry.Entry template,
net.jini.core.transaction.Transaction txn,
long lease,
com.gigaspaces.events.NotifyInfo info)
Deprecated. |
|
NotifyDelegatorMultiplexer(IJSpace space,
net.jini.core.entry.Entry template,
net.jini.core.transaction.Transaction txn,
net.jini.core.event.RemoteEventListener listener,
long lease,
MarshalledObject handback,
boolean fifoEnabled,
int notifyMask)
Deprecated. Creates a new delegator that can receive notifications. |
|
NotifyDelegatorMultiplexer(net.jini.core.event.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. |
protected void |
finalize()
Deprecated. Called by GC on clean reference. |
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(net.jini.core.entry.Entry template,
net.jini.core.transaction.Transaction txn,
net.jini.core.event.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,
net.jini.core.transaction.Transaction txn,
long lease,
com.gigaspaces.events.NotifyInfo info)
Deprecated. |
void |
notify(net.jini.core.event.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. |
protected void |
setSpace(IJSpace space)
Deprecated. Set space proxy. |
void |
shutdown(com.gigaspaces.events.GSEventRegistration registration)
Deprecated. |
boolean |
supports(com.gigaspaces.events.ManagedRemoteEventListener.Feature feature)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NotifyDelegatorMultiplexer(IJSpace space) throws RemoteException
space
- Space proxy.
RemoteException
public NotifyDelegatorMultiplexer(net.jini.core.event.RemoteEventListener listener)
listener
- Supplied listener to notify delegator.NotifyModifiers
public NotifyDelegatorMultiplexer(IJSpace space, net.jini.core.entry.Entry template, net.jini.core.transaction.Transaction txn, net.jini.core.event.RemoteEventListener listener, long lease, MarshalledObject handback, boolean fifoEnabled, int notifyMask) throws net.jini.core.transaction.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
net.jini.core.transaction.TransactionException
- if the transaction is not valid
RemoteException
- if a communication error occursNotifyModifiers
public NotifyDelegatorMultiplexer(IJSpace space, net.jini.core.entry.Entry template, net.jini.core.transaction.Transaction txn, long lease, com.gigaspaces.events.NotifyInfo info) throws net.jini.core.transaction.TransactionException, RemoteException
net.jini.core.transaction.TransactionException
RemoteException
Method Detail |
---|
public void init(com.gigaspaces.events.GSEventRegistration registration) throws RemoteException
init
in interface com.gigaspaces.events.ManagedRemoteEventListener
RemoteException
public IJSpace getSpace()
null
if NotifyDelegatorMultiplexer was constructed as listener, not
via constructor with spaceProxy as parameter.
protected void setSpace(IJSpace space)
public boolean supports(com.gigaspaces.events.ManagedRemoteEventListener.Feature feature)
supports
in interface com.gigaspaces.events.ManagedRemoteEventListener
public com.gigaspaces.events.GSEventRegistration notify(net.jini.core.entry.Entry template, net.jini.core.transaction.Transaction txn, net.jini.core.event.RemoteEventListener listener, long lease, MarshalledObject handback, boolean fifoEnabled, int notifyMask) throws net.jini.core.transaction.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.
net.jini.core.transaction.TransactionException
RemoteException
public com.gigaspaces.events.GSEventRegistration notify(Object template, net.jini.core.transaction.Transaction txn, long lease, com.gigaspaces.events.NotifyInfo info) throws net.jini.core.transaction.TransactionException, RemoteException
net.jini.core.transaction.TransactionException
RemoteException
public void notifyBatch(com.gigaspaces.events.batching.BatchRemoteEvent theEvents) throws net.jini.core.event.UnknownEventException, RemoteException
notifyBatch
in interface com.gigaspaces.events.batching.BatchRemoteEventListener
net.jini.core.event.UnknownEventException
RemoteException
public void notify(net.jini.core.event.RemoteEvent theEvent) throws net.jini.core.event.UnknownEventException, RemoteException
notify
in interface net.jini.core.event.RemoteEventListener
theEvent
- 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.
net.jini.core.event.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.ManagedRemoteEventListener
RemoteException
public void close()
protected void finalize()
finalize
in class Object
|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |