Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
tsai
CAP
Commits
385dcf56
Commit
385dcf56
authored
Jun 17, 2019
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rabbitmq connection model create failed logs
parent
0e0fada1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
IConnectionChannelPool.Default.cs
...DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
+19
-2
No files found.
src/DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
View file @
385dcf56
...
@@ -18,6 +18,7 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -18,6 +18,7 @@ namespace DotNetCore.CAP.RabbitMQ
private
readonly
ILogger
<
ConnectionChannelPool
>
_logger
;
private
readonly
ILogger
<
ConnectionChannelPool
>
_logger
;
private
readonly
ConcurrentQueue
<
IModel
>
_pool
;
private
readonly
ConcurrentQueue
<
IModel
>
_pool
;
private
IConnection
_connection
;
private
IConnection
_connection
;
private
static
readonly
object
s_lock
=
new
object
();
private
int
_count
;
private
int
_count
;
private
int
_maxSize
;
private
int
_maxSize
;
...
@@ -47,7 +48,14 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -47,7 +48,14 @@ namespace DotNetCore.CAP.RabbitMQ
IModel
IConnectionChannelPool
.
Rent
()
IModel
IConnectionChannelPool
.
Rent
()
{
{
return
Rent
();
lock
(
s_lock
)
{
while
(
_count
>
_maxSize
)
{
Thread
.
SpinWait
(
1
);
}
return
Rent
();
}
}
}
bool
IConnectionChannelPool
.
Return
(
IModel
connection
)
bool
IConnectionChannelPool
.
Return
(
IModel
connection
)
...
@@ -120,7 +128,16 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -120,7 +128,16 @@ namespace DotNetCore.CAP.RabbitMQ
return
model
;
return
model
;
}
}
model
=
GetConnection
().
CreateModel
();
try
{
model
=
GetConnection
().
CreateModel
();
}
catch
(
Exception
e
)
{
_logger
.
LogError
(
e
,
"RabbitMQ channel model create failed!"
);
Console
.
WriteLine
(
e
);
throw
;
}
return
model
;
return
model
;
}
}
...
...
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