Skip to content

Instantly share code, notes, and snippets.

@fancyerii
Created August 19, 2014 08:42
Show Gist options
  • Save fancyerii/876ed925c4b6249835af to your computer and use it in GitHub Desktop.
Save fancyerii/876ed925c4b6249835af to your computer and use it in GitHub Desktop.
worker thread
class InsertThread extends Thread{
TitanGraph g=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
BlockingQueue<String> queue;
public InsertThread(BlockingQueue<String> queue){
this.queue=queue;
}
@Override
public void run(){
while(true){
try {
String s=queue.take();
try{
Vertex v=g.addVertex(null);
v.setProperty("uri", s);
g.commit();
}catch(Exception e){
}
} catch (InterruptedException e) {
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment