Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
com.hdp.customerservice
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘文胜
com.hdp.customerservice
Commits
65d30f1a
Commit
65d30f1a
authored
Jun 25, 2015
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
fc3f6d25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
IMManager.java
...ain/java/com/hdp/customerservice/websocket/IMManager.java
+5
-7
No files found.
src/main/java/com/hdp/customerservice/websocket/IMManager.java
View file @
65d30f1a
...
@@ -29,7 +29,9 @@ import com.hdp.pi.wechat.messages.NewUserMessage;
...
@@ -29,7 +29,9 @@ import com.hdp.pi.wechat.messages.NewUserMessage;
public
final
class
IMManager
{
public
final
class
IMManager
{
private
static
Log
log
=
LogFactory
.
getLog
(
IMManager
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(
IMManager
.
class
);
private
static
ExecutorService
pool
=
Executors
.
newFixedThreadPool
(
Runtime
.
getRuntime
().
availableProcessors
()
*
2
);
private
static
int
poolSize
=
Runtime
.
getRuntime
().
availableProcessors
()
*
2
;
private
static
ExecutorService
pool
=
Executors
.
newFixedThreadPool
(
poolSize
);
private
static
CopyOnWriteArrayList
<
Waiter
>
waiters
=
new
CopyOnWriteArrayList
<
Waiter
>();
private
static
CopyOnWriteArrayList
<
Waiter
>
waiters
=
new
CopyOnWriteArrayList
<
Waiter
>();
...
@@ -87,17 +89,13 @@ public final class IMManager {
...
@@ -87,17 +89,13 @@ public final class IMManager {
waiters
.
remove
(
w
);
waiters
.
remove
(
w
);
}
}
static
{
static
{
int
pross
=
Runtime
.
getRuntime
().
availableProcessors
();
for
(
int
i
=
0
;
i
<
poolSize
;
i
++){
if
(
pross
==
0
){
pross
=
1
;
}
for
(
int
i
=
0
;
i
<
pross
;
i
++){
pool
.
execute
(
new
Runnable
()
{
//消息发射器
pool
.
execute
(
new
Runnable
()
{
//消息发射器
public
void
hand
(){
public
void
hand
(){
AbstractMessage
e
=
queue
.
poll
();
AbstractMessage
e
=
queue
.
poll
();
if
(
e
==
null
){
if
(
e
==
null
){
try
{
try
{
Thread
.
sleep
(
5
0
);
Thread
.
sleep
(
1
0
);
}
catch
(
InterruptedException
e1
)
{
}
catch
(
InterruptedException
e1
)
{
}
}
return
;
return
;
...
...
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