Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
330fff0f
authored
Jun 15, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
心跳调整为10分钟一次
parent
83dfa9b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketClient.java
+3
-2
No files found.
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketClient.java
View file @
330fff0f
...
@@ -38,7 +38,8 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
...
@@ -38,7 +38,8 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
* 链接断开后自动进行重连尝试 <br/>
* 链接断开后自动进行重连尝试 <br/>
*/
*/
public
class
SCWebSocketClient
extends
WebSocketClient
{
public
class
SCWebSocketClient
extends
WebSocketClient
{
private
static
final
long
HEARTBEAT_INTERVAL
=
3
*
60
*
1000
;
private
static
final
long
FIRST_HEARTBEAT_DELAY
=
20
*
1000
;
private
static
final
long
HEARTBEAT_INTERVAL
=
10
*
60
*
1000
;
private
static
final
long
RECONNECT_DELAY
=
5
*
1000
;
private
static
final
long
RECONNECT_DELAY
=
5
*
1000
;
private
static
final
long
SWITCH_INTERVAL
=
10
*
1000
;
private
static
final
long
SWITCH_INTERVAL
=
10
*
1000
;
...
@@ -106,7 +107,7 @@ public class SCWebSocketClient extends WebSocketClient {
...
@@ -106,7 +107,7 @@ public class SCWebSocketClient extends WebSocketClient {
// 启动定时任务,轮询发送心跳包
// 启动定时任务,轮询发送心跳包
stopHeartbeat
();
stopHeartbeat
();
heartbeatFuture
=
SCTaskExecutor
.
getInstance
()
heartbeatFuture
=
SCTaskExecutor
.
getInstance
()
.
scheduleAtFixedRate
(
heartbeat
,
HEARTBEAT_INTERVAL
,
HEARTBEAT_INTERVAL
,
TimeUnit
.
MILLISECONDS
);
.
scheduleAtFixedRate
(
heartbeat
,
FIRST_HEARTBEAT_DELAY
,
HEARTBEAT_INTERVAL
,
TimeUnit
.
MILLISECONDS
);
LogUtils
.
d
(
TAG
,
"心跳任务启动"
);
LogUtils
.
d
(
TAG
,
"心跳任务启动"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment