{"action":"created","comment":{"url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/comments/27146672","id":27146672,"diff_hunk":"@@ -0,0 +1,64 @@\n+package io.ripc.rx.protocol.tcp;\n+\n+import io.ripc.protocol.tcp.Connection;\n+import io.ripc.protocol.tcp.Connection.FlushSelector;\n+import rx.Observable;\n+import rx.RxReactiveStreams;\n+import rx.Subscriber;\n+\n+import static rx.RxReactiveStreams.*;\n+\n+/**\n+ * An adapter for {@link Connection} representated as an {@link Observable}\n+ *\n+ * @param <R> The type of objects read from this connection.\n+ * @param <W> The type of objects written to this connection.\n+ */\n+public class RxConnection<R, W> extends Observable<R> {\n+\n+    private final Connection<R, W> delegate;\n+\n+    protected RxConnection(final Connection<R, W> delegate) {\n+        super(new OnSubscribe<R>() {\n+            @Override\n+            public void call(Subscriber<? super R> subscriber) {\n+                RxReactiveStreams.subscribe(delegate, subscriber);\n+            }\n+        });\n+        this.delegate = delegate;\n+    }\n+\n+    /**\n+     * Writes the passed stream of {@code data} and returns the result as an {@link Observable}. All items emitted by\n+     * this stream are flushed on completion of the stream.\n+     *\n+     * @param data Data stream to write.\n+     *\n+     * @return Result of write.\n+     */\n+    public Observable<Void> write(Observable<W> data) {\n+        return toObservable(delegate.write(toPublisher(data)));","path":"ripc-rxjava1/src/main/java/io/ripc/rx/protocol/tcp/RxConnection.java","position":40,"original_position":40,"commit_id":"46892b06325313b71fb05120cd337cae747ad4d1","original_commit_id":"46892b06325313b71fb05120cd337cae747ad4d1","user":{"login":"jbrisbin","id":55797,"avatar_url":"https://avatars.githubusercontent.com/u/55797?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrisbin","html_url":"https://github.com/jbrisbin","followers_url":"https://api.github.com/users/jbrisbin/followers","following_url":"https://api.github.com/users/jbrisbin/following{/other_user}","gists_url":"https://api.github.com/users/jbrisbin/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrisbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrisbin/subscriptions","organizations_url":"https://api.github.com/users/jbrisbin/orgs","repos_url":"https://api.github.com/users/jbrisbin/repos","events_url":"https://api.github.com/users/jbrisbin/events{/privacy}","received_events_url":"https://api.github.com/users/jbrisbin/received_events","type":"User","site_admin":false},"body":"I think in this case it would actually be more than that since every `Publisher` needs a `Subscriber` and a `Subscription` to be useful. It's likely some objects could be reused but if we assume the worst case (which is probably the most likely) then every write would involve the allocation of at least 5 objects + whatever wrappers, delegates, etc... exist in between (which could mean 3 * numOfTransformations). For Reactor we address this by using a `Stream` to represent input and output (something that's only created once) and we use a `Codec` facility to manage message transformation (something that's also only create once unless not practical).\r\n\r\nI was envisioning a \"write\" facility in this that isn't like `write(byte[])` but like `sink(ByteProducer)`. Namely an operation you could set up once and then pipe data into. You could always use it as a one-off operation but it would be more inefficient in that case.","created_at":"2015-03-25T17:47:59Z","updated_at":"2015-03-25T17:47:59Z","html_url":"https://github.com/reactive-ipc/reactive-ipc-jvm/pull/19#discussion_r27146672","pull_request_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/comments/27146672"},"html":{"href":"https://github.com/reactive-ipc/reactive-ipc-jvm/pull/19#discussion_r27146672"},"pull_request":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19","id":31660585,"html_url":"https://github.com/reactive-ipc/reactive-ipc-jvm/pull/19","diff_url":"https://github.com/reactive-ipc/reactive-ipc-jvm/pull/19.diff","patch_url":"https://github.com/reactive-ipc/reactive-ipc-jvm/pull/19.patch","issue_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues/19","number":19,"state":"open","locked":false,"title":"Proposal for TCP server at all layers (core, transport & rxjava1)","user":{"login":"NiteshKant","id":820005,"avatar_url":"https://avatars.githubusercontent.com/u/820005?v=3","gravatar_id":"","url":"https://api.github.com/users/NiteshKant","html_url":"https://github.com/NiteshKant","followers_url":"https://api.github.com/users/NiteshKant/followers","following_url":"https://api.github.com/users/NiteshKant/following{/other_user}","gists_url":"https://api.github.com/users/NiteshKant/gists{/gist_id}","starred_url":"https://api.github.com/users/NiteshKant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiteshKant/subscriptions","organizations_url":"https://api.github.com/users/NiteshKant/orgs","repos_url":"https://api.github.com/users/NiteshKant/repos","events_url":"https://api.github.com/users/NiteshKant/events{/privacy}","received_events_url":"https://api.github.com/users/NiteshKant/received_events","type":"User","site_admin":false},"body":"Based on various discussions around different issues, I am proposing a fresh design for a TCP server in this PR. \r\nI have implemented a TCP server at all layers in reactive-ipc, i.e. core, transport(netty) and rxjava1. I have also removed all code which isn't related to the implementation. We can discuss those utilities in isolation as and when required to be added. Although, not used, I have kept the `Buffer` and related classes as that aspect is not yet discussed to conclusion.\r\n\r\nThere are two samples each for netty transport and rxjava1 layer available to see how will a typical interaction look like in modules ripc-transport-netty4-examples and ripc-rxjava1-examples\r\n\r\nBackpressure has not been implemented yet.","created_at":"2015-03-20T23:38:24Z","updated_at":"2015-03-25T17:47:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"910f622725319e635712dc892863144713183c00","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19/commits","review_comments_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19/comments","review_comment_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues/19/comments","statuses_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/statuses/46892b06325313b71fb05120cd337cae747ad4d1","head":{"label":"NiteshKant:master","ref":"master","sha":"46892b06325313b71fb05120cd337cae747ad4d1","user":{"login":"NiteshKant","id":820005,"avatar_url":"https://avatars.githubusercontent.com/u/820005?v=3","gravatar_id":"","url":"https://api.github.com/users/NiteshKant","html_url":"https://github.com/NiteshKant","followers_url":"https://api.github.com/users/NiteshKant/followers","following_url":"https://api.github.com/users/NiteshKant/following{/other_user}","gists_url":"https://api.github.com/users/NiteshKant/gists{/gist_id}","starred_url":"https://api.github.com/users/NiteshKant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiteshKant/subscriptions","organizations_url":"https://api.github.com/users/NiteshKant/orgs","repos_url":"https://api.github.com/users/NiteshKant/repos","events_url":"https://api.github.com/users/NiteshKant/events{/privacy}","received_events_url":"https://api.github.com/users/NiteshKant/received_events","type":"User","site_admin":false},"repo":{"id":32036916,"name":"reactive-ipc-jvm","full_name":"NiteshKant/reactive-ipc-jvm","owner":{"login":"NiteshKant","id":820005,"avatar_url":"https://avatars.githubusercontent.com/u/820005?v=3","gravatar_id":"","url":"https://api.github.com/users/NiteshKant","html_url":"https://github.com/NiteshKant","followers_url":"https://api.github.com/users/NiteshKant/followers","following_url":"https://api.github.com/users/NiteshKant/following{/other_user}","gists_url":"https://api.github.com/users/NiteshKant/gists{/gist_id}","starred_url":"https://api.github.com/users/NiteshKant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiteshKant/subscriptions","organizations_url":"https://api.github.com/users/NiteshKant/orgs","repos_url":"https://api.github.com/users/NiteshKant/repos","events_url":"https://api.github.com/users/NiteshKant/events{/privacy}","received_events_url":"https://api.github.com/users/NiteshKant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NiteshKant/reactive-ipc-jvm","description":"Reactive IPC for the JVM","fork":true,"url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm","forks_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/forks","keys_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/teams","hooks_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/hooks","issue_events_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/issues/events{/number}","events_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/events","assignees_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/assignees{/user}","branches_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/branches{/branch}","tags_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/tags","blobs_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/statuses/{sha}","languages_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/languages","stargazers_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/stargazers","contributors_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/contributors","subscribers_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/subscribers","subscription_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/subscription","commits_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/issues/comments{/number}","contents_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/contents/{+path}","compare_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/merges","archive_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/downloads","issues_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/issues{/number}","pulls_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/pulls{/number}","milestones_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/milestones{/number}","notifications_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/labels{/name}","releases_url":"https://api.github.com/repos/NiteshKant/reactive-ipc-jvm/releases{/id}","created_at":"2015-03-11T19:28:50Z","updated_at":"2015-03-23T21:13:23Z","pushed_at":"2015-03-23T21:13:23Z","git_url":"git://github.com/NiteshKant/reactive-ipc-jvm.git","ssh_url":"git@github.com:NiteshKant/reactive-ipc-jvm.git","clone_url":"https://github.com/NiteshKant/reactive-ipc-jvm.git","svn_url":"https://github.com/NiteshKant/reactive-ipc-jvm","homepage":null,"size":190,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"reactive-ipc:master","ref":"master","sha":"bce6191251feb203aec78e24b943f118bb0b7737","user":{"login":"reactive-ipc","id":11262605,"avatar_url":"https://avatars.githubusercontent.com/u/11262605?v=3","gravatar_id":"","url":"https://api.github.com/users/reactive-ipc","html_url":"https://github.com/reactive-ipc","followers_url":"https://api.github.com/users/reactive-ipc/followers","following_url":"https://api.github.com/users/reactive-ipc/following{/other_user}","gists_url":"https://api.github.com/users/reactive-ipc/gists{/gist_id}","starred_url":"https://api.github.com/users/reactive-ipc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactive-ipc/subscriptions","organizations_url":"https://api.github.com/users/reactive-ipc/orgs","repos_url":"https://api.github.com/users/reactive-ipc/repos","events_url":"https://api.github.com/users/reactive-ipc/events{/privacy}","received_events_url":"https://api.github.com/users/reactive-ipc/received_events","type":"Organization","site_admin":false},"repo":{"id":31517055,"name":"reactive-ipc-jvm","full_name":"reactive-ipc/reactive-ipc-jvm","owner":{"login":"reactive-ipc","id":11262605,"avatar_url":"https://avatars.githubusercontent.com/u/11262605?v=3","gravatar_id":"","url":"https://api.github.com/users/reactive-ipc","html_url":"https://github.com/reactive-ipc","followers_url":"https://api.github.com/users/reactive-ipc/followers","following_url":"https://api.github.com/users/reactive-ipc/following{/other_user}","gists_url":"https://api.github.com/users/reactive-ipc/gists{/gist_id}","starred_url":"https://api.github.com/users/reactive-ipc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactive-ipc/subscriptions","organizations_url":"https://api.github.com/users/reactive-ipc/orgs","repos_url":"https://api.github.com/users/reactive-ipc/repos","events_url":"https://api.github.com/users/reactive-ipc/events{/privacy}","received_events_url":"https://api.github.com/users/reactive-ipc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactive-ipc/reactive-ipc-jvm","description":"Reactive IPC for the JVM","fork":false,"url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm","forks_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/forks","keys_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/teams","hooks_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/hooks","issue_events_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues/events{/number}","events_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/events","assignees_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/assignees{/user}","branches_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/branches{/branch}","tags_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/tags","blobs_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/statuses/{sha}","languages_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/languages","stargazers_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/stargazers","contributors_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/contributors","subscribers_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/subscribers","subscription_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/subscription","commits_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/contents/{+path}","compare_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/merges","archive_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/downloads","issues_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues{/number}","pulls_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls{/number}","milestones_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/milestones{/number}","notifications_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/labels{/name}","releases_url":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/releases{/id}","created_at":"2015-03-02T00:46:52Z","updated_at":"2015-03-18T17:15:18Z","pushed_at":"2015-03-23T21:13:24Z","git_url":"git://github.com/reactive-ipc/reactive-ipc-jvm.git","ssh_url":"git@github.com:reactive-ipc/reactive-ipc-jvm.git","clone_url":"https://github.com/reactive-ipc/reactive-ipc-jvm.git","svn_url":"https://github.com/reactive-ipc/reactive-ipc-jvm","homepage":null,"size":234,"stargazers_count":20,"watchers_count":20,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":17,"forks":4,"open_issues":17,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19"},"html":{"href":"https://github.com/reactive-ipc/reactive-ipc-jvm/pull/19"},"issue":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues/19"},"comments":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/reactive-ipc/reactive-ipc-jvm/statuses/46892b06325313b71fb05120cd337cae747ad4d1"}}}}