GigaSpaces XAP 7.0 API

com.gigaspaces.events
Class EventSessionFactory

java.lang.Object
  extended by com.gigaspaces.events.EventSessionFactory

public class EventSessionFactory
extends Object

the EventSessionFactory is a static service class that creates EventSession objects.
there are two types of EventSession that can be created:
1. DataEventSession - for handling data events
2. AddminEventSession - for handling administrative events

the EventSessionFactory is associated with a space and is required in order to create a factory.
once a factory has been created, it can be used to create sessions.
every session is configured according to an EventSessionConfig object and is bounded to a transaction.

the following code example shows how to create a session from a factory
and register a listener to it.
IJSpace space = SpaceFinder.find(spaceURL);
EventSessionFactory factory = EventSessionFactory.getFactory(space);
EventSessionConfig config = new EventSessionConfig();
config.setFifo(true);
config.setBatch(100, 20000); // size = 100 , time = 20000ms

DataEventSession session = factory.newDataEventSession(config, tx);
session.addListener(new MyEntry(), new MyListener(), Lease.FOREVER, null, null, NotifyActionType.NOTIFY_ALL);

Since:
6.0
Version:
1.0
Author:
asy ronen
See Also:
EventSession, EventSessionConfig

Method Summary
static EventSessionFactory getFactory(IJSpace space)
          Retrieves the EventSessionFactory according to the space.
 DataEventSession newDataEventSession()
          creates a new DataEventSession according to the configuration object.
 DataEventSession newDataEventSession(EventSessionConfig config, net.jini.core.transaction.Transaction tx)
          creates a new DataEventSession bounded to the specified transaction,
according to the configuration object.
static DataEventSession newDataSession(IJSpace space, net.jini.core.transaction.Transaction tx, String schemaName)
          creates a new DataEventSession bounded to the specified space, specified transaction
and a predefined configuration schema name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactory

public static EventSessionFactory getFactory(IJSpace space)
Retrieves the EventSessionFactory according to the space.

Parameters:
space - the associated space
Returns:
the related factory.

newDataSession

public static DataEventSession newDataSession(IJSpace space,
                                              net.jini.core.transaction.Transaction tx,
                                              String schemaName)
                                       throws IOException
creates a new DataEventSession bounded to the specified space, specified transaction
and a predefined configuration schema name.

Parameters:
space - the bounded space
tx - the bounded transaction. NULL if no transaction is needed.
schemaName - the name of the predefined configuration schema
Returns:
the DataEventSession
Throws:
IOException - when schema name is invalid or when connection to the space fails.

newDataEventSession

public DataEventSession newDataEventSession(EventSessionConfig config,
                                            net.jini.core.transaction.Transaction tx)
                                     throws RemoteException
creates a new DataEventSession bounded to the specified transaction,
according to the configuration object.

Parameters:
config - the set of configuration params used to configure the session.
tx - the bounded transaction. NULL if no transaction is needed.
Returns:
the newly created DataEventSession.
Throws:
RemoteException - when connection to the space fails.

newDataEventSession

public DataEventSession newDataEventSession()
                                     throws RemoteException
creates a new DataEventSession according to the configuration object. The method creates default configuration of EventSessionConfig with null transaction

Returns:
the newly created DataEventSession.
Throws:
RemoteException - when connection to the space fails.
Since:
6.5

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.