GigaSpaces XAP 7.0 API

org.openspaces.core
Interface GigaSpace

All Known Implementing Classes:
DefaultGigaSpace

public interface GigaSpace

Provides a simpler interface of both JavaSpace and GigaSpaces IJSpace extension utilizing GigaSpaces extended and simplified programming model.

Most operations revolve around the use of Objects allowing to use GigaSpaces support for POJOs. JavaSpaces Entries can also be used. Space operations (at the end) are delegated to the relevant operation of IJSpace.

Though this interface has a single implementation it is still important to work against the interface as it allows for simpler testing and mocking.

Transaction management is implicit and works in a declarative manner. Operations do not accept a transaction object, and will automatically use the TransactionProvider in order to acquire the current running transaction. If there is no current running transaction the operation will be executed without a transaction.

IJSpace can be acquired using getSpace() and in conjunction with getTxProvider() allows to work directly with IJSpace for low level API execution or other low level GigaSpaces components requiring direct access to IJSpace.

Operations throw a DataAccessException allowing for simplified development model as it is a runtime exception. The cause of the exception can be acquired from the GigaSpace exception.

Author:
kimchy
See Also:
IJSpace, Query, SQLQuery, TransactionProvider, DefaultGigaSpace, DataAccessException

Method Summary
<T> AsyncFuture<T>
asyncRead(Query<T> template)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(Query<T> template, AsyncFutureListener<T> listener)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(Query<T> template, long timeout)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(Query<T> template, long timeout, AsyncFutureListener<T> listener)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(Query<T> template, long timeout, int modifiers)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(Query<T> template, long timeout, int modifiers, AsyncFutureListener<T> listener)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(T template)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(T template, AsyncFutureListener<T> listener)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(T template, long timeout)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(T template, long timeout, AsyncFutureListener<T> listener)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(T template, long timeout, int modifiers)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncRead(T template, long timeout, int modifiers, AsyncFutureListener<T> listener)
          Reads any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(Query<T> template)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(Query<T> template, AsyncFutureListener<T> listener)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(Query<T> template, long timeout)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(Query<T> template, long timeout, AsyncFutureListener<T> listener)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(Query<T> template, long timeout, int modifiers)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(Query<T> template, long timeout, int modifiers, AsyncFutureListener<T> listener)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(T template)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(T template, AsyncFutureListener<T> listener)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(T template, long timeout)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(T template, long timeout, AsyncFutureListener<T> listener)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(T template, long timeout, int modifiers)
          Take (remove) any matching entry from the space in an asynchronous manner.
<T> AsyncFuture<T>
asyncTake(T template, long timeout, int modifiers, AsyncFutureListener<T> listener)
          Take (remove) any matching entry from the space in an asynchronous manner.
 void clean()
          Cleans this space.
 void clear(Object template)
          Removes the entries that match the specified template and the specified transaction from this space.
 int count(Object template)
          Count any matching entry from the space.
 int count(Object template, int modifiers)
          Count any matching entry from the space.
<T extends Serializable,R>
AsyncFuture<R>
execute(DistributedTask<T,R> task)
          Executes the task on all the primary space nodes within the cluster (broadcast).
<T extends Serializable,R>
AsyncFuture<R>
execute(DistributedTask<T,R> task, Object... routing)
          Executes a task on all the nodes that correspond to the list of routing values.
<T extends Serializable>
AsyncFuture<T>
execute(Task<T> task)
          Executes a task on a specific space node.
<T extends Serializable>
AsyncFuture<T>
execute(Task<T> task, AsyncFutureListener<T> listener)
          Executes a task on a specific space node.
<T extends Serializable>
AsyncFuture<T>
execute(Task<T> task, Object routing)
          Executes a task on a specific space node.
<T extends Serializable>
AsyncFuture<T>
execute(Task<T> task, Object routing, AsyncFutureListener<T> listener)
          Executes a task on a specific space node.
<T extends Serializable,R>
ExecutorBuilder<T,R>
executorBuilder(AsyncResultsReducer<T,R> reducer)
          Constructs an executor builder allowing to accumulate different tasks required to be executed into a single execute mechanism with all the results reduced by the reducer provided.
 GigaSpace getClustered()
          Returns a clustered view of the GigaSpace is this is a GigaSpace that worked directly against a cluster member.
 net.jini.core.transaction.Transaction getCurrentTransaction()
          Returns the current running transaction.
 ExceptionTranslator getExceptionTranslator()
          Returns the exception translator associated with this GigaSpace instance.
 int getModifiersForIsolationLevel()
          Gets the isolation level from the current running transaction (enabling the usage of Spring declarative isolation level settings).
 String getName()
          Returns the name of the giga space.
 IJSpace getSpace()
          Returns the IJSpace used by this GigaSpace implementation to delegate different space operations.
 TransactionProvider getTxProvider()
          Returns the transaction provider allowing to access the current running transaction.
 IteratorBuilder iterator()
          Returns an iterator builder allowing to configure and create a GSIterator over the Space.
<T> T
read(Query<T> template)
          Read any matching object from the space, blocking until one exists.
<T> T
read(Query<T> template, long timeout)
          Read any matching object from the space, blocking until one exists.
<T> T
read(Query<T> template, long timeout, int modifiers)
          Read any matching object from the space, blocking until one exists.
<T> T
read(T template)
          Read any matching object from the space, blocking until one exists.
<T> T
read(T template, long timeout)
          Read any matching object from the space, blocking until one exists.
<T> T
read(T template, long timeout, int modifiers)
          Read any matching object from the space, blocking until one exists.
<T> T
readById(Class<T> clazz, Object id)
          Read an object from the space matching its id and the class.
<T> T
readById(Class<T> clazz, Object id, Object routing)
          Read an object from the space matching its id, the class and the routing value.
<T> T
readById(Class<T> clazz, Object id, Object routing, long timeout)
          Read an object from the space matching its id, the class and the routing value.
<T> T
readById(Class<T> clazz, Object id, Object routing, long timeout, int modifiers)
          Read an object from the space matching its id, the class and the routing value.
<T> T
readIfExists(Query<T> template)
          Read any matching object from the space, returning null if there currently is none.
<T> T
readIfExists(Query<T> template, long timeout)
          Read any matching object from the space, returning null if there currently is none.
<T> T
readIfExists(Query<T> template, long timeout, int modifiers)
          Read any matching object from the space, returning null if there currently is none.
<T> T
readIfExists(T template)
          Read any matching object from the space, returning null if there currently is none.
<T> T
readIfExists(T template, long timeout)
          Read any matching object from the space, returning null if there currently is none.
<T> T
readIfExists(T template, long timeout, int modifiers)
          Read any matching object from the space, returning null if there currently is none.
<T> T
readIfExistsById(Class<T> clazz, Object id)
          Read an object from the space matching its id and the class.
<T> T
readIfExistsById(Class<T> clazz, Object id, Object routing)
          Read an object from the space matching its id, the class and the routing value.
<T> T
readIfExistsById(Class<T> clazz, Object id, Object routing, long timeout)
          Read an object from the space matching its id, the class and the routing value.
<T> T
readIfExistsById(Class<T> clazz, Object id, Object routing, long timeout, int modifiers)
          Read an object from the space matching its id, the class and the routing value.
<T> T[]
readMultiple(Query<T> template, int maxEntries)
          Read any matching entries from the space.
<T> T[]
readMultiple(Query<T> template, int maxEntries, int modifiers)
          Read any matching entries from the space.
<T> T[]
readMultiple(T template, int maxEntries)
          Read any matching entries from the space.
<T> T[]
readMultiple(T template, int maxEntries, int modifiers)
          Read any matching entries from the space.
 Object snapshot(Object entry)
          The process of serializing an entry for transmission to a JavaSpaces service will be identical if the same entry is used twice.
<T> T
take(Query<T> template)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
take(Query<T> template, long timeout)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
take(Query<T> template, long timeout, int modifiers)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
take(T template)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
take(T template, long timeout)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
take(T template, long timeout, int modifiers)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
takeById(Class<T> clazz, Object id)
          Take (remove) an object from the space matching its id and the class.
<T> T
takeById(Class<T> clazz, Object id, Object routing)
          Take (remove) an object from the space matching its id, the class and the routing value.
<T> T
takeById(Class<T> clazz, Object id, Object routing, long timeout)
          Take (remove) an object from the space matching its id, the class and the routing value.
<T> T
takeById(Class<T> clazz, Object id, Object routing, long timeout, int modifiers)
          Take (remove) an object from the space matching its id, the class and the routing value.
<T> T
takeIfExists(Query<T> template)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
takeIfExists(Query<T> template, long timeout)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
takeIfExists(T template)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
takeIfExists(T template, long timeout)
          Take (remove) any matching entry from the space, blocking until one exists.
<T> T
takeIfExistsById(Class<T> clazz, Object id)
          Take (remove) an object from the space matching its id and the class.
<T> T
takeIfExistsById(Class<T> clazz, Object id, Object routing)
          Take (remove) an object from the space matching its id, the class and the routing value.
<T> T
takeIfExistsById(Class<T> clazz, Object id, Object routing, long timeout)
          Take (remove) an object from the space matching its id, the class and the routing value.
<T> T
takeIfExistsById(Class<T> clazz, Object id, Object routing, long timeout, int modifiers)
          Take (remove) an object from the space matching its id, the class and the routing value.
<T> T[]
takeMultiple(Query<T> template, int maxEntries)
          Takes (removes) all the entries matching the specified template from this space.
<T> T[]
takeMultiple(Query<T> template, int maxEntries, int modifiers)
          Takes (removes) all the entries matching the specified template from this space.
<T> T[]
takeMultiple(T template, int maxEntries)
          Takes (removes) all the entries matching the specified template from this space.
<T> T[]
takeMultiple(T template, int maxEntries, int modifiers)
          Takes (removes) all the entries matching the specified template from this space.
<T> Object[]
updateMultiple(T[] entries, long[] leases)
           
<T> Object[]
updateMultiple(T[] entries, long[] leases, int updateModifiers)
          Same as a single update but for a group of entities sharing the same transaction (if any), applied with the same operation modifier (or default Modifiers.NONE).
<T> LeaseContext<T>
write(T entry)
          Writes a new object to the space, returning its LeaseContext.
<T> LeaseContext<T>
write(T entry, long lease)
          Writes a new object to the space, returning its LeaseContext.
<T> LeaseContext<T>
write(T entry, long lease, long timeout, int modifiers)
          Writes a new object to the space, returning its LeaseContext.
<T> LeaseContext<T>[]
writeMultiple(T[] entries)
          Writes the specified entries to this space.
<T> LeaseContext<T>[]
writeMultiple(T[] entries, long lease)
          Writes the specified entries to this space.
<T> LeaseContext<T>[]
writeMultiple(T[] entries, long lease, int updateModifiers)
          Writes the specified entries to this space.
 

Method Detail

getName

