Skip to content

Instantly share code, notes, and snippets.

@koert
Created March 11, 2016 10:37
Show Gist options
  • Select an option

  • Save koert/e46501afcfe13d1417a5 to your computer and use it in GitHub Desktop.

Select an option

Save koert/e46501afcfe13d1417a5 to your computer and use it in GitHub Desktop.
package zencode.hazelcast;
import com.hazelcast.core.IMap;
import javax.inject.Inject;
/**
* Factory for clustered replicated data.
* @author Koert Zeilstra
*/
public class ClusteredDataFactory {
@Inject private HazelcastFactory hazelcastFactory;
/**
* Retrieve (or create) map.
* @param name Map name
* @param <KeyType> Key type.
* @param <ValueType> Value type.
* @return Clustered map.
*/
public <KeyType, ValueType> ClusteredMap<KeyType, ValueType> getMap(String name) {
IMap<KeyType, ValueType> map = hazelcastFactory.getInstance().getMap(name);
return new ClusteredMap<>(map);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment