com.tinkerpop.rexster.client.TryRexProSessionless Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rexster-protocol Show documentation
Show all versions of rexster-protocol Show documentation
RexPro is a binary protocol for Rexster graph server.
package com.tinkerpop.rexster.client;
import org.apache.log4j.BasicConfigurator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* A bit of an experiment.
*/
public class TryRexProSessionless implements Runnable {
static {
BasicConfigurator.configure();
}
private int cycle = 0;
private final String host;
private final int exerciseTime;
private final String graphName;
public static void main(final String[] args) throws Exception {
int c = Integer.parseInt(args[1]);
final int exerciseTime = Integer.parseInt(args[2]) * 60 * 1000;
final String g;
for (int ix = 0; ix < c; ix++) {
if (args.length == 4) {
new Thread(new TryRexProSessionless(args[0], exerciseTime, args[3])).start();
} else {
new Thread(new TryRexProSessionless(args[0], exerciseTime, "gratefulgraph")).start();
}
}
Thread.currentThread().join();
System.exit(0);
}
public TryRexProSessionless(final String host, final int exerciseTime, final String graphName) {
this.exerciseTime = exerciseTime;
this.host = host;
this.graphName = graphName;
}
@Override
public void run() {
this.lotsOfCalls();
}
private void lotsOfCalls() {
final long start = System.currentTimeMillis();
long checkpoint = System.currentTimeMillis();
final Random random = new Random();
RexsterClient client = null;
try {
client = RexsterClientFactory.open(host, this.graphName);
while ((System.currentTimeMillis() - start) < exerciseTime) {
cycle++;
System.out.println("Exercise cycle: " + cycle);
try {
int counter = 1;
final int vRequestCount = random.nextInt(500);
for (int iv = 1; iv < vRequestCount; iv++) {
final Map scriptArgs = new HashMap();
scriptArgs.put("id", random.nextInt(800));
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy