/** * Get a List in Hazelcast. * * @param listName the List name. * @return the List in Hazelcast. */ @Override public List getList(String listName) { return instance.getList(listName); }
@Override public <T> List<T> getList(String bucketName) throws UnsupportedOperationException, NullPointerException { requireNonNull(bucketName, "bucketName is required"); return hazelcastInstance.getList(bucketName); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IList<String> list = hz.getList("list"); for (String s : list) { System.out.println(s); } System.out.println("Reading finished!"); } }
@Setup public void setup() { map = targetInstance.getMap(name); results = targetInstance.getList(name + "report"); }
@Setup public void setup() { map = targetInstance.getMap(name); results = targetInstance.getList(name + "report"); }
@Setup public void setUp() { map = targetInstance.getMap(name); results = targetInstance.getList(name + "report"); }
@Setup public void setUp() { if (minProcessorDelayMs > maxProcessorDelayMs) { throw new IllegalArgumentException("minProcessorDelayMs has to be >= maxProcessorDelayMs. " + "Current settings: minProcessorDelayMs = " + minProcessorDelayMs + " maxProcessorDelayMs = " + maxProcessorDelayMs); } map = targetInstance.getMap(name); resultsPerWorker = targetInstance.getList(name + ":ResultMap"); keys = KeyUtils.generateIntKeys(keyCount, keyLocality, targetInstance); }
@Produces public IList produceList( final ProviderContext context ) { final String name = retrieveSourceNameFrom( context ); final IList list = hazelcast.getList( name ); notifyDataWasProduced(list, IList.class); return list; }
private static void readPeople(HazelcastInstance hazelcastInstance) throws Exception { PersonDataReader personDataReader = new PersonDataReader(); InputStream is = CLASS_LOADER.getResourceAsStream("us-500.csv"); try { IList<Person> personsList = hazelcastInstance.getList("persons"); List<Person> persons = personDataReader.read(is); personsList.addAll(persons); } finally { is.close(); } }
private static void readCrimes(HazelcastInstance hazelcastInstance) throws Exception { CrimeDataReader crimeDataReader = new CrimeDataReader(); InputStream is = CLASS_LOADER.getResourceAsStream("CrimeStatebyState.csv"); try { IList<Crime> crimesList = hazelcastInstance.getList("crimes"); List<Crime> crimes = crimeDataReader.read(is); crimesList.addAll(crimes); } finally { is.close(); } } }
@Setup public void setup() { cache = getCache(targetInstance, name); results = targetInstance.getList(name); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IList<String> list = hz.getList("list"); list.add("Tokyo"); list.add("Paris"); list.add("London"); list.add("New York"); System.out.println("Putting finished!"); } }
@Verify(global = true) public void globalVerify() throws Exception { IList<MapOpperationsCount> results = targetInstance.getList(basename+"report"); MapOpperationsCount total = new MapOpperationsCount(); for(MapOpperationsCount i : results){ total.add(i); } System.out.println(basename+": "+total+" total of "+results.size()); }
@Setup public void setup(TestContext testContext) throws Exception { this.testContext = testContext; targetInstance = testContext.getTargetInstance(); map = targetInstance.getMap(basename + "-" + testContext.getTestId()); resultsPerWorker = targetInstance.getList(basename+"ResultMap" + testContext.getTestId()); }
@Setup public void setup() { resultsPerWorker = targetInstance.getList(name); CacheManager cacheManager = createCacheManager(targetInstance); cache = cacheManager.getCache(name); }
@Verify(global = true) public void golbalVerify() throws Exception { IList<EntryListenerImpl> resultListners = targetInstance.getList(basename + "listeners"); for(int i=0; i<resultListners.size()-1; i++){ EntryListenerImpl a = resultListners.get(i); EntryListenerImpl b = resultListners.get(i+1); assertEquals("not same amount of event in all listeners", a, b); } }
@Override public void execute(HazelcastInstance hazelcastInstance) throws Exception { JobTracker jobTracker = hazelcastInstance.getJobTracker("default"); IList<Person> list = hazelcastInstance.getList("persons"); KeyValueSource<String, Person> source = KeyValueSource.fromList(list); Job<String, Person> job = jobTracker.newJob(source); // find all people named James ICompletableFuture future = job.mapper(new PersonMapper("James")).submit(); System.out.println(ToStringPrettyfier.toString(future.get())); } }
@Run public void run() { ThreadSpawner spawner = new ThreadSpawner(testContext.getTestId()); for (int k = 0; k < threadCount; k++) { spawner.spawn(new Worker()); } spawner.awaitCompletion(); IList results = targetInstance.getList(basename+"report"); results.add(count); }
@Override public void execute(HazelcastInstance hazelcastInstance) throws Exception { JobTracker jobTracker = hazelcastInstance.getJobTracker("default"); IList<Person> list = hazelcastInstance.getList("persons"); KeyValueSource<String, Person> source = KeyValueSource.fromList(list); Job<String, Person> job = jobTracker.newJob(source); ICompletableFuture future = job.mapper(new SalaryMapper()) .combiner(new SalaryCombinerFactory()) .reducer(new SalaryReducerFactory()) .submit(); System.out.println(ToStringPrettyfier.toString(future.get())); } }
@Setup public void setup() { loaderList = targetInstance.getList(name + "loaders"); config = new MutableConfiguration<Integer, Integer>(); config.setReadThrough(true); RecordingCacheLoader<Integer> recordingCacheLoader = new RecordingCacheLoader<Integer>(); recordingCacheLoader.loadAllDelayMs = loadAllDelayMs; config.setCacheLoaderFactory(FactoryBuilder.factoryOf(recordingCacheLoader)); CacheManager cacheManager = createCacheManager(targetInstance); cacheManager.createCache(name, config); cache = cacheManager.getCache(name); }