March 2018
Intermediate to advanced
208 pages
4h 52m
English
| | class Logbook { |
| | |
| | static final Path LOG_FOLDER = Paths.get("/var/log"); |
| | static final String FILE_FILTER = "*.log"; |
| | |
| | List<Path> getLogs() throws IOException { |
| | List<Path> result = new ArrayList<>(); |
| | |
| | DirectoryStream<Path> directoryStream = |
| | Files.newDirectoryStream(LOG_FOLDER, FILE_FILTER); |
| | for (Path logFile : directoryStream) { |
| | result.add(logFile); |
| | } |
| » | directoryStream.close(); |
| | |
| | return result; |
| | } |
| | } |
Programs need system resources, such as disk space, database or network connections, CPU threads, and RAM. These resources are limited, and programs have to share them among each other. If a single program acquires resources without releasing them, it can bring down the whole environment. ...