{"action":"created","comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/comments/38436984","id":38436984,"diff_hunk":"@@ -59,7 +57,25 @@ def register\n     @logger.info(\"Log4j input\")\n   end # def register\n \n-  public\n+  def run(output_queue)\n+    if server?\n+      while !stop?\n+        Thread.start(@server_socket.accept) do |s|\n+          s.instance_eval { class << self; include ::LogStash::Util::SocketPeer end }\n+          @logger.debug? && @logger.debug(\"Accepted connection\", :client => s.peer, :server => \"#{@host}:#{@port}\")\n+          handle_socket(s, output_queue)\n+        end # Thread.start\n+      end # loop\n+    else\n+      while !stop?\n+        client_socket = TCPSocket.new(@host, @port)\n+        client_socket.instance_eval { class << self; include ::LogStash::Util::SocketPeer end }\n+        @logger.debug? && @logger.debug(\"Opened connection\", :client => \"#{client_socket.peer}\")\n+        handle_socket(client_socket, output_queue)\n+      end # loop\n+    end\n+  end # def run","path":"lib/logstash/inputs/log4j.rb","position":32,"original_position":32,"commit_id":"ffec0e319e5d6450c8ad18dbc8fb055efe730351","original_commit_id":"ffec0e319e5d6450c8ad18dbc8fb055efe730351","user":{"login":"ph","id":640,"avatar_url":"https://avatars.githubusercontent.com/u/640?v=3","gravatar_id":"","url":"https://api.github.com/users/ph","html_url":"https://github.com/ph","followers_url":"https://api.github.com/users/ph/followers","following_url":"https://api.github.com/users/ph/following{/other_user}","gists_url":"https://api.github.com/users/ph/gists{/gist_id}","starred_url":"https://api.github.com/users/ph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ph/subscriptions","organizations_url":"https://api.github.com/users/ph/orgs","repos_url":"https://api.github.com/users/ph/repos","events_url":"https://api.github.com/users/ph/events{/privacy}","received_events_url":"https://api.github.com/users/ph/received_events","type":"User","site_admin":false},"body":"Good time to split this method into 2 methods.\r\n\r\n```ruby\r\nrun_server(output_queue)\r\nrun_client(output_queue)\r\n```\r\n\r\nor \r\n\r\n```\r\nsend(\"run_#{mode}\", output_queue)`\r\n```","created_at":"2015-09-01T16:02:17Z","updated_at":"2015-09-01T16:02:17Z","html_url":"https://github.com/logstash-plugins/logstash-input-log4j/pull/16#discussion_r38436984","pull_request_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/comments/38436984"},"html":{"href":"https://github.com/logstash-plugins/logstash-input-log4j/pull/16#discussion_r38436984"},"pull_request":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16","id":43864696,"html_url":"https://github.com/logstash-plugins/logstash-input-log4j/pull/16","diff_url":"https://github.com/logstash-plugins/logstash-input-log4j/pull/16.diff","patch_url":"https://github.com/logstash-plugins/logstash-input-log4j/pull/16.patch","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues/16","number":16,"state":"open","locked":false,"title":"Make usage of the new stop semantics to properly shutdown the plugin","user":{"login":"purbon","id":68540,"avatar_url":"https://avatars.githubusercontent.com/u/68540?v=3","gravatar_id":"","url":"https://api.github.com/users/purbon","html_url":"https://github.com/purbon","followers_url":"https://api.github.com/users/purbon/followers","following_url":"https://api.github.com/users/purbon/following{/other_user}","gists_url":"https://api.github.com/users/purbon/gists{/gist_id}","starred_url":"https://api.github.com/users/purbon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purbon/subscriptions","organizations_url":"https://api.github.com/users/purbon/orgs","repos_url":"https://api.github.com/users/purbon/repos","events_url":"https://api.github.com/users/purbon/events{/privacy}","received_events_url":"https://api.github.com/users/purbon/received_events","type":"User","site_admin":false},"body":"Implements `stop` to return from `run` according to https://github.com/elastic/logstash/issues/3210\r\n\r\nDepends on https://github.com/elastic/logstash-devutils/pull/32 and https://github.com/elastic/logstash/pull/3812","created_at":"2015-09-01T11:29:12Z","updated_at":"2015-09-01T16:02:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"334619731060a609ae77d1232f2a1ca1604a7de2","assignee":{"login":"ph","id":640,"avatar_url":"https://avatars.githubusercontent.com/u/640?v=3","gravatar_id":"","url":"https://api.github.com/users/ph","html_url":"https://github.com/ph","followers_url":"https://api.github.com/users/ph/followers","following_url":"https://api.github.com/users/ph/following{/other_user}","gists_url":"https://api.github.com/users/ph/gists{/gist_id}","starred_url":"https://api.github.com/users/ph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ph/subscriptions","organizations_url":"https://api.github.com/users/ph/orgs","repos_url":"https://api.github.com/users/ph/repos","events_url":"https://api.github.com/users/ph/events{/privacy}","received_events_url":"https://api.github.com/users/ph/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16/commits","review_comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16/comments","review_comment_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues/16/comments","statuses_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/statuses/ffec0e319e5d6450c8ad18dbc8fb055efe730351","head":{"label":"purbon:feature/use_new_shutdown","ref":"feature/use_new_shutdown","sha":"ffec0e319e5d6450c8ad18dbc8fb055efe730351","user":{"login":"purbon","id":68540,"avatar_url":"https://avatars.githubusercontent.com/u/68540?v=3","gravatar_id":"","url":"https://api.github.com/users/purbon","html_url":"https://github.com/purbon","followers_url":"https://api.github.com/users/purbon/followers","following_url":"https://api.github.com/users/purbon/following{/other_user}","gists_url":"https://api.github.com/users/purbon/gists{/gist_id}","starred_url":"https://api.github.com/users/purbon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purbon/subscriptions","organizations_url":"https://api.github.com/users/purbon/orgs","repos_url":"https://api.github.com/users/purbon/repos","events_url":"https://api.github.com/users/purbon/events{/privacy}","received_events_url":"https://api.github.com/users/purbon/received_events","type":"User","site_admin":false},"repo":{"id":30754664,"name":"logstash-input-log4j","full_name":"purbon/logstash-input-log4j","owner":{"login":"purbon","id":68540,"avatar_url":"https://avatars.githubusercontent.com/u/68540?v=3","gravatar_id":"","url":"https://api.github.com/users/purbon","html_url":"https://github.com/purbon","followers_url":"https://api.github.com/users/purbon/followers","following_url":"https://api.github.com/users/purbon/following{/other_user}","gists_url":"https://api.github.com/users/purbon/gists{/gist_id}","starred_url":"https://api.github.com/users/purbon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purbon/subscriptions","organizations_url":"https://api.github.com/users/purbon/orgs","repos_url":"https://api.github.com/users/purbon/repos","events_url":"https://api.github.com/users/purbon/events{/privacy}","received_events_url":"https://api.github.com/users/purbon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/purbon/logstash-input-log4j","description":null,"fork":true,"url":"https://api.github.com/repos/purbon/logstash-input-log4j","forks_url":"https://api.github.com/repos/purbon/logstash-input-log4j/forks","keys_url":"https://api.github.com/repos/purbon/logstash-input-log4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/purbon/logstash-input-log4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/purbon/logstash-input-log4j/teams","hooks_url":"https://api.github.com/repos/purbon/logstash-input-log4j/hooks","issue_events_url":"https://api.github.com/repos/purbon/logstash-input-log4j/issues/events{/number}","events_url":"https://api.github.com/repos/purbon/logstash-input-log4j/events","assignees_url":"https://api.github.com/repos/purbon/logstash-input-log4j/assignees{/user}","branches_url":"https://api.github.com/repos/purbon/logstash-input-log4j/branches{/branch}","tags_url":"https://api.github.com/repos/purbon/logstash-input-log4j/tags","blobs_url":"https://api.github.com/repos/purbon/logstash-input-log4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/purbon/logstash-input-log4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/purbon/logstash-input-log4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/purbon/logstash-input-log4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/purbon/logstash-input-log4j/statuses/{sha}","languages_url":"https://api.github.com/repos/purbon/logstash-input-log4j/languages","stargazers_url":"https://api.github.com/repos/purbon/logstash-input-log4j/stargazers","contributors_url":"https://api.github.com/repos/purbon/logstash-input-log4j/contributors","subscribers_url":"https://api.github.com/repos/purbon/logstash-input-log4j/subscribers","subscription_url":"https://api.github.com/repos/purbon/logstash-input-log4j/subscription","commits_url":"https://api.github.com/repos/purbon/logstash-input-log4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/purbon/logstash-input-log4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/purbon/logstash-input-log4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/purbon/logstash-input-log4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/purbon/logstash-input-log4j/contents/{+path}","compare_url":"https://api.github.com/repos/purbon/logstash-input-log4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/purbon/logstash-input-log4j/merges","archive_url":"https://api.github.com/repos/purbon/logstash-input-log4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/purbon/logstash-input-log4j/downloads","issues_url":"https://api.github.com/repos/purbon/logstash-input-log4j/issues{/number}","pulls_url":"https://api.github.com/repos/purbon/logstash-input-log4j/pulls{/number}","milestones_url":"https://api.github.com/repos/purbon/logstash-input-log4j/milestones{/number}","notifications_url":"https://api.github.com/repos/purbon/logstash-input-log4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/purbon/logstash-input-log4j/labels{/name}","releases_url":"https://api.github.com/repos/purbon/logstash-input-log4j/releases{/id}","created_at":"2015-02-13T12:03:00Z","updated_at":"2015-05-05T08:39:08Z","pushed_at":"2015-09-01T11:28:24Z","git_url":"git://github.com/purbon/logstash-input-log4j.git","ssh_url":"git@github.com:purbon/logstash-input-log4j.git","clone_url":"https://github.com/purbon/logstash-input-log4j.git","svn_url":"https://github.com/purbon/logstash-input-log4j","homepage":null,"size":593,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"logstash-plugins:master","ref":"master","sha":"d60375af53741fb51a20c12b87f51392a9be73ad","user":{"login":"logstash-plugins","id":8961934,"avatar_url":"https://avatars.githubusercontent.com/u/8961934?v=3","gravatar_id":"","url":"https://api.github.com/users/logstash-plugins","html_url":"https://github.com/logstash-plugins","followers_url":"https://api.github.com/users/logstash-plugins/followers","following_url":"https://api.github.com/users/logstash-plugins/following{/other_user}","gists_url":"https://api.github.com/users/logstash-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/logstash-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logstash-plugins/subscriptions","organizations_url":"https://api.github.com/users/logstash-plugins/orgs","repos_url":"https://api.github.com/users/logstash-plugins/repos","events_url":"https://api.github.com/users/logstash-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/logstash-plugins/received_events","type":"Organization","site_admin":false},"repo":{"id":25312482,"name":"logstash-input-log4j","full_name":"logstash-plugins/logstash-input-log4j","owner":{"login":"logstash-plugins","id":8961934,"avatar_url":"https://avatars.githubusercontent.com/u/8961934?v=3","gravatar_id":"","url":"https://api.github.com/users/logstash-plugins","html_url":"https://github.com/logstash-plugins","followers_url":"https://api.github.com/users/logstash-plugins/followers","following_url":"https://api.github.com/users/logstash-plugins/following{/other_user}","gists_url":"https://api.github.com/users/logstash-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/logstash-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logstash-plugins/subscriptions","organizations_url":"https://api.github.com/users/logstash-plugins/orgs","repos_url":"https://api.github.com/users/logstash-plugins/repos","events_url":"https://api.github.com/users/logstash-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/logstash-plugins/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/logstash-plugins/logstash-input-log4j","description":null,"fork":false,"url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j","forks_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/forks","keys_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/teams","hooks_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/hooks","issue_events_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues/events{/number}","events_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/events","assignees_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/assignees{/user}","branches_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/branches{/branch}","tags_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/tags","blobs_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/statuses/{sha}","languages_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/languages","stargazers_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/stargazers","contributors_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/contributors","subscribers_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/subscribers","subscription_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/subscription","commits_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/contents/{+path}","compare_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/merges","archive_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/downloads","issues_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues{/number}","pulls_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls{/number}","milestones_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/milestones{/number}","notifications_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/labels{/name}","releases_url":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/releases{/id}","created_at":"2014-10-16T17:03:22Z","updated_at":"2015-08-02T12:29:33Z","pushed_at":"2015-09-01T11:29:12Z","git_url":"git://github.com/logstash-plugins/logstash-input-log4j.git","ssh_url":"git@github.com:logstash-plugins/logstash-input-log4j.git","clone_url":"https://github.com/logstash-plugins/logstash-input-log4j.git","svn_url":"https://github.com/logstash-plugins/logstash-input-log4j","homepage":null,"size":736,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":7,"forks":6,"open_issues":7,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16"},"html":{"href":"https://github.com/logstash-plugins/logstash-input-log4j/pull/16"},"issue":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues/16"},"comments":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-log4j/statuses/ffec0e319e5d6450c8ad18dbc8fb055efe730351"}}}}