Created
March 11, 2015 18:02
-
-
Save ankit8898/9ea02eb4322bc462898c to your computer and use it in GitHub Desktop.
Hazelcast client connect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ankit.hazelcast; | |
import com.hazelcast.client.config.ClientConfig; | |
import com.hazelcast.client.HazelcastClient; | |
import com.hazelcast.core.HazelcastInstance; | |
import com.hazelcast.core.IMap; | |
public class Demo { | |
public static void main( String[] args ) { | |
ClientConfig clientConfig = new ClientConfig(); | |
clientConfig.addAddress("xx.x.xxx.xx:5701"); | |
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig); | |
IMap map = client.getMap("myMap"); | |
System.out.println( "Map Size:" + map.size() ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.ankit</groupId> | |
<artifactId>hazelcast</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>hazelcast</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>com.hazelcast</groupId> | |
<artifactId>hazelcast</artifactId> | |
<version>3.4.1</version> | |
</dependency> | |
<dependency> | |
<groupId>com.hazelcast</groupId> | |
<artifactId>hazelcast-client</artifactId> | |
<version>3.4.1</version> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>3.8.1</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment