Created
August 19, 2014 08:42
-
-
Save fancyerii/876ed925c4b6249835af to your computer and use it in GitHub Desktop.
worker thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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