本文整理汇总了Java中com.datastax.driver.dse.DseSession类的典型用法代码示例。如果您正苦于以下问题:Java DseSession类的具体用法?Java DseSession怎么用?Java DseSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DseSession类属于com.datastax.driver.dse包,在下文中一共展示了DseSession类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeGraphQuery
import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
/**
* Creates a SimpleGraphStatement out of the input string Runs it through a
* DSESession and returns the result
*
* @param sb
* @return
*/
protected GraphResultSet executeGraphQuery(StringBuilder sb) {
// create a SimpleGraphStatement out of the gremlin string created
SimpleGraphStatement statement = connectionManager.getStatement(sb.toString());
// obtain the DSE connection session and execute the query
DseSession session = connectionManager.getDSEGraphSession().getSession();
GraphResultSet graphResultSet = null;
try {
ListenableFuture<GraphResultSet> resultSet = session.executeGraphAsync(statement);
GraphCallBack callBack = new GraphCallBack();
Futures.addCallback(resultSet, callBack);
if (resultSet != null) {
graphResultSet = resultSet.get();
} else {
LOGGER.error("Failed to execute DSE Graph command " + statement.toString());
return graphResultSet;
}
} catch (InterruptedException | ExecutionException e) {
LOGGER.error("Failed to execute DSE Graph command " + statement.toString(), e);
throw new RepositoryException(e.getMessage(), e);
}
return graphResultSet;
}
示例2: build
import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
@JsonIgnore
public DseCluster build(Environment environment) throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException {
DseCluster.Builder builder = DseCluster.builder()
.addContactPoints(contactPoints)
.withGraphOptions(new GraphOptions().setGraphName(graphName));
if (null != userName && userName.length() > 0 && null != password && password.length() > 0) {
builder = builder.withCredentials(userName, password);
}
if (null != sslTruststoreFile && sslTruststoreFile.length() > 0 && null != sslTruststorePassword && sslTruststorePassword.length() > 0) {
builder = withSSL(builder);
}
DseCluster cluster = builder.build();
DseSession session = cluster.newSession();
environment.lifecycle().manage(new DseGraphManaged(cluster, getShutdownTimeout()));
environment.healthChecks().register("dsegraph",
new DseGraphHealthCheck(session, validationQuery, validationQueryTimeout));
return cluster;
}
示例3: DseGraphHealthCheck
import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
public DseGraphHealthCheck(
@NotNull DseSession session,
@NotNull String validationQuery,
@NotNull Duration validationTimeout) {
this.session = session;
this.validationQuery = validationQuery;
this.validationTimeout = validationTimeout;
}
示例4: hierarchy
import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
@Test
public void hierarchy() {
assertEquals(ImmutableSet.of(), hierarchy(Object.class));
// normal
assertEquals(ImmutableSet.of(Cluster.class), hierarchy(Cluster.class));
assertEquals(ImmutableSet.of(Session.class), hierarchy(Session.class));
// dse
assertEquals(ImmutableSet.of(DseCluster.class, DelegatingCluster.class, Cluster.class),
hierarchy(DseCluster.class));
assertEquals(ImmutableSet.of(DseSession.class, Session.class), hierarchy(DseSession.class));
}
示例5: getSession
import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
/**
* Get DSESession
*
* @return
*/
public DseSession getSession() {
return dseSession;
}