use of org.hl7.fhir.r4.model.Person in project compss by bsc-wdc.
the class Tasks method writePscos.
public static void writePscos(PscoDistroStream<Person> pds, int sleepTime) throws BackendException {
// Create several new files and add them to the stream when written
for (int i = 0; i < Main.NUM_OBJECTS; ++i) {
// Create new object
String name = BASE_NAME + UUID.randomUUID();
Person p = new Person(name, i);
String id = "person_" + UUID.randomUUID().toString();
p.makePersistent(id);
// Manually persist object to storage
try {
StorageManager.persist(p);
} catch (StorageException e) {
System.err.println(ERROR_PERSIST);
e.printStackTrace();
}
// Publish to stream
System.out.println("SENDING PSCO: " + p.getID());
System.out.println(" - Name: " + p.getName());
System.out.println(" - Value: " + p.getAge());
pds.publish(p);
// Sleep some time to delay production
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
// Send end event when finished
System.out.println("Requesting stream closure");
try {
Thread.sleep(sleepTime * 2);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
pds.close();
}
use of org.hl7.fhir.r4.model.Person in project compss by bsc-wdc.
the class Tasks method writePscosList.
public static void writePscosList(PscoDistroStream<Person> pds, int sleepTime) throws BackendException {
// Create several new files and add them to the stream when written
for (int i = 0; i < Main.NUM_BATCHES; ++i) {
// Create list of objects
List<Person> objects = new ArrayList<>();
for (int j = 0; j < Main.NUM_OBJECTS; ++j) {
// Create new object
String name = BASE_NAME + UUID.randomUUID();
Person p = new Person(name, i);
String id = "person_" + UUID.randomUUID().toString();
p.makePersistent(id);
// Manually persist object to storage
try {
StorageManager.persist(p);
} catch (StorageException e) {
System.err.println(ERROR_PERSIST);
e.printStackTrace();
}
objects.add(p);
}
// Publish to stream
System.out.println("SENDING PSCOS: ");
for (Person p : objects) {
System.out.println(" - Name: " + p.getName());
System.out.println(" - Value: " + p.getAge());
}
pds.publish(objects);
// Sleep some time to delay production
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
// Send end event when finished
System.out.println("Requesting stream closure");
pds.close();
}
use of org.hl7.fhir.r4.model.Person in project compss by bsc-wdc.
the class Internal method testPSCOInOut.
private static void testPSCOInOut() {
String id = "person_" + UUID.randomUUID().toString();
Person p = new Person("PName2", 2, 2);
p.makePersistent(id);
InternalImpl.taskPSCOInOut(p);
String name = p.getName();
int age = p.getAge();
int numC = p.getNumComputers();
System.out.println("[LOG][PSCO_INOUT] Person " + name + " with age " + age + " has " + numC + " computers");
System.out.println("[LOG][PSCO_INOUT] BeginId = " + id + " EndId = " + p.getID());
}
use of org.hl7.fhir.r4.model.Person in project compss by bsc-wdc.
the class Internal method testPSCOTargetTaskPersisted.
private static void testPSCOTargetTaskPersisted() {
String id = "person_" + UUID.randomUUID().toString();
Person p = new Person("PName1", 1, 1);
p.taskPSCOTargetTaskPersisted(id);
String name = p.getName();
int age = p.getAge();
int numC = p.getNumComputers();
System.out.println("[LOG][PSCO_TARGET_TP] Person " + name + " with age " + age + " has " + numC + " computers");
System.out.println("[LOG][PSCO_TARGET_TP] BeginId = null EndId = " + p.getID());
}
use of org.hl7.fhir.r4.model.Person in project compss by bsc-wdc.
the class Internal method testPSCOReturnNoTaskPersisted.
private static void testPSCOReturnNoTaskPersisted() {
Person p = InternalImpl.taskPSCOReturnNoTaskPersisted("PName3", 3, 3);
String name = p.getName();
int age = p.getAge();
int numC = p.getNumComputers();
System.out.println("[LOG][PSCO_RETURN_NTP] Person " + name + " with age " + age + " has " + numC + " computers");
System.out.println("[LOG][PSCO_RETURN_NTP] BeginId = null EndId = " + p.getID());
}
Aggregations