A zipped version of my Hazelcast project is attached below. I downloaded the latest version (currently), namely 3.1. I simply unzipped the distribution onto my C drive To use the console you also need apache-tomcat installed The Hazelcast dependency <dependency> <groupId>com.hazelcast</groupId> <artifactId>hazelcast-all</artifactId> <version>3.1</version> </dependency> I therefore modified server.bat as follows (it used relative paths originally) java -server -Xms1G -Xmx1G -cp %HAZELCAST_HOME%/lib/hazelcast-3.1.jar;%HAZELCAST_HOME%/lib/hazelcastpricing.jar com.hazelcast.examples.StartServer I also enabled the console mode by making the following change to hazelcast.xml under the bin directory Once you have made these changes, you can start the server <management-center enabled="true">http://localhost:8080/mancenter-3.1</management-center> Configuration fileshazelcast.xml sits under %HAZELCAST_HOME%/binNOTE: This war deployment is only required if you want to use the command line feature to check cache sizes and other features Data PopulationThe following two lines occur in all the test methods under MarketDataCreatorTest and TradeDataCreatorTest ClientConfig cfg = new ClientConfig(); HazelcastInstance hzcl = HazelcastClient.newHazelcastClient(cfg); For market data
Querying and FilteringHazelcast uses an SqlPredicate object that takes in SQL like queries where a "where-like" clause is passed in to filter the objects that match this criteria for that cache.For MarketData IMap<String, EquityMarketData> markets = hzcl.getMap("marketdata"); ArrayList<EquityMarketData> emdList = (ArrayList<EquityMarketData>) markets.values(query); For TradeData IMap<String, EquityTradeData> trades = hzcl.getMap("tradedata"); SqlPredicate query = new SqlPredicate("strikeDate = '" + strikeDate + "' AND isCall = " + Boolean.FALSE); ArrayList<EquityTradeData> putOptions = (ArrayList<EquityTradeData>)trades.values(query); |