Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosConnectRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosConnectRoot
Commits
bb5ff01f
Commit
bb5ff01f
authored
Dec 16, 2019
by
xukaiqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update GeneralDataQueue.java
parent
9adb7d40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
34 deletions
+4
-34
GeneralDataQueue.java
...ejoin/amos/iec104/tcp/client/invoke/GeneralDataQueue.java
+4
-34
No files found.
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/client/invoke/GeneralDataQueue.java
View file @
bb5ff01f
...
...
@@ -10,9 +10,7 @@ import com.yeejoin.amos.iec104.business.service.intfc.IConfService;
import
com.yeejoin.amos.iec104.business.service.intfc.IPointConfigService
;
import
com.yeejoin.amos.iec104.context.FireAutoIntfContext
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.LinkedList
;
...
...
@@ -30,13 +28,13 @@ public class GeneralDataQueue {
IConfService
confService
;
private
volatile
static
GeneralDataQueue
instance
=
null
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
private
GeneralDataQueue
()
{
clientListenService
=
(
IClientListenService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IClientListenService
.
class
);
confService
=
(
IConfService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IConfService
.
class
);
pointConfigService
=
(
IPointConfigService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IPointConfigService
.
class
);
redisTemplate
=
(
RedisTemplate
<
String
,
String
>)
FireAutoIntfContext
.
getInstance
().
getBean
(
RedisTemplate
.
class
);
}
public
static
GeneralDataQueue
getInstance
()
{
...
...
@@ -89,43 +87,15 @@ public class GeneralDataQueue {
while
(
true
)
{
try
{
AlarmParam
param1
=
blockingQueue
.
take
();
if
(!
alarmParamIsChange
(
param1
))
{
return
;
}
LinkedList
<
AlarmParam
>
datas
=
new
LinkedList
<>();
PointConfigVo
vo
=
pointConfigService
.
findByServicesIdAndInfoAddress
(
param1
.
getServiceId
(),
Integer
.
valueOf
(
param1
.
getInformationAddress
()));
param1
.
setPointCode
(
vo
.
getPointCode
());
datas
.
add
(
param1
);
boolean
isEmpty
=
false
;
do
{
AlarmParam
param
=
blockingQueue
.
poll
(
1
,
TimeUnit
.
SECONDS
);
if
(!
ObjectUtils
.
isEmpty
(
param
))
{
PointConfigVo
vo1
=
pointConfigService
.
findByServicesIdAndInfoAddress
(
param
.
getServiceId
(),
Integer
.
valueOf
(
param
.
getInformationAddress
()));
if
(!
ObjectUtils
.
isEmpty
(
vo1
))
{
param
.
setPointCode
(
vo1
.
getPointCode
());
datas
.
add
(
param
);
if
(
datas
.
size
()
>
10000
)
{
clientListenService
.
sendDatas
(
IEC104Constant
.
GENERAL_MESSAGE
,
datas
);
datas
.
clear
();
}
}
else
{
Logger
.
getLogger
(
this
.
getClass
()).
error
(
param
.
getServiceId
()
+
" have not "
+
param
.
getInformationAddress
());
}
}
else
{
isEmpty
=
true
;
}
}
while
(!
isEmpty
);
try
{
if
(!
ObjectUtils
.
isEmpty
(
datas
))
{
clientListenService
.
sendDatas
(
IEC104Constant
.
GENERAL_MESSAGE
,
datas
);
}
datas
.
clear
();
}
catch
(
Exception
e
)
{
if
(
alarmParamIsChange
(
param1
))
{
datas
.
add
(
param1
);
clientListenService
.
sendDatas
(
IEC104Constant
.
GENERAL_MESSAGE
,
datas
);
}
}
catch
(
Exception
e
)
{
Logger
.
getLogger
(
this
.
getClass
()).
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
}
}
...
...
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