Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for @group for keys which the application owns * Add support for groupers which can group keys outside the application * Group support needs to be explicitly enabled via Configuration (due to refl overhead) * XML config is missing for now * Javadoc and package Javadoc Groups currently have one side effect, which is to override location of keys. If grouping is enabled and a group is specified this will be used to determine key owner, rather than key hash.
- Loading branch information
1 parent
11ec110
commit c2d7783
Showing
18 changed files
with
656 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
core/src/main/java/org/infinispan/distribution/group/Group.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.infinispan.distribution.group; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* <p> | ||
* Identifies the key for a group. | ||
* </p> | ||
* | ||
* <p> | ||
* <code>@Group</code> should be used when you have control over the key class. For example: | ||
* </p> | ||
* | ||
* <pre> | ||
* class User { | ||
* | ||
* ... | ||
* String office; | ||
* ... | ||
* | ||
* int hashCode() { | ||
* // Defines the hash for the key, normally used to determine location | ||
* ... | ||
* } | ||
* | ||
* // Override the location by specifying a group, all keys in the same | ||
* // group end up with the same owner | ||
* @Group | ||
* String getOffice() { | ||
* return office; | ||
* } | ||
* | ||
* } | ||
* </pre> | ||
* | ||
* <p> | ||
* If you don't have control over the key class, you can specify a {@link Grouper} (in your configuration) which can be used to | ||
* specify the group externally. | ||
* </p> | ||
* | ||
* <p> | ||
* You must set the <code>groupsEnabled<code> property to true in your configuration in order to use groups. | ||
* </p> | ||
* | ||
* @see Grouper | ||
* | ||
* @author Pete Muir | ||
* | ||
*/ | ||
@Target(METHOD) | ||
@Retention(RUNTIME) | ||
public @interface Group { | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
core/src/main/java/org/infinispan/distribution/group/GroupManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.infinispan.distribution.group; | ||
|
||
/** | ||
* Control's key grouping. | ||
* | ||
* @author Pete Muir | ||
* | ||
*/ | ||
public interface GroupManager { | ||
|
||
/** | ||
* Get the group for a given key | ||
* | ||
* @param key the key for which to get the group | ||
* @return the group, or null if no group is defined for the key | ||
*/ | ||
public String getGroup(Object key); | ||
|
||
} |
Oops, something went wrong.