Hazelcast requires Java 1.6 or above. Hazelcast can also be used with .NET, C++, or other JVM-based languages like Scala and Clojure. However, for this tutorial, we are going to use Java 8.
Before we move on, the following is the project setup that we will use for this tutorial.
hazelcast/
βββ com.example.demo/
β βββ SingleInstanceHazelcastExample.java
β βββ MultiInstanceHazelcastExample.java
β βββ Server.java
β βββ ....
βββ pom.xml
βββ target/
βββ hazelcast.xml
βββ hazelcast-multicast.xml
βββ ...
For now, we can just create the package, i.e., com.example.demo inside the hazelcast directory. Then, just cd to that directory. We will look at other files in the upcoming sections.
Installing Hazelcast
Installing Hazelcast simply involves adding a JAR file to your build file. POM file or build.gradle based on whether you are using Maven or Gradle respectively.
If you are using Gradle, adding the following to build.gradle file would be enough β
dependencies {
compile "com.hazelcast:hazelcast:3.12.12β
}
POM for the tutorial
We will use the following POM for our tutorial β
<?xml version="1.0" encoding="UTF-8"?>
<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>1.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Hazelcast</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>3.12.12</version>
</dependency>
</dependencies>
<!-- Below build plugin is not needed for Hazelcast, it is being used only to created a shaded JAR so that -->
<!-- using the output i.e. the JAR becomes simple for testing snippets in the tutorial-->
<build>
<plugins>
<plugin>
<!-- Create a shaded JAR and specify the entry point class-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Pingback: asap darknet market
Pingback: ν°λΉμν€
Pingback: bonanza 178