Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
29f4140b
S
Serving
项目概览
PaddlePaddle
/
Serving
1 年多 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
29f4140b
编写于
6月 22, 2020
作者:
B
barrierye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update code
上级
fd668bde
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
15 deletion
+74
-15
java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/App.java
...-sdk-java/src/main/java/io/paddle/serving/client/App.java
+0
-15
java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/Client.java
...k-java/src/main/java/io/paddle/serving/client/Client.java
+74
-0
java/paddle-serving-sdk-java/src/main/proto/.multi_lang_general_model_service.proto.swp
...rc/main/proto/.multi_lang_general_model_service.proto.swp
+0
-0
未找到文件。
java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/App.java
已删除
100644 → 0
浏览文件 @
fd668bde
package
io.paddle.serving.client
;
import
io.paddle.serving.grpc.*
;
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Hello World!"
);
SimpleResponse
tmp
=
SimpleResponse
.
newBuilder
()
.
setErrCode
(
1
)
.
build
();
System
.
out
.
println
(
"Hello World!"
);
}
}
java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/Client.java
0 → 100644
浏览文件 @
29f4140b
package
io.paddle.serving.client
;
import
io.grpc.ManagedChannel
;
import
io.grpc.ManagedChannelBuilder
;
import
io.grpc.StatusRuntimeException
;
import
io.paddle.serving.grpc.*
;
public
class
Client
{
private
ManagedChannel
channel_
;
private
MultiLangGeneralModelServiceGrpc
.
MultiLangGeneralModelServiceBlockingStub
blockingStub_
;
private
MultiLangGeneralModelServiceGrpc
.
MultiLangGeneralModelServiceStub
asyncStub_
;
private
double
rpcTimeoutS_
;
Client
()
{
channel_
=
null
;
blockingStub_
=
null
;
asyncStub_
=
null
;
rpcTimeoutS_
=
2
;
}
Boolean
setRpcTimeoutMs
(
int
rpc_timeout
)
throws
NullPointerException
{
if
(
asyncStub_
==
null
||
blockingStub_
==
null
)
{
throw
new
NullPointerException
(
"set timeout must be set after connect."
);
}
rpcTimeoutS_
=
rpc_timeout
/
1000.0
;
SetTimeoutRequest
timeout_req
=
SetTimeoutRequest
.
newBuilder
()
.
setTimeoutMs
(
rpc_timeout
)
.
build
();
SimpleResponse
resp
;
try
{
resp
=
blockingStub_
.
setTimeout
(
timeout_req
);
}
catch
(
StatusRuntimeException
e
)
{
System
.
out
.
format
(
"Set RPC timeout failed: %s"
,
e
.
toString
());
return
false
;
}
return
resp
.
getErrCode
()
==
0
;
}
Boolean
connect
(
String
[]
endpoints
)
{
String
target
=
"ipv4:"
+
String
.
join
(
","
,
endpoints
);
// TODO: max_receive_message_length and max_send_message_length
try
{
channel_
=
ManagedChannelBuilder
.
forTarget
(
target
)
.
defaultLoadBalancingPolicy
(
"round_robin"
)
.
usePlaintext
()
.
build
();
blockingStub_
=
MultiLangGeneralModelServiceGrpc
.
newBlockingStub
(
channel_
);
asyncStub_
=
MultiLangGeneralModelServiceGrpc
.
newStub
(
channel_
);
}
catch
(
Exception
e
)
{
System
.
out
.
format
(
"Connect failed: %s"
,
e
.
toString
());
return
false
;
}
GetClientConfigRequest
get_client_config_req
=
GetClientConfigRequest
.
newBuilder
().
build
();
GetClientConfigResponse
resp
;
try
{
resp
=
blockingStub_
.
getClientConfig
(
get_client_config_req
);
}
catch
(
StatusRuntimeException
e
)
{
System
.
out
.
format
(
"Get Client config failed: %s"
,
e
.
toString
());
return
false
;
}
String
model_config_str
=
resp
.
getClientConfigStr
();
_parseModelConfig
(
model_config_str
);
return
true
;
}
void
_parseModelConfig
(
String
model_config_str
)
{
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Hello World!"
);
}
}
java/paddle-serving-sdk-java/src/main/proto/.multi_lang_general_model_service.proto.swp
0 → 100644
浏览文件 @
29f4140b
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录