Refactor Ignite samples (#4010)

* asd

* Update IgniteStream.java

* Update IgniteStream.java

* Update IgniteStream.java
This commit is contained in:
Grzegorz Piwowarek 2018-04-29 17:24:13 +02:00 committed by GitHub
parent 443a691752
commit 40d6af7fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -14,6 +14,8 @@ import java.nio.file.Paths;
public class IgniteStream {
private static final Gson GSON = new Gson();
public static void main(String[] args) throws Exception {
Ignition.setClientMode(true);
@ -29,16 +31,16 @@ public class IgniteStream {
employee.setEmployed(true);
e.setValue(employee);
return null;
return employee;
}));
Path path = Paths.get(IgniteStream.class.getResource("employees.txt").toURI());
Files.lines(path)
.forEach(line -> {
Employee employee = new Gson().fromJson(line, Employee.class);
streamer.addData(employee.getId(), employee);
});
}
.forEach(line -> {
Employee employee = GSON.fromJson(line, Employee.class);
streamer.addData(employee.getId(), employee);
});
}
}