ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Swetad90 <sweta...@gmail.com>
Subject BinaryObjects in IgniteCallable
Date Thu, 25 May 2017 20:53:22 GMT
Hi,

Is my understanding correct that we cannot use BinaryObjects in
IgniteCallable as it already uses serializable interface?

I am using IgniteCallable to retrieve a customClass object using
BinaryObject but facing a type cast exception.(ExchangeRate cannot be cast
to org.apache.ignite.binary.BinaryObject)

CacheConfiguration<ExchangeRateKey, ExchangeRate> cacheCfg = new
CacheConfiguration<>("ExchangeRateCache");
		 cacheCfg.setCacheMode(CacheMode.REPLICATED);
		 IgniteCache<ExchangeRateKey, ExchangeRate> cache =
ignite.getOrCreateCache(cacheCfg);
		 IgniteDataStreamer<ExchangeRateKey, ExchangeRate> Cachestmr =
ignite.dataStreamer(cache.getName());
Cachestmr.addData(rate.getRateKey(), rate);

IgniteCache<ExchangeRateKey, BinaryObject> binaryCache =
ignite.cache("ExchangeRateCache").withKeepBinary(); 
	   ExchangeRate obj = binaryCache .get(key);
	   System.out.println("Cache in : " + obj.getOfferRate() ); 	------> This
works

BinaryObject rate1 = ignite.compute().call(
	    		 
	    		    new IgniteCallable<BinaryObject>() {
		                private static final long serialVersionUID = 1L;
		         
		                
		                public BinaryObject call() throws UnknownHostException {
							System.out.println(binaryCache.get(key));
						    BinaryObject obj = binaryCache.get(key);     -------> This gives
error 
					return obj;
		    	        }
		                
		                
		    	    });	 



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/BinaryObjects-in-IgniteCallable-tp13152.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message