String getName()
Returns the name of the giga space. If it is configured with Spring for example, will return the bean name, if not, will default to the space name.


getSpace

IJSpace getSpace()
Returns the IJSpace used by this GigaSpace implementation to delegate different space operations.

Allows to execute space operations that are not exposed by this interface, as well as using it as a parameter to other low level GigaSpace components.

If a transaction object is required for low level operations (as low level operations do not have declarative transaction ex) the getTxProvider() should be used to acquire the current running transaction.


getClustered

GigaSpace getClustered()
Returns a clustered view of the GigaSpace is this is a GigaSpace that worked directly against a cluster member. If this is an already clustered view, will return the same instance.


getTxProvider

TransactionProvider getTxProvider()
Returns the transaction provider allowing to access the current running transaction. Allows to execute low level IJSpace operations that requires explicit transaction object.


getCurrentTransaction

net.jini.core.transaction.Transaction getCurrentTransaction()
Returns the current running transaction. Can be null if no transaction is in progress.


getExceptionTranslator

ExceptionTranslator getExceptionTranslator()
Returns the exception translator associated with this GigaSpace instance.


getModifiersForIsolationLevel

int getModifiersForIsolationLevel()
Gets the isolation level from the current running transaction (enabling the usage of Spring declarative isolation level settings). If there is no transaction in progress or the transaction isolation is TransactionDefinition.ISOLATION_DEFAULT will use the default isolation level associated with this class.


clean

void clean()
           throws DataAccessException
Cleans this space. The side-effects of cleaning the space are:

Throws:
DataAccessException
See Also:
IServerAdmin.clean()

clear

void clear(Object template)
           throws DataAccessException
Removes the entries that match the specified template and the specified transaction from this space.

If the clear operation conducted without transaction (null as value) it will clear all entries that are not under transaction. Therefore entries under transaction would not be removed from the space.

The clear operation supports inheritance, therefore template class matching objects and its sub classes matching objects are part of the candidates population to be removed from the space. You can in fact clean all space objects (that are not under transaction) by calling: gigaSpace.clear(null).

Notice: The clear operation does not remove notify templates i.e. registration for notifications.

Parameters:
template - the template to use for matching
Throws:
DataAccessException
See Also:
IPojoSpace.clear(Object,net.jini.core.transaction.Transaction)

count

int count(Object template)
          throws DataAccessException
Count any matching entry from the space. If a running within a transaction will count all the entries visible under the transaction.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
Returns:
The number of matching entries
Throws:
DataAccessException
See Also:
IPojoSpace.count(Object,net.jini.core.transaction.Transaction)

count

int count(Object template,
          int modifiers)
          throws DataAccessException
Count any matching entry from the space. If a running within a transaction will count all the entries visible under the transaction.

Allows to specify modifiers using ReadModifiers which allows to programmatically control the isolation level this count operation will be performed under.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
modifiers - one or a union of ReadModifiers.
Returns:
The number of matching entries
Throws:
DataAccessException

snapshot

Object snapshot(Object entry)
                throws DataAccessException

The process of serializing an entry for transmission to a JavaSpaces service will be identical if the same entry is used twice. This is most likely to be an issue with templates that are used repeatedly to search for entries with read or take. The client-side implementations of read and take cannot reasonably avoid this duplicated effort, since they have no efficient way of checking whether the same template is being used without intervening modification. The snapshot method gives the JavaSpaces service implementor a way to reduce the impact of repeated use of the same entry. Invoking snapshot with an Entry will return another Entry object that contains a snapshot of the original entry. Using the returned snapshot entry is equivalent to using the unmodified original entry in all operations on the same JavaSpaces service. Modifications to the original entry will not affect the snapshot. You can snapshot a null template; snapshot may or may not return null given a null template. The entry returned from snapshot will be guaranteed equivalent to the original unmodified object only when used with the space. Using the snapshot with any other JavaSpaces service will generate an IllegalArgumentException unless the other space can use it because of knowledge about the JavaSpaces service that generated the snapshot. The snapshot will be a different object from the original, may or may not have the same hash code, and equals may or may not return true when invoked with the original object, even if the original object is unmodified. A snapshot is guaranteed to work only within the virtual machine in which it was generated. If a snapshot is passed to another virtual machine (for example, in a parameter of an RMI call), using it--even with the same JavaSpaces service--may generate an IllegalArgumentException.

Parameters:
entry - The entry to snapshot
Returns:
The snapshot
Throws:
DataAccessException
See Also:
IPojoSpace.snapshot(Object)

readById

<T> T readById(Class<T> clazz,
               Object id)
           throws DataAccessException
Read an object from the space matching its id and the class. Returns null if there is no match.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Note, if the space is partitioned, and the Entry has a specific property for its routing value, the operation will broadcast to all partitions. The readById(Class, Object, Object) can be used to specify the routing.

Parameters:
clazz - The class of the entry
id - The id of the entry
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readById

<T> T readById(Class<T> clazz,
               Object id,
               Object routing)
           throws DataAccessException
Read an object from the space matching its id, the class and the routing value. Returns null if there is no match.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readById

<T> T readById(Class<T> clazz,
               Object id,
               Object routing,
               long timeout)
           throws DataAccessException
Read an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readById

<T> T readById(Class<T> clazz,
               Object id,
               Object routing,
               long timeout,
               int modifiers)
           throws DataAccessException
Read an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
modifiers - one or a union of ReadModifiers.
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

read

<T> T read(T template)
       throws DataAccessException
Read any matching object from the space, blocking until one exists. Return null if the timeout expires.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

read

<T> T read(T template,
           long timeout)
       throws DataAccessException
Read any matching object from the space, blocking until one exists. Return null if the timeout expires.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

read

<T> T read(T template,
           long timeout,
           int modifiers)
       throws DataAccessException
Read any matching object from the space, blocking until one exists. Return null if the timeout expires.

Overloads read(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)

read

<T> T read(Query<T> template)
       throws DataAccessException
Read any matching object from the space, blocking until one exists. Return null if the timeout expires.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

read

<T> T read(Query<T> template,
           long timeout)
       throws DataAccessException
Read any matching object from the space, blocking until one exists. Return null if the timeout expires.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

read

<T> T read(Query<T> template,
           long timeout,
           int modifiers)
       throws DataAccessException
Read any matching object from the space, blocking until one exists. Return null if the timeout expires.

Overloads read(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)

asyncRead

<T> AsyncFuture<T> asyncRead(T template)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(T template,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
listener - A listener to be notified when a result arrives
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(T template,
                             long timeout)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(T template,
                             long timeout,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
listener - A listener to be notified when a result arrives
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(T template,
                             long timeout,
                             int modifiers)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Overloads asyncRead(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)

asyncRead

<T> AsyncFuture<T> asyncRead(T template,
                             long timeout,
                             int modifiers,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Overloads asyncRead(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
listener - A listener to be notified when a result arrives
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)

asyncRead

<T> AsyncFuture<T> asyncRead(Query<T> template)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(Query<T> template,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
listener - A listener to be notified when a result arrives
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(Query<T> template,
                             long timeout)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(Query<T> template,
                             long timeout,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
listener - A listener to be notified when a result arrives
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)

asyncRead

<T> AsyncFuture<T> asyncRead(Query<T> template,
                             long timeout,
                             int modifiers)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Overloads asyncRead(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)

asyncRead

<T> AsyncFuture<T> asyncRead(Query<T> template,
                             long timeout,
                             int modifiers,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Reads any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Overloads asyncRead(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
listener - A listener to be notified when a result arrives
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)

readIfExistsById

<T> T readIfExistsById(Class<T> clazz,
                       Object id)
                   throws DataAccessException
Read an object from the space matching its id and the class. Returns null if there is no match.

Matching and timeouts are done as in readById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Note, if the space is partitioned, and the Entry has a specific property for its routing value, the operation will broadcast to all partitions. The readById(Class, Object, Object) can be used to specify the routing.

Parameters:
clazz - The class of the entry
id - The id of the entry
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readIfExistsById

<T> T readIfExistsById(Class<T> clazz,
                       Object id,
                       Object routing)
                   throws DataAccessException
Read an object from the space matching its id, the class and the routing value. Returns null if there is no match.

Matching and timeouts are done as in readById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readIfExistsById

<T> T readIfExistsById(Class<T> clazz,
                       Object id,
                       Object routing,
                       long timeout)
                   throws DataAccessException
Read an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Matching and timeouts are done as in readById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readIfExistsById

<T> T readIfExistsById(Class<T> clazz,
                       Object id,
                       Object routing,
                       long timeout,
                       int modifiers)
                   throws DataAccessException
Read an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Matching and timeouts are done as in readById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
modifiers - one or a union of ReadModifiers.
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

readIfExists

<T> T readIfExists(T template)
               throws DataAccessException
Read any matching object from the space, returning null if there currently is none. Matching and timeouts are done as in read, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)

readIfExists

<T> T readIfExists(T template,
                   long timeout)
               throws DataAccessException
Read any matching object from the space, returning null if there currently is none. Matching and timeouts are done as in read, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)

readIfExists

<T> T readIfExists(T template,
                   long timeout,
                   int modifiers)
               throws DataAccessException
Read any matching object from the space, returning null if there currently is none. Matching and timeouts are done as in read, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Overloads read(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - The template used for matching. Matching is done against template with null fields being wildcards ("match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IJSpace.readIfExists(net.jini.core.entry.Entry,net.jini.core.transaction.Transaction,long,int)

readIfExists

<T> T readIfExists(Query<T> template)
               throws DataAccessException
Read any matching object from the space, returning null if there currently is none. Matching and timeouts are done as in read, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)

readIfExists

<T> T readIfExists(Query<T> template,
                   long timeout)
               throws DataAccessException
Read any matching object from the space, returning null if there currently is none. Matching and timeouts are done as in read, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)

readIfExists

<T> T readIfExists(Query<T> template,
                   long timeout,
                   int modifiers)
               throws DataAccessException
Read any matching object from the space, returning null if there currently is none. Matching and timeouts are done as in read, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Overloads read(Object,long) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching object. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - one or a union of ReadModifiers.
Returns:
A copy of the object read from the space.
Throws:
DataAccessException
See Also:
IJSpace.readIfExists(net.jini.core.entry.Entry,net.jini.core.transaction.Transaction,long,int)

readMultiple

<T> T[] readMultiple(T template,
                     int maxEntries)
                 throws DataAccessException
Read any matching entries from the space. Matching is done as in read without timeout (JavaSpace.NO_WAIT). Returns an array with matches bound by maxEntries. Returns an empty array if no match was found.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
Returns:
A copy of the entries read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)

readMultiple

<T> T[] readMultiple(Query<T> template,
                     int maxEntries)
                 throws DataAccessException
Read any matching entries from the space. Matching is done as in read without timeout (JavaSpace.NO_WAIT). Returns an array with matches bound by maxEntries. Returns an empty array if no match was found.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
Returns:
A copy of the entries read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)

readMultiple

<T> T[] readMultiple(T template,
                     int maxEntries,
                     int modifiers)
                 throws DataAccessException
Read any matching entries from the space. Matching is done as in read without timeout (JavaSpace.NO_WAIT). Returns an array with matches bound by maxEntries. Returns an empty array if no match was found.

Overloads readMultiple(Object,int) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Another possible modifier is ReadModifiers.THROW_PARTIAL_FAILURE which The modifier will cause QueryMultiplePartialFailureException to be thrown when not all of the requested number of entries are returned and one or more cluster members are not available.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
modifiers - One or a union of ReadModifiers.
Returns:
A copy of the entries read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)

readMultiple

<T> T[] readMultiple(Query<T> template,
                     int maxEntries,
                     int modifiers)
                 throws DataAccessException
Read any matching entries from the space. Matching is done as in read without timeout (JavaSpace.NO_WAIT). Returns an array with matches bound by maxEntries. Returns an empty array if no match was found.

Overloads readMultiple(Object,int) by adding a modifiers parameter. Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ. Modifiers are used to define the behavior of a read operation.

Another possible modifier is ReadModifiers.THROW_PARTIAL_FAILURE which The modifier will cause QueryMultiplePartialFailureException to be thrown when not all of the requested number of entries are returned and one or more cluster members are not available.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
modifiers - One or a union of ReadModifiers.
Returns:
A copy of the entries read from the space.
Throws:
DataAccessException
See Also:
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)

takeById

<T> T takeById(Class<T> clazz,
               Object id)
           throws DataAccessException
Take (remove) an object from the space matching its id and the class. Returns null if there is no match.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Note, if the space is partitioned, and the Entry has a specfic property for its routing value, the operation will broadcast to all partitions. The takeById(Class, Object, Object) can be used to specify the routing.

Parameters:
clazz - The class of the entry
id - The id of the entry
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeById

<T> T takeById(Class<T> clazz,
               Object id,
               Object routing)
           throws DataAccessException
Take (remove) an object from the space matching its id, the class and the routing value. Returns null if there is no match.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeById

<T> T takeById(Class<T> clazz,
               Object id,
               Object routing,
               long timeout)
           throws DataAccessException
Take (remove) an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeById

<T> T takeById(Class<T> clazz,
               Object id,
               Object routing,
               long timeout,
               int modifiers)
           throws DataAccessException
Take (remove) an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
modifiers - one or a union of ReadModifiers.
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

take

<T> T take(T template)
       throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
Returns:
A removed entry from the space
Throws:
DataAccessException

take

<T> T take(T template,
           long timeout)
       throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A removed entry from the space
Throws:
DataAccessException

take

<T> T take(T template,
           long timeout,
           int modifiers)
       throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - Allows to use ReadModifiers.MATCH_BY_ID
Returns:
A removed entry from the space
Throws:
DataAccessException

take

<T> T take(Query<T> template)
       throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
Returns:
A removed entry from the space
Throws:
DataAccessException

take

<T> T take(Query<T> template,
           long timeout)
       throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A removed entry from the space
Throws:
DataAccessException

take

<T> T take(Query<T> template,
           long timeout,
           int modifiers)
       throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - Allows to use ReadModifiers.MATCH_BY_ID
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(T template)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(T template,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
listener - A listener to be notified when a result arrives
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(T template,
                             long timeout)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(T template,
                             long timeout,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
listener - A listener to be notified when a result arrives
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(T template,
                             long timeout,
                             int modifiers)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - Allows to use ReadModifiers.MATCH_BY_ID
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(T template,
                             long timeout,
                             int modifiers,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - Allows to use ReadModifiers.MATCH_BY_ID
listener - A listener to be notified when a result arrives
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(Query<T> template)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(Query<T> template,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
listener - A listener to be notified when a result arrives.
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(Query<T> template,
                             long timeout)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(Query<T> template,
                             long timeout,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
listener - A listener to be notified when a result arrives.
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(Query<T> template,
                             long timeout,
                             int modifiers)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - Allows to use ReadModifiers.MATCH_BY_ID
Returns:
A removed entry from the space
Throws:
DataAccessException

asyncTake

<T> AsyncFuture<T> asyncTake(Query<T> template,
                             long timeout,
                             int modifiers,
                             AsyncFutureListener<T> listener)
                         throws DataAccessException
Take (remove) any matching entry from the space in an asynchronous manner. Returns immediately with a future. The future can then be used to check if there is a match or not. Once a match is found or the timeout expires, the future will return a result (null in case there was no match).

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
modifiers - Allows to use ReadModifiers.MATCH_BY_ID
listener - A listener to be notified when a result arrives.
Returns:
A removed entry from the space
Throws:
DataAccessException

takeIfExistsById

<T> T takeIfExistsById(Class<T> clazz,
                       Object id)
                   throws DataAccessException
Take (remove) an object from the space matching its id and the class. Returns null if there is no match.

Matching and timeouts are done as in takeById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Note, if the space is partitioned, and the Entry has a specific property for its routing value, the operation will broadcast to all partitions. The takeById(Class, Object, Object) can be used to specify the routing.

Parameters:
clazz - The class of the entry
id - The id of the entry
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeIfExistsById

<T> T takeIfExistsById(Class<T> clazz,
                       Object id,
                       Object routing)
                   throws DataAccessException
Take (remove) an object from the space matching its id, the class and the routing value. Returns null if there is no match.

Matching and timeouts are done as in takeById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

The timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeIfExistsById

<T> T takeIfExistsById(Class<T> clazz,
                       Object id,
                       Object routing,
                       long timeout)
                   throws DataAccessException
Take (remove) an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Matching and timeouts are done as in takeById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeIfExistsById

<T> T takeIfExistsById(Class<T> clazz,
                       Object id,
                       Object routing,
                       long timeout,
                       int modifiers)
                   throws DataAccessException
Take (remove) an object from the space matching its id, the class and the routing value. Returns null if there is no match within the specified timeout.

Matching and timeouts are done as in takeById, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
clazz - The class of the entry
id - The id of the entry
routing - The routing value
timeout - The timeout value to wait for a matching entry if it does not exists within the space
modifiers - one or a union of ReadModifiers.
Returns:
A matching object, or null if no matching is found within the timeout value.
Throws:
DataAccessException

takeIfExists

<T> T takeIfExists(T template)
               throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires. Matching and timeouts are done as in take, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
Returns:
A removed entry from the space
Throws:
DataAccessException

takeIfExists

<T> T takeIfExists(T template,
                   long timeout)
               throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires. Matching and timeouts are done as in take, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being wildcards ( "match anything") other fields being values ("match exactly on the serialized form").
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A removed entry from the space
Throws:
DataAccessException

takeIfExists

<T> T takeIfExists(Query<T> template)
               throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires. Matching and timeouts are done as in take, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Note, the timeout is the default timeout this interface is configured with (using its factory) and defaults to JavaSpace.NO_WAIT.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
Returns:
A removed entry from the space
Throws:
DataAccessException
See Also:
IPojoSpace.takeIfExists(Object,net.jini.core.transaction.Transaction,long)

takeIfExists

<T> T takeIfExists(Query<T> template,
                   long timeout)
               throws DataAccessException
Take (remove) any matching entry from the space, blocking until one exists. Return null if the timeout expires. Matching and timeouts are done as in take, except that blocking in this call is done only if necessary to wait for transactional state to settle.

Parameters:
template - A query to be executed against the space. Most common one is SQLQuery.
timeout - How long the client is willing to wait for a transactionally proper matching entry. A timeout of JavaSpace.NO_WAIT means to wait no time at all; this is equivalent to a wait of zero.
Returns:
A removed entry from the space
Throws:
DataAccessException
See Also:
IPojoSpace.takeIfExists(Object,net.jini.core.transaction.Transaction,long)

takeMultiple

<T> T[] takeMultiple(T template,
                     int maxEntries)
                 throws DataAccessException
Takes (removes) all the entries matching the specified template from this space.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
Returns:
Removed matched entries from the space
Throws:
DataAccessException
See Also:
IPojoSpace.takeMultiple(Object,net.jini.core.transaction.Transaction,int)

takeMultiple

<T> T[] takeMultiple(Query<T> template,
                     int maxEntries)
                 throws DataAccessException
Takes (removes) all the entries matching the specified template from this space.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
Returns:
Removed matched entries from the space
Throws:
DataAccessException
See Also:
IPojoSpace.takeMultiple(Object,net.jini.core.transaction.Transaction,int)

takeMultiple

<T> T[] takeMultiple(T template,
                     int maxEntries,
                     int modifiers)
                 throws DataAccessException
Takes (removes) all the entries matching the specified template from this space.

Another possible modifier is ReadModifiers.THROW_PARTIAL_FAILURE which The modifier will cause QueryMultiplePartialFailureException to be thrown when not all of the requested number of entries are returned and one or more cluster members are not available.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
Returns:
Removed matched entries from the space
Throws:
DataAccessException
See Also:
IPojoSpace.takeMultiple(Object,net.jini.core.transaction.Transaction,int)

takeMultiple

<T> T[] takeMultiple(Query<T> template,
                     int maxEntries,
                     int modifiers)
                 throws DataAccessException
Takes (removes) all the entries matching the specified template from this space.

Another possible modifier is ReadModifiers.THROW_PARTIAL_FAILURE which The modifier will cause QueryMultiplePartialFailureException to be thrown when not all of the requested number of entries are returned and one or more cluster members are not available.

Parameters:
template - The template used for matching. Matching is done against the template with null fields being. wildcards ("match anything") other fields being values ("match exactly on the serialized form"). The template can also be one of the different Query classes
maxEntries - A limit on the number of entries to be returned. Use Integer.MAX_VALUE for the uppermost limit.
Returns:
Removed matched entries from the space
Throws:
DataAccessException
See Also:
IPojoSpace.takeMultiple(Object,net.jini.core.transaction.Transaction,int)

write

<T> LeaseContext<T> write(T entry)
                      throws DataAccessException
Writes a new object to the space, returning its LeaseContext.

By default uses the UpdateModifiers.UPDATE_OR_WRITE modifier (see write(Object,long,long,int). In order to force the operation to perform "write" only (a bit more performant), the UpdateModifiers.WRITE_ONLY modifier can be used resulting in an EntryAlreadyInSpaceException if the entry already exists in the space (it must have an id for this exception to be raised).

If the object has a primary key that isn't auto - generated, and the modifiers value is one of UpdateModifiers.UPDATE_OR_WRITE, UpdateModifiers.UPDATE_ONLY or UpdateModifiers.PARTIAL_UPDATE, it will call to the update method, returning a LeaseContext holder. This lease is unknown to the grantor, unless an actual 'write' was performed.

The entry will be written using the default lease this interface is configured with (using the its factory). In order to explicitly define the lease, please use write(Object,long).

Parameters:
entry - The entry to write to the space
Returns:
A usable Lease on a successful write, or null if performed with the proxy configured with NoWriteLease flag.

when UpdateModifiers.UPDATE_OR_WRITE modifier is applied, LeaseContext.getObject() returns null on a successful write or the previous value - on successful update. UpdateOperationTimeoutException is thrown if timeout occurred while trying to update the object.

Throws:
DataAccessException
See Also:
IPojoSpace.write(Object,net.jini.core.transaction.Transaction,long)

write

<T> LeaseContext<T> write(T entry,
                          long lease)
                      throws DataAccessException
Writes a new object to the space, returning its LeaseContext.

By default uses the UpdateModifiers.UPDATE_OR_WRITE modifier (see write(Object,long,long,int). In order to force the operation to perform "write" only (a bit more performant), the UpdateModifiers.WRITE_ONLY modifier can be used resulting in an EntryAlreadyInSpaceException if the entry already exists in the space (it must have an id for this exception to be raised).

If the object has a primary key that isn't auto - generated, and the modifiers value is one of UpdateModifiers.UPDATE_OR_WRITE, UpdateModifiers.UPDATE_ONLY or UpdateModifiers.PARTIAL_UPDATE, it will call to the update method, returning a LeaseContext holder. This lease is unknown to the grantor, unless an actual 'write' was performed.

Parameters:
entry - The entry to write to the space
lease - The lease the entry will be written with, in milliseconds.
Returns:
A usable Lease on a successful write, or null if performed with the proxy configured with NoWriteLease flag.

when UpdateModifiers.UPDATE_OR_WRITE modifier is applied, LeaseContext.getObject() returns null on a successful write or the previous value - on successful update. UpdateOperationTimeoutException is thrown if timeout occurred while trying to update the object.

Throws:
DataAccessException
See Also:
IPojoSpace.write(Object,net.jini.core.transaction.Transaction,long)

write

<T> LeaseContext<T> write(T entry,
                          long lease,
                          long timeout,
                          int modifiers)
                      throws DataAccessException
Writes a new object to the space, returning its LeaseContext.

By default uses the UpdateModifiers.UPDATE_OR_WRITE modifier (see write(Object,long,long,int). In order to force the operation to perform "write" only (a bit more performant), the UpdateModifiers.WRITE_ONLY modifier can be used resulting in an EntryAlreadyInSpaceException if the entry already exists in the space (it must have an id for this exception to be raised).

If the object has a primary key that isn't auto - generated, and the modifiers value is one of UpdateModifiers.UPDATE_OR_WRITE, UpdateModifiers.UPDATE_ONLY or UpdateModifiers.PARTIAL_UPDATE, it will call to the update method, returning a LeaseContext holder. This lease is unknown to the grantor, unless an actual 'write' was performed.

Parameters:
entry - The entry to write to the space
lease - The lease the entry will be written with, in milliseconds.
Returns:
A usable Lease on a successful write, or null if performed with the proxy configured with NoWriteLease flag.

when UpdateModifiers.UPDATE_OR_WRITE modifier is applied, LeaseContext.getObject() returns null on a successful write or the previous value - on successful update. UpdateOperationTimeoutException is thrown if timeout occurred while trying to update the object.

Throws:
DataAccessException
See Also:
IPojoSpace.write(Object,net.jini.core.transaction.Transaction,long)

writeMultiple

<T> LeaseContext<T>[] writeMultiple(T[] entries)
                                throws DataAccessException
Writes the specified entries to this space.

The entry will be written using the default lease this interface is configured with (using the its factory). In order to explicitly define the lease, please use writeMultiple(Object[],long).

Parameters:
entries - The entries to write to the space.
Returns:
Leases for the written entries
Throws:
DataAccessException
See Also:
IPojoSpace.writeMultiple(Object[],net.jini.core.transaction.Transaction,long)

writeMultiple

<T> LeaseContext<T>[] writeMultiple(T[] entries,
                                    long lease)
                                throws DataAccessException
Writes the specified entries to this space.

Parameters:
entries - The entries to write to the space.
lease - The lease the entry will be written with, in milliseconds.
Returns:
Leases for the written entries
Throws:
DataAccessException
See Also:
IPojoSpace.writeMultiple(Object[],net.jini.core.transaction.Transaction,long)

writeMultiple

<T> LeaseContext<T>[] writeMultiple(T[] entries,
                                    long lease,
                                    int updateModifiers)
                                throws DataAccessException
Writes the specified entries to this space. Same as a single write but for a group of entities sharing the same transaction (if any), applied with the same specified operation modifier. The semantics of a single write and a batch update are similar - the return value for each corresponds to it's cell in the returned array. see 'returns' for possible return values.

Parameters:
objects - the objects to write.
lease - the requested lease time, in milliseconds
updateModifiers - operation modifiers, values from UpdateModifiers.
Returns:
array in which each cell is corresponding to the written entry at the same index in the entries array, each cell is a usable Lease on a successful write, or null if performed with NoWriteLease attribute.

when UpdateModifiers.UPDATE_OR_WRITE modifier is applied,

  • LeaseContext.getObject() returns:
    • null - on a successful write
    • previous value - on successful update
  • or, OperationTimeoutException - thrown if timeout occurred
Throws:
DataAccessException

updateMultiple

<T> Object[] updateMultiple(T[] entries,
                            long[] leases)
                        throws DataAccessException
Throws:
DataAccessException

updateMultiple

<T> Object[] updateMultiple(T[] entries,
                            long[] leases,
                            int updateModifiers)
                        throws DataAccessException
Same as a single update but for a group of entities sharing the same transaction (if any), applied with the same operation modifier (or default Modifiers.NONE). The semantics of a single update and a batch update are similar - the return value for each corresponds to it's cell in the returned array. see 'returns' for possible return values.

Parameters:
entries - the array of objects containing the new values, each entry must contain its UID.
leases - The lease time of the updated objects, 0 means retain the original lease.
updateModifiers - operation modifiers, values from UpdateModifiers.
Returns:
array of objects which correspond to the input entries array. An object can be either one of:
  • an Entry, if the update was successful
  • null - if timeout occurred after waiting for a transactional proper matching entry
  • an Exception object, in case of an exception
  • when UpdateModifiers.UPDATE_OR_WRITE modifier is applied,
    • null - if write was successful,
    • previous value - on successful update, or
    • an Exception Object, including OperationTimeoutException - thrown if timeout occurred.
Throws:
DataAccessException

iterator

IteratorBuilder iterator()
Returns an iterator builder allowing to configure and create a GSIterator over the Space.


execute

<T extends Serializable> AsyncFuture<T> execute(Task<T> task)
Executes a task on a specific space node. The space node it will execute on should be controlled by having a method that return the routing value annotated with SpaceRouting.

In order to control the routing externally, use execute(org.openspaces.core.executor.Task, Object).

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
task - The task to execute
Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

execute

<T extends Serializable> AsyncFuture<T> execute(Task<T> task,
                                                AsyncFutureListener<T> listener)
Executes a task on a specific space node. The space node it will execute on should be controlled by having a method that return the routing value annotated with SpaceRouting.

In order to control the routing externally, use execute(org.openspaces.core.executor.Task, Object).

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
task - The task to execute
listener - A listener to be notified when execution completes
Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

execute

<T extends Serializable> AsyncFuture<T> execute(Task<T> task,
                                                Object routing)
Executes a task on a specific space node. The space node it will execute on should is controlled by the routing value provided as a second parameter.

The routing object itself does not have to be the actual routing value, but can be a POJO that defined a method annotated with @SpaceRouting annotation (this works well when wanting to use entries as the routing parameters).

In order to control the using the Task itself, use execute(org.openspaces.core.executor.Task).

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
task - The task to execute
routing - The routing value that will control on which node the task will be executed on
Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

execute

<T extends Serializable> AsyncFuture<T> execute(Task<T> task,
                                                Object routing,
                                                AsyncFutureListener<T> listener)
Executes a task on a specific space node. The space node it will execute on should is controlled by the routing value provided as a second parameter.

The routing object itself does not have to be the actual routing value, but can be a POJO that defined a method annotated with @SpaceRouting annotation (this works well when wanting to use entries as the routing parameters).

In order to control the using the Task itself, use execute(org.openspaces.core.executor.Task).

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
task - The task to execute
routing - The routing value that will control on which node the task will be executed on
listener - A listener to be notified when execution completes
Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

execute

<T extends Serializable,R> AsyncFuture<R> execute(DistributedTask<T,R> task,
                                                  Object... routing)
Executes a task on all the nodes that correspond to the list of routing values. The task is executed on each space node with all the results reduced by the AsyncResultsReducer.reduce(java.util.List) operation.

The routing object itself does not have to be the actual routing value, but can be a POJO that defined a method annotated with @SpaceRouting annotation (this works well when wanting to use entries as the routing parameters).

The task can optionally implement AsyncResultFilter that can control if tasks should continue to accumulate or it should break and execute the reduce operation on the results received so far.

The future actual result will be the reduced result of the execution, or the exception thrown during during the reduce operation. The moderator can be used as a mechanism to listen for results as they arrive.

The last parameter can be of type AsyncFutureListener which, this case, it will be used to register a listener to be notified of the result.

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
task - The task to execute
routing - A list of routing values, each resulting in an execution of the task on the space node it corresponds to
Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

execute

<T extends Serializable,R> AsyncFuture<R> execute(DistributedTask<T,R> task)
Executes the task on all the primary space nodes within the cluster (broadcast). The task is executed on each space node with all the results reduced by the AsyncResultsReducer.reduce(java.util.List) operation.

The task can optionally implement AsyncResultFilter that can control if tasks should continue to accumulate or it should break and execute the reduce operation on the results received so far.

The future actual result will be the reduced result of the execution, or the exception thrown during during the reduce operation. The moderator can be used as a mechanism to listen for results as they arrive.

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
task - The task to execute
Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

executorBuilder

<T extends Serializable,R> ExecutorBuilder<T,R> executorBuilder(AsyncResultsReducer<T,R> reducer)
Constructs an executor builder allowing to accumulate different tasks required to be executed into a single execute mechanism with all the results reduced by the reducer provided.

The reducer can optionally implement AsyncResultFilter that can control if tasks should continue to accumulate or it should break and execute the reduce operation on the results received so far.

The space that the task is executed within can be accessible by marking a field with type GigaSpace using the TaskGigaSpace annotation. Another option is by implementing the TaskGigaSpaceAware interface.

Resource injection can be enabled by marking the task with AutowireTask or with AutowireTaskMarker. Resources defined within processing unit (space node) the task is executed on are accessible by using either the Autowired or javax.annotation.Resource annotations (assuming they are enabled using context:annotation-config). Bean life cycle methods, such as ClusterInfoAware and ApplicationContextAware are also available.

Parameters:
reducer - The reducer to reduce the results of all the different tasks added.
Returns:
The executor builder.

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.