Package org.infinispan.commons.marshall.jboss

Examples of org.infinispan.commons.marshall.jboss.GenericJBossMarshaller


   public void testHotRodCodec() throws Exception {
      Cache<byte[], byte[]> cache = cacheManager.getCache();
      RemoteCache<String, String> remoteCache = remoteCacheManager.getCache();
      remoteCache.put("k1", "v1");
      GenericJBossMarshaller marshaller = new GenericJBossMarshaller();
      byte[] k1 = marshaller.objectToByteBuffer("k1");
      assertTrue(cache.containsKey(k1));

      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      Map<String, String> response = interpreter.execute(sessionId, "get --codec=hotrod k1;");
      assertEquals("v1", response.get(ResultKeys.OUTPUT.toString()));
View Full Code Here


   public void testHotRodEncoding() throws Exception {
      Cache<byte[], byte[]> cache = cacheManager.getCache();
      RemoteCache<String, String> remoteCache = remoteCacheManager.getCache();
      remoteCache.put("k1", "v1");
      GenericJBossMarshaller marshaller = new GenericJBossMarshaller();
      byte[] k1 = marshaller.objectToByteBuffer("k1");
      assertTrue(cache.containsKey(k1));

      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      interpreter.execute(sessionId, "encoding hotrod;");
      Map<String, String> response = interpreter.execute(sessionId, "get k1;");
View Full Code Here

      if (configuration.marshaller() != null) {
         marshaller = Util.getInstance(configuration.marshaller(), cache.getCacheConfiguration().classLoader());
      } else if (configuration.hotRodWrapping()) {
         marshaller = new HotRodEntryMarshaller();
      } else if (configuration.rawValues()) {
         marshaller = new GenericJBossMarshaller();
      } else {
         marshaller = getMarshaller();
      }
      ConfigurationBuilder builder = buildRemoteConfiguration(configuration, marshaller);
      remoteCacheManager = new RemoteCacheManager(builder.build());
View Full Code Here

   public void start() throws CacheLoaderException {
      super.start();
      if (config.getHotRodClientProperties().containsKey(ConfigurationProperties.MARSHALLER)) {
         remoteCacheManager = new RemoteCacheManager(config.getHotRodClientProperties(), true, config.getClassLoader(), config.getAsyncExecutorFactory());
      } else {
         Marshaller marshaller = config.isRawValues() ? new GenericJBossMarshaller() : getMarshaller();
         if (marshaller == null) {throw new IllegalStateException("Null marshaller not allowed!");}
         remoteCacheManager = new RemoteCacheManager(marshaller, config.getHotRodClientProperties(), true, config.getClassLoader(), config.getAsyncExecutorFactory());
      }
      if (config.getRemoteCacheName().equals(BasicCacheContainer.DEFAULT_CACHE_NAME))
         remoteCache = remoteCacheManager.getCache();
View Full Code Here

   }

   public void testMarshallerInstance() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.addServer().host("127.0.0.1").port(port);
      GenericJBossMarshaller marshaller = new GenericJBossMarshaller();
      builder.marshaller(marshaller);
      remoteCacheManager = new RemoteCacheManager(builder.build());
      assertTrue(marshaller == remoteCacheManager.getMarshaller());
   }
View Full Code Here

      }
      assertEquals(0, eventListener.queue(type).size());
   }

   private static <K> long serverDataVersion(Cache cache, K key) {
      Marshaller marshaller = new GenericJBossMarshaller();
      try {
         byte[] keyBytes = marshaller.objectToByteBuffer(key);
         Metadata metadata = cache.getAdvancedCache().getCacheEntry(keyBytes).getMetadata();
         return ((NumericVersion) metadata.version()).getVersion();
      } catch (Exception e) {
         throw new AssertionError(e);
      }
View Full Code Here

   }

   private long serverDataVersion(Cache<Object, Object> cache, K key) {
      Object lookupKey;
      try {
         lookupKey = compatibility ? key : new GenericJBossMarshaller().objectToByteBuffer(key);
      } catch (Exception e) {
         throw new AssertionError(e);
      }

      Metadata meta = cache.getAdvancedCache().getCacheEntry(lookupKey).getMetadata();
View Full Code Here

   public long synchronizeData(final Cache<Object, Object> cache) throws CacheException {
      int threads = Runtime.getRuntime().availableProcessors();
      ComponentRegistry cr = cache.getAdvancedCache().getComponentRegistry();
      CacheLoaderManager loaderManager = cr.getComponent(CacheLoaderManager.class);
      List<RemoteCacheStore> stores = loaderManager.getCacheLoaders(RemoteCacheStore.class);
      Marshaller marshaller = new GenericJBossMarshaller();
      byte[] knownKeys;
      try {
         knownKeys = marshaller.objectToByteBuffer(MIGRATION_MANAGER_HOT_ROD_KNOWN_KEYS);
      } catch (Exception e) {
         throw new CacheException(e);
      }

      for (RemoteCacheStore store : stores) {
         final RemoteCache<Object, Object> storeCache = store.getRemoteCache();
         if (storeCache.containsKey(knownKeys)) {
            RemoteCacheStoreConfiguration storeConfig = (RemoteCacheStoreConfiguration) store.getConfiguration();
            if (!storeConfig.hotRodWrapping()) {
               throw log.remoteStoreNoHotRodWrapping(cache.getName());
            }


            Set<byte[]> keys;
            try {
               keys = (Set<byte[]>) marshaller.objectFromByteBuffer((byte[])storeCache.get(knownKeys));
            } catch (Exception e) {
               throw new CacheException(e);
            }

            ExecutorService es = Executors.newFixedThreadPool(threads);
View Full Code Here

   }

   private long serverDataVersion(Cache<Object, Object> cache, K key) {
      Object lookupKey;
      try {
         lookupKey = compatibility ? key : new GenericJBossMarshaller().objectToByteBuffer(key);
      } catch (Exception e) {
         throw new AssertionError(e);
      }

      Metadata meta = cache.getAdvancedCache().getCacheEntry(lookupKey).getMetadata();
View Full Code Here

      if (configuration.marshaller() != null) {
         marshaller = Util.getInstance(configuration.marshaller(), ctx.getCache().getAdvancedCache().getClassLoader());
      } else if (configuration.hotRodWrapping()) {
         marshaller = new HotRodEntryMarshaller(ctx.getByteBufferFactory());
      } else if (configuration.rawValues()) {
         marshaller = new GenericJBossMarshaller();
      } else {
         marshaller = ctx.getMarshaller();
      }
      ConfigurationBuilder builder = buildRemoteConfiguration(configuration, marshaller);
      remoteCacheManager = new RemoteCacheManager(builder.build());
View Full Code Here

TOP

Related Classes of org.infinispan.commons.marshall.jboss.GenericJBossMarshaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.