- Notifications
You must be signed in to change notification settings - Fork 44
add transport server, client, encode, decode #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
99 commits Select commit Hold shift + click to select a range
adb80f3
* add netty dependent
coderzc 170bdcf
* add netty dependent
coderzc 6153840
* add netty dependent
coderzc 31b8bdd
* add netty dependent
coderzc f1f2fe4
improve copyright
coderzc d9d280b
modify netty depend
coderzc 90f9566
improve transport config
coderzc 401d705
add NettyTransportServer
coderzc 31c8a0a
* add netty dependent
coderzc 6243396
improve copyright
coderzc f33b445
modify netty depend
coderzc dc839ba
delete extra IOMode
coderzc c805661
* improve NettyTransportServer
coderzc a3b2838
* improve NettyTransportServer
coderzc fa1f20f
* improve NettyTransportServer
coderzc bd414aa
fix check style
coderzc 93a724a
NettyConnectionManager --> NettyClientConnectionManager
coderzc ab672d3
NettyConnectionManager --> NettyClientConnectionManager
coderzc 44545ea
NettyConnectionManager --> NettyClientConnectionManager
coderzc cbcfd63
optimize ClientManager, ClientFactory, NettyTransportClient
coderzc df6b884
optimize ClientManager, ClientFactory, NettyTransportClient
coderzc db1e637
optimize ClientManager, ClientFactory, NettyTransportClient
coderzc 6e43291
optimize ClientManager,ClientFactory
coderzc 903cf44
* optimize code style
coderzc bbe4863
* optimize code style
coderzc 12995d2
* improve ConnectionManager interface
coderzc 132f260
* fix code style
coderzc 8df69da
* rebase master
coderzc b9f6346
improve host and connection error message
coderzc 0a80d99
Transport4Client -> TransportClient, Transport4Server -> TransportServer
coderzc cd6b359
* add Message,Handler,codec
coderzc bd142d8
fix code style
coderzc 824ceac
* fix code style
coderzc dfb3f0e
* fix code style
coderzc 57b8530
improve MessageDecoder
coderzc a3cadae
fix code style
coderzc c6cea82
fix code style
coderzc ff0fff4
* improve test coverage
coderzc e78d093
fix code style
coderzc d93ea04
* fix code style
coderzc 4a9da67
* fix code style
coderzc 0229bfb
add timeout
coderzc a0027ab
add timeout
coderzc 12cf651
* 2000 -> 2000L
coderzc 0b541e6
3000 -> 3000L
coderzc aede99b
* zero-copy body
coderzc 3476e5e
* use zero-copy transport
coderzc c758703
add blank line
coderzc 7f3d5c0
improve buffer reference
coderzc d115d5e
improve buffer reference
coderzc 1a9a4f3
* add WakeHandler
coderzc c6651b4
* improve code style
coderzc d4b37b9
add message title
coderzc 5d19234
improve code style
coderzc d9cd8c6
add ClientChannelListenerOnWrite
coderzc bf421fd
add ClientChannelListenerOnWrite
coderzc d71bd52
improve ChannelFutureListenerOnWrite
coderzc 5761e32
improve test coverage
coderzc e94e5fd
improve test coverage
coderzc b61d91a
improve code style
coderzc 0ea08ce
improve code style
coderzc 7f44f71
improve code style
coderzc 9a86777
improve code style
coderzc 51e29fd
improve code style
coderzc 1772e52
improve code style
coderzc d969eaa
improve code style
coderzc 136e46b
improve code style
coderzc d2a48f0
improve code style
coderzc ca75306
improve code style
coderzc 768699a
4 -> Integer.BYTES
coderzc d50466b
* remove 'import static'
coderzc 9598ea0
fix failMessage bodyLength
coderzc 2905c68
improve readString()
coderzc 6118e05
again compile
coderzc dba069f
remove skipExtraBuffer
coderzc 1631615
slice body and retain it
coderzc ff14845
slice body and retain it
coderzc 42ec875
slice body and retain it
coderzc 6d64cd5
slice body and retain it
coderzc 84bcd31
fix style
coderzc 58ba674
* improve code style
coderzc 2d74673
improve message
coderzc 081be0c
assert header
coderzc 4f399f4
* rebase master
coderzc 20699fb
improve comment
coderzc e188287
improve import
coderzc b0d7d6a
default use EDGE_TRIGGERED
coderzc 8662ea6
improve some comments
coderzc a3345b3
revert
coderzc b383a88
revert
coderzc 1b4a11e
recompile
coderzc 759a3f5
improve some comments
coderzc bd2cbd3
fix too long
coderzc c516fa9
improve some log
coderzc 71a3abd
improve some log
coderzc 31671be
improve readString, writeString
coderzc a063a9c
improve some log
coderzc ea268ef
add TRANSPORT_SYNC_REQUEST_TIMEOUT
coderzc fbf8036
improve desc
coderzc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions 70 .../src/main/java/com/baidu/hugegraph/computer/core/common/exception/TransportException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2017 HugeGraph Authors | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with this | ||
* work for additional information regarding copyright ownership. The ASF | ||
* licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
| ||
package com.baidu.hugegraph.computer.core.common.exception; | ||
| ||
import java.io.IOException; | ||
| ||
/** | ||
* The transport network exception | ||
*/ | ||
public class TransportException extends IOException { | ||
| ||
private static final long serialVersionUID = -6538118382075299762L; | ||
| ||
public static final int DEFAULT_CODE = 0; | ||
| ||
private final int errorCode; | ||
| ||
public TransportException(String message) { | ||
this(DEFAULT_CODE, message); | ||
} | ||
| ||
public TransportException(int errorCode, String message) { | ||
super(message); | ||
this.errorCode = errorCode; | ||
} | ||
| ||
public TransportException(String message, Object... args) { | ||
this(DEFAULT_CODE, message, args); | ||
} | ||
| ||
public TransportException(int errorCode, String message, Object... args) { | ||
super(String.format(message, args)); | ||
this.errorCode = errorCode; | ||
} | ||
| ||
public TransportException(String message, Throwable cause) { | ||
super(message, cause); | ||
this.errorCode = DEFAULT_CODE; | ||
} | ||
| ||
public TransportException(String message, Throwable cause, Object... args) { | ||
super(String.format(message, args), cause); | ||
this.errorCode = DEFAULT_CODE; | ||
} | ||
| ||
public Throwable rootCause() { | ||
return ComputeException.rootCause(this); | ||
} | ||
| ||
public int errorCode() { | ||
return this.errorCode; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions 46 computer-core/src/main/java/com/baidu/hugegraph/computer/core/network/ClientFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2017 HugeGraph Authors | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with this | ||
* work for additional information regarding copyright ownership. The ASF | ||
* licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
| ||
package com.baidu.hugegraph.computer.core.network; | ||
| ||
| ||
import com.baidu.hugegraph.computer.core.common.exception.TransportException; | ||
| ||
public interface ClientFactory { | ||
| ||
/** | ||
* Initialize the {@link ClientFactory} | ||
*/ | ||
void init(); | ||
| ||
/** | ||
* Create a TransportClient. | ||
* @param connectionId {@link ConnectionId} | ||
* @param handler | ||
* @return {@link TransportClient} | ||
*/ | ||
TransportClient createClient(ConnectionId connectionId, | ||
ClientHandler handler) | ||
throws TransportException; | ||
| ||
coderzc marked this conversation as resolved. Show resolved Hide resolved | ||
/** | ||
* Close the {@link ClientFactory} | ||
*/ | ||
void close(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.