|
GridGain 2.0.3
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A - Affinity key type.public interface GridCoherenceAffinityJob<A>
Affinity job which extends GridJob and asks user to implement
GridCoherenceAffinityJob.getAffinityKey() and GridCoherenceAffinityJob.getCacheName() methods. Basically
the job should know the data it will access and provide the key and
Coherence cache name for it to GridGain which will route it to the
grid node on which this data is cached.
Here is an example of how affinity job is implemented:
public class MyFooBarCoherenceAffinityJob extends GridCoherenceAffinityJobAdapter<Integer, Serializable> {
...
private static final String CACHE_NAME = "myDistributedCache";
public MyFooBarCoherenceAffinityJob(Integer cacheKey) {
super(CACHE_NAME, cacheKey);
}
public Serializable execute() throws GridException {
...
// Access data by the same key returned in 'getAffinityKey()' method
// and for cache with name returned in 'getCacheName()'.
NamedCache mycache = CacheFactory.getCache(getCacheName);
mycache.get(getAffinityKey());
...
}
}
For complete documentation on how affinity jobs are created and used, refer to GridCoherenceLoadBalancingSpi
documentation.
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.0.3

| Method Summary | |
|---|---|
A |
getAffinityKey()
Gets affinity key for this job. |
String |
getCacheName()
Gets cache name for this job. |
| Methods inherited from interface org.gridgain.grid.GridJob |
|---|
cancel, execute |
| Method Detail |
|---|
A getAffinityKey()
String getCacheName()
|
GridGain 2.0.3
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.0.3.20052008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|