com.fnklabs.draenei.orm.analytics.AnalyticsContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fnklabs-draenei Show documentation
Show all versions of fnklabs-draenei Show documentation
ORM for Cassandra but with distributed cache and analytics utils from package
package com.fnklabs.draenei.orm.analytics;
import com.fnklabs.draenei.orm.CassandraClientFactory;
import org.apache.ignite.Ignite;
import org.apache.ignite.cluster.ClusterGroup;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.ExecutorService;
/**
* Analytics context provide basic analytics functionality
*/
public class AnalyticsContext {
/**
* Cassandra client factory
*/
@NotNull
private final CassandraClientFactory cassandraClientFactory;
/**
* Ignite instance
*/
@NotNull
private final Ignite ignite;
/**
* Construct analytics context
*
* @param cassandraClientFactory Cassandra client factory instance
* @param ignite Ignite instance
*/
public AnalyticsContext(@NotNull CassandraClientFactory cassandraClientFactory, @NotNull Ignite ignite) {
this.cassandraClientFactory = cassandraClientFactory;
this.ignite = ignite;
}
@NotNull
protected CassandraClientFactory getCassandraClientFactory() {
return cassandraClientFactory;
}
@NotNull
protected Ignite getIgnite() {
return ignite;
}
@NotNull
protected ExecutorService getExecutorService() {
ClusterGroup clusterGroup = getIgnite().compute()
.clusterGroup()
.forServers();
return getIgnite().executorService(clusterGroup);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy