File tree 1 file changed +6
-1
lines changed
src/main/java/io/nats/client/impl
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ boolean push(NatsMessage msg) {
141
141
142
142
boolean push (NatsMessage msg , boolean internal ) {
143
143
long start = System .currentTimeMillis ();
144
+ boolean lockWasSuccessful = false ;
144
145
try {
145
146
/*
146
147
This was essentially a Head-Of-Line blocking problem.
@@ -166,6 +167,8 @@ boolean push(NatsMessage msg, boolean internal) {
166
167
throw new IllegalStateException (OUTPUT_QUEUE_IS_FULL + queue .size ());
167
168
}
168
169
170
+ lockWasSuccessful = true ;
171
+
169
172
if (!internal && this .discardWhenFull ) {
170
173
return this .queue .offer (msg );
171
174
}
@@ -184,7 +187,9 @@ boolean push(NatsMessage msg, boolean internal) {
184
187
return false ;
185
188
}
186
189
finally {
187
- editLock .unlock ();
190
+ if (lockWasSuccessful ) {
191
+ editLock .unlock ();
192
+ }
188
193
}
189
194
}
190
195
You can’t perform that action at this time.
0 commit comments