{"action":"created","comment":{"url":"https://api.github.com/repos/akka/alpakka/pulls/comments/86173919","pull_request_review_id":6844071,"id":86173919,"diff_hunk":"@@ -0,0 +1,214 @@\n+/*\n+ * Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>\n+ */\n+package akka.stream.alpakka.file.javadsl;\n+\n+import akka.NotUsed;\n+import akka.japi.Pair;\n+import akka.stream.Attributes;\n+import akka.stream.Outlet;\n+import akka.stream.SourceShape;\n+import akka.stream.alpakka.file.DirectoryChange;\n+import akka.stream.javadsl.Source;\n+import akka.stream.stage.AbstractOutHandler;\n+import akka.stream.stage.GraphStage;\n+import akka.stream.stage.GraphStageLogic;\n+import akka.stream.stage.TimerGraphStageLogic;\n+import com.sun.nio.file.SensitivityWatchEventModifier;\n+import scala.concurrent.duration.FiniteDuration;\n+\n+import java.io.IOException;\n+import java.nio.file.*;\n+import java.util.ArrayDeque;\n+import java.util.Queue;\n+import java.util.function.BiFunction;\n+\n+import static java.nio.file.StandardWatchEventKinds.*;\n+\n+/**\n+ * Watches a file system directory and streams change events from it.\n+ *\n+ * Note that the JDK watcher is notoriously slow on some platform (up to 1s after event actually happened on OSX for example)\n+ */\n+public final class DirectoryChangesSource<T> extends GraphStage<SourceShape<T>> {\n+\n+\n+  private final static Attributes DEFAULT_ATTRIBUTES = Attributes.name(\"DirectoryChangesSource\");\n+\n+  private final Path directoryPath;\n+  private final FiniteDuration pollInterval;\n+  private final int maxBufferSize;\n+  private final BiFunction<Path, DirectoryChange, T> combiner;\n+  public final Outlet<T> out = Outlet.create(\"DirectoryChangesSource.out\");\n+  private final SourceShape<T> shape = SourceShape.of(out);\n+\n+  /**\n+   * @param directoryPath Directory to watch\n+   * @param pollInterval Interval between polls to the JDK watch service when a push comes in and there was no changes, if\n+   *                     the JDK implementation is slow, it will not help lowering this\n+   * @param maxBufferSize Maximum number of buffered directory changes before the stage fails\n+   * @param combiner A function that combines a Path and a DirectoryChange into an element that will be emitted downstream\n+   */\n+  public DirectoryChangesSource(Path directoryPath, FiniteDuration pollInterval, int maxBufferSize, BiFunction<Path, DirectoryChange, T> combiner) {","path":"file/src/main/java/akka/stream/alpakka/file/javadsl/DirectoryChangesSource.java","position":52,"original_position":52,"commit_id":"c7854d1d77432512b31d0b55312f8f34e0282a4b","original_commit_id":"c7854d1d77432512b31d0b55312f8f34e0282a4b","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"good","created_at":"2016-11-02T15:47:53Z","updated_at":"2016-11-02T15:47:53Z","html_url":"https://github.com/akka/alpakka/pull/16#discussion_r86173919","pull_request_url":"https://api.github.com/repos/akka/alpakka/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/akka/alpakka/pulls/comments/86173919"},"html":{"href":"https://github.com/akka/alpakka/pull/16#discussion_r86173919"},"pull_request":{"href":"https://api.github.com/repos/akka/alpakka/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/akka/alpakka/pulls/16","id":91963629,"html_url":"https://github.com/akka/alpakka/pull/16","diff_url":"https://github.com/akka/alpakka/pull/16.diff","patch_url":"https://github.com/akka/alpakka/pull/16.patch","issue_url":"https://api.github.com/repos/akka/alpakka/issues/16","number":16,"state":"open","locked":false,"title":"New files module ported from streams-contrib","user":{"login":"johanandren","id":666915,"avatar_url":"https://avatars.githubusercontent.com/u/666915?v=3","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"body":"Refs #11 & #12 ","created_at":"2016-11-02T12:51:14Z","updated_at":"2016-11-02T15:47:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"afa727a3fdc9df24594c16c2df317bca088c8ca1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/akka/alpakka/pulls/16/commits","review_comments_url":"https://api.github.com/repos/akka/alpakka/pulls/16/comments","review_comment_url":"https://api.github.com/repos/akka/alpakka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/alpakka/issues/16/comments","statuses_url":"https://api.github.com/repos/akka/alpakka/statuses/c7854d1d77432512b31d0b55312f8f34e0282a4b","head":{"label":"johanandren:wip-alpakka-files-johanandren","ref":"wip-alpakka-files-johanandren","sha":"c7854d1d77432512b31d0b55312f8f34e0282a4b","user":{"login":"johanandren","id":666915,"avatar_url":"https://avatars.githubusercontent.com/u/666915?v=3","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"repo":{"id":72639130,"name":"alpakka","full_name":"johanandren/alpakka","owner":{"login":"johanandren","id":666915,"avatar_url":"https://avatars.githubusercontent.com/u/666915?v=3","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/johanandren/alpakka","description":"Akka Streams Connectors - Alpakka","fork":true,"url":"https://api.github.com/repos/johanandren/alpakka","forks_url":"https://api.github.com/repos/johanandren/alpakka/forks","keys_url":"https://api.github.com/repos/johanandren/alpakka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/johanandren/alpakka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/johanandren/alpakka/teams","hooks_url":"https://api.github.com/repos/johanandren/alpakka/hooks","issue_events_url":"https://api.github.com/repos/johanandren/alpakka/issues/events{/number}","events_url":"https://api.github.com/repos/johanandren/alpakka/events","assignees_url":"https://api.github.com/repos/johanandren/alpakka/assignees{/user}","branches_url":"https://api.github.com/repos/johanandren/alpakka/branches{/branch}","tags_url":"https://api.github.com/repos/johanandren/alpakka/tags","blobs_url":"https://api.github.com/repos/johanandren/alpakka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/johanandren/alpakka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/johanandren/alpakka/git/refs{/sha}","trees_url":"https://api.github.com/repos/johanandren/alpakka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/johanandren/alpakka/statuses/{sha}","languages_url":"https://api.github.com/repos/johanandren/alpakka/languages","stargazers_url":"https://api.github.com/repos/johanandren/alpakka/stargazers","contributors_url":"https://api.github.com/repos/johanandren/alpakka/contributors","subscribers_url":"https://api.github.com/repos/johanandren/alpakka/subscribers","subscription_url":"https://api.github.com/repos/johanandren/alpakka/subscription","commits_url":"https://api.github.com/repos/johanandren/alpakka/commits{/sha}","git_commits_url":"https://api.github.com/repos/johanandren/alpakka/git/commits{/sha}","comments_url":"https://api.github.com/repos/johanandren/alpakka/comments{/number}","issue_comment_url":"https://api.github.com/repos/johanandren/alpakka/issues/comments{/number}","contents_url":"https://api.github.com/repos/johanandren/alpakka/contents/{+path}","compare_url":"https://api.github.com/repos/johanandren/alpakka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/johanandren/alpakka/merges","archive_url":"https://api.github.com/repos/johanandren/alpakka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/johanandren/alpakka/downloads","issues_url":"https://api.github.com/repos/johanandren/alpakka/issues{/number}","pulls_url":"https://api.github.com/repos/johanandren/alpakka/pulls{/number}","milestones_url":"https://api.github.com/repos/johanandren/alpakka/milestones{/number}","notifications_url":"https://api.github.com/repos/johanandren/alpakka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/johanandren/alpakka/labels{/name}","releases_url":"https://api.github.com/repos/johanandren/alpakka/releases{/id}","deployments_url":"https://api.github.com/repos/johanandren/alpakka/deployments","created_at":"2016-11-02T12:46:00Z","updated_at":"2016-11-02T12:46:01Z","pushed_at":"2016-11-02T12:50:51Z","git_url":"git://github.com/johanandren/alpakka.git","ssh_url":"git@github.com:johanandren/alpakka.git","clone_url":"https://github.com/johanandren/alpakka.git","svn_url":"https://github.com/johanandren/alpakka","homepage":"","size":148,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"3bd361f6543ec08d6c9a8a6646f5910f9eb09795","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":70807477,"name":"alpakka","full_name":"akka/alpakka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/alpakka","description":"Akka Streams Connectors - Alpakka","fork":false,"url":"https://api.github.com/repos/akka/alpakka","forks_url":"https://api.github.com/repos/akka/alpakka/forks","keys_url":"https://api.github.com/repos/akka/alpakka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/alpakka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/alpakka/teams","hooks_url":"https://api.github.com/repos/akka/alpakka/hooks","issue_events_url":"https://api.github.com/repos/akka/alpakka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/alpakka/events","assignees_url":"https://api.github.com/repos/akka/alpakka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/alpakka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/alpakka/tags","blobs_url":"https://api.github.com/repos/akka/alpakka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/alpakka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/alpakka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/alpakka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/alpakka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/alpakka/languages","stargazers_url":"https://api.github.com/repos/akka/alpakka/stargazers","contributors_url":"https://api.github.com/repos/akka/alpakka/contributors","subscribers_url":"https://api.github.com/repos/akka/alpakka/subscribers","subscription_url":"https://api.github.com/repos/akka/alpakka/subscription","commits_url":"https://api.github.com/repos/akka/alpakka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/alpakka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/alpakka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/alpakka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/alpakka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/alpakka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/alpakka/merges","archive_url":"https://api.github.com/repos/akka/alpakka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/alpakka/downloads","issues_url":"https://api.github.com/repos/akka/alpakka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/alpakka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/alpakka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/alpakka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/alpakka/labels{/name}","releases_url":"https://api.github.com/repos/akka/alpakka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/alpakka/deployments","created_at":"2016-10-13T13:08:14Z","updated_at":"2016-11-02T15:10:41Z","pushed_at":"2016-11-02T13:58:32Z","git_url":"git://github.com/akka/alpakka.git","ssh_url":"git@github.com:akka/alpakka.git","clone_url":"https://github.com/akka/alpakka.git","svn_url":"https://github.com/akka/alpakka","homepage":"","size":182,"stargazers_count":15,"watchers_count":15,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":11,"forks":5,"open_issues":11,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/alpakka/pulls/16"},"html":{"href":"https://github.com/akka/alpakka/pull/16"},"issue":{"href":"https://api.github.com/repos/akka/alpakka/issues/16"},"comments":{"href":"https://api.github.com/repos/akka/alpakka/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/alpakka/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/alpakka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/alpakka/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/akka/alpakka/statuses/c7854d1d77432512b31d0b55312f8f34e0282a4b"}}}}
{"actor":{"display_login":"ktoso"}}