You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is Issue 149 moved from a Google Code project.
Added by 2010-11-18T11:58:43.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Closed (Done).
Original labels: Type-Defect, Priority-Medium
Original description
Hi all.
I don't find any documentation about support concurrent programming Java .
May I can write code with use concurrent programming Java?
For example:
package com.action;
import com.model.Task;
import com.orientechnologies.orient.core.db.object.ODatabaseObjectTx;
public class TaskThread implements Runnable {
private ODatabaseObjectTx db;
private String parentId;
public TaskThread(ODatabaseObjectTx db, String parentId) {
this.db = db;
this.parentId = parentId;
}
public void run() {
createTask(parentId);
}
private void createTask(String parentId) {
int currentId = TestThread.getCurrentId();
Task task = new Task(String.valueOf(currentId), "task_"+currentId, parentId);
System.out.println(Thread.currentThread() + " : id: " + task.getId() + "\tname: " + task.getName() + "\tparent: " + task.getParent());
db.save(task);
}
}
package com.action;
import com.orientechnologies.orient.core.db.object.ODatabaseObjectTx;
public class TestThread {
private static int currectId = 0;
private final static String URL = "local:/home/pitbull/projects/ThreadOriendDB/store/db1/trackstudio40";
public static synchronized int getCurrentId() {
return ++currectId;
}
public static void main(String[] args) {
ODatabaseObjectTx db = new ODatabaseObjectTx(URL).open("admin", "admin");
for (int i=0;i!=1000000;++i) {
new Thread(new TaskThread(db, "1")).start();
}
}
}
The text was updated successfully, but these errors were encountered:
This is Issue 149 moved from a Google Code project.
Added by 2010-11-18T11:58:43.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Closed (Done).
Original labels: Type-Defect, Priority-Medium
Original description
The text was updated successfully, but these errors were encountered: