本文整理汇总了Java中com.rethinkdb.RethinkDB类的典型用法代码示例。如果您正苦于以下问题:Java RethinkDB类的具体用法?Java RethinkDB怎么用?Java RethinkDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RethinkDB类属于com.rethinkdb包,在下文中一共展示了RethinkDB类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectionFactory
import com.rethinkdb.RethinkDB; //导入依赖的package包/类
@Bean
public Connection connectionFactory() {
Connection connection = RethinkDB.r.connection()
.hostname("localhost")
.port(57787)
.connect();
connection.use("example_app");
return connection;
}
示例2: setUp
import com.rethinkdb.RethinkDB; //导入依赖的package包/类
public void setUp() throws IOException, InterruptedException {
String rethinkDockerExecCmd = "docker run --name squirrel-test-rethinkdb " +
"-p 58015:28015 -p 58887:8080 -d rethinkdb";
Process p = Runtime.getRuntime().exec(rethinkDockerExecCmd);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String s = null;
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
// read any errors from the attempted command
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null)
{
System.out.println(s);
}
r = RethinkDB.r;
int retryCount = 0;
while(true) {
try {
connection = r.connection().hostname("localhost").port(58015).connect();
break;
} catch(ReqlDriverError error) {
System.out.println("Could not connect, retrying");
retryCount++;
if(retryCount > 10) break;
Thread.sleep(5000);
}
}
}
示例3: create
import com.rethinkdb.RethinkDB; //导入依赖的package包/类
@Override
public Connection create() throws Exception {
return RethinkDB.r.connection()
.hostname(hostname)
.port(port)
.user(username, password)
.db(database)
.connect();
}
示例4: createConnection
import com.rethinkdb.RethinkDB; //导入依赖的package包/类
public Connection createConnection() {
return RethinkDB.r.connection().hostname(host).port(port).connect();
}