Refactor Ignite samples (#4010)
* asd * Update IgniteStream.java * Update IgniteStream.java * Update IgniteStream.java
This commit is contained in:
parent
443a691752
commit
40d6af7fab
@ -14,6 +14,8 @@ import java.nio.file.Paths;
|
|||||||
|
|
||||||
public class IgniteStream {
|
public class IgniteStream {
|
||||||
|
|
||||||
|
private static final Gson GSON = new Gson();
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
Ignition.setClientMode(true);
|
Ignition.setClientMode(true);
|
||||||
@ -29,16 +31,16 @@ public class IgniteStream {
|
|||||||
employee.setEmployed(true);
|
employee.setEmployed(true);
|
||||||
e.setValue(employee);
|
e.setValue(employee);
|
||||||
|
|
||||||
return null;
|
return employee;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Path path = Paths.get(IgniteStream.class.getResource("employees.txt").toURI());
|
Path path = Paths.get(IgniteStream.class.getResource("employees.txt").toURI());
|
||||||
|
|
||||||
Files.lines(path)
|
Files.lines(path)
|
||||||
.forEach(line -> {
|
.forEach(line -> {
|
||||||
Employee employee = new Gson().fromJson(line, Employee.class);
|
Employee employee = GSON.fromJson(line, Employee.class);
|
||||||
streamer.addData(employee.getId(), employee);
|
streamer.addData(employee.getId(), employee);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user