private StreamingMarshaller marshaller(Ownership ownership) { return cacheEnumMap.get(ownership).getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
@Override protected StreamingMarshaller getMarshaller() { return cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller(); } }
private StreamingMarshaller marshaller() { return cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
private StreamingMarshaller marshaller() { return cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
@Override protected StreamingMarshaller getMarshaller() { return localCacheManager.getCache(REMOTE_CACHE).getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
@Override protected StreamingMarshaller getMarshaller() { return localCacheManager.getCache(REMOTE_CACHE).getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
@Override protected StreamingMarshaller getMarshaller() { return localCacheManager.getCache(REMOTE_CACHE).getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
public TestObjectStreamMarshaller() { cacheManager = TestCacheManagerFactory.createCacheManager(); marshaller = cacheManager.getCache().getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
public void testRemoteLoadFromCacheLoader() throws Exception { Cache<String, String> cache1 = cache(0, "clusteredCl"); Cache<String, String> cache2 = cache(1, "clusteredCl"); CacheWriter writer = TestingUtil.getFirstWriter(cache2); assertNull(cache1.get("key")); assertNull(cache2.get("key")); writer.write(new MarshalledEntryImpl("key", "value", null, cache2.getAdvancedCache().getComponentRegistry().getCacheMarshaller())); assertEquals(((CacheLoader)writer).load("key").getValue(), "value"); assertEquals(cache1.get("key"), "value"); } }
private static <K, V> void writeToStore(Cache<K, V> cache, K key, V value) { TestingUtil.getFirstWriter(cache).write(marshalledEntry(key, value, cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller())); }
final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller(); assertEquals(0, store.size());
public void testProcess() throws ExecutionException, InterruptedException { final int writerThreads = 2; final int numberOfKeys = 2000; Cache<String, String> cache = cacheManager.getCache(CACHE_NAME); final SingleFileStore store = TestingUtil.getFirstWriter(cache); final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller(); assertEquals(0, store.size()); final List<String> keys = new ArrayList<>(numberOfKeys); populateStoreRandomValues(numberOfKeys, store, marshaller, keys); final CountDownLatch stopLatch = new CountDownLatch(1); Future[] writeFutures = new Future[writerThreads]; for (int i = 0; i < writerThreads; i++) { writeFutures[i] = fork(stopOnException(new WriteTask(store, marshaller, keys, stopLatch), stopLatch)); } Future processFuture = fork(stopOnException(new ProcessTask(store), stopLatch)); // Stop the writers only after we finish processing processFuture.get(); stopLatch.countDown(); for (int i = 0; i < writerThreads; i++) { writeFutures[i].get(); } }
public void testProcessWithNoDiskAccess() throws ExecutionException, InterruptedException { final int writerThreads = 2; final int numberOfKeys = 2000; Cache<String, String> cache = cacheManager.getCache(CACHE_NAME); final SingleFileStore store = TestingUtil.getFirstWriter(cache); final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller(); assertEquals(0, store.size()); final List<String> keys = new ArrayList<>(numberOfKeys); populateStoreRandomValues(numberOfKeys, store, marshaller, keys); final CountDownLatch stopLatch = new CountDownLatch(1); Future[] writeFutures = new Future[writerThreads]; for (int i = 0; i < writerThreads; i++) { writeFutures[i] = fork(stopOnException(new WriteTask(store, marshaller, keys, stopLatch), stopLatch)); } Future processFuture = fork(stopOnException(new ProcessTaskNoDiskRead(store), stopLatch)); // Stop the writers only after we finish processing processFuture.get(); stopLatch.countDown(); for (int i = 0; i < writerThreads; i++) { writeFutures[i].get(); } }
public void testReadsAndWrites() throws ExecutionException, InterruptedException { final int writerThreads = 2; final int readerThreads = 2; Cache<String, String> cache = cacheManager.getCache(CACHE_NAME); final SingleFileStore store = TestingUtil.getFirstWriter(cache); final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller(); assertEquals(0, store.size()); final List<String> keys = populateStore(5, 0, store, marshaller); final CountDownLatch stopLatch = new CountDownLatch(1); Future[] writeFutures = new Future[writerThreads]; for (int i = 0; i < writerThreads; i++) { writeFutures[i] = fork(stopOnException(new WriteTask(store, marshaller, keys, stopLatch), stopLatch)); } Future[] readFutures = new Future[readerThreads]; for (int i = 0; i < readerThreads; i++) { readFutures[i] = fork(stopOnException(new ReadTask(store, keys, false, stopLatch), stopLatch)); } stopLatch.await(2, SECONDS); stopLatch.countDown(); for (int i = 0; i < writerThreads; i++) { writeFutures[i].get(); } for (int i = 0; i < readerThreads; i++) { readFutures[i].get(); } }
final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller(); assertEquals(0, store.size());
@BeforeMethod(alwaysRun = true) public void setUp() { cfg = getConfiguration(); configure(cfg); cm = TestCacheManagerFactory.createCacheManager(cfg); cache = getCache(cm); store = TestingUtil.getFirstLoader(cache); writer = TestingUtil.getFirstLoader(cache); tm = TestingUtil.getTransactionManager(cache); sm = cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller(); }
final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller(); assertEquals(0, store.size());
@Override public void call() throws IOException, InterruptedException { cm.getClassWhiteList().addClasses(Person.class); Cache<String, Person> cache = cm.getCache(); Marshaller marshaller = cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller(); Person value = new Person(); cache.put("1", value); // Read using default valueEncoder assertEquals(cache.get("1"), value); // Read unencoded Cache<?, ?> unencodedCache = cache.getAdvancedCache().withEncoding(IdentityEncoder.class); assertEquals(unencodedCache.get(marshaller.objectToByteBuffer("1")), marshaller.objectToByteBuffer(value)); } });
Marshaller marshaller = cache.getAdvancedCache().getComponentRegistry().getCacheMarshaller();