Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
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
dataplatform
atlas
Commits
48e52249
Commit
48e52249
authored
6 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2877: updated notification processing to wait only before retry
parent
3176d1a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
NotificationHookConsumer.java
...g/apache/atlas/notification/NotificationHookConsumer.java
+17
-14
No files found.
webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
View file @
48e52249
...
@@ -294,7 +294,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -294,7 +294,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
class
HookConsumer
extends
ShutdownableThread
{
class
HookConsumer
extends
ShutdownableThread
{
private
final
NotificationConsumer
<
HookNotification
>
consumer
;
private
final
NotificationConsumer
<
HookNotification
>
consumer
;
private
final
AtomicBoolean
shouldRun
=
new
AtomicBoolean
(
false
);
private
final
AtomicBoolean
shouldRun
=
new
AtomicBoolean
(
false
);
private
final
List
<
HookNotification
>
failedMessages
=
new
ArrayList
<>();
private
final
List
<
String
>
failedMessages
=
new
ArrayList
<>();
private
final
AdaptiveWaiter
adaptiveWaiter
=
new
AdaptiveWaiter
(
minWaitDuration
,
maxWaitDuration
,
minWaitDuration
);
private
final
AdaptiveWaiter
adaptiveWaiter
=
new
AdaptiveWaiter
(
minWaitDuration
,
maxWaitDuration
,
minWaitDuration
);
@VisibleForTesting
@VisibleForTesting
...
@@ -523,26 +523,29 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -523,26 +523,29 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
RequestContext
.
get
().
resetEntityGuidUpdates
();
RequestContext
.
get
().
resetEntityGuidUpdates
();
LOG
.
warn
(
"Error handling message"
,
e
);
try
{
LOG
.
info
(
"Sleeping for {} ms before retry"
,
consumerRetryInterval
);
Thread
.
sleep
(
consumerRetryInterval
);
}
catch
(
InterruptedException
ie
)
{
LOG
.
error
(
"Notification consumer thread sleep interrupted"
);
}
if
(
numRetries
==
(
maxRetries
-
1
))
{
if
(
numRetries
==
(
maxRetries
-
1
))
{
LOG
.
warn
(
"Max retries exceeded for message {}"
,
message
,
e
);
String
strMessage
=
AbstractNotification
.
getMessageJson
(
message
);
LOG
.
warn
(
"Max retries exceeded for message {}"
,
strMessage
,
e
);
isFailedMsg
=
true
;
isFailedMsg
=
true
;
failedMessages
.
add
(
m
essage
);
failedMessages
.
add
(
strM
essage
);
if
(
failedMessages
.
size
()
>=
failedMsgCacheSize
)
{
if
(
failedMessages
.
size
()
>=
failedMsgCacheSize
)
{
recordFailedMessages
();
recordFailedMessages
();
}
}
return
;
return
;
}
else
{
LOG
.
warn
(
"Error handling message"
,
e
);
try
{
LOG
.
info
(
"Sleeping for {} ms before retry"
,
consumerRetryInterval
);
Thread
.
sleep
(
consumerRetryInterval
);
}
catch
(
InterruptedException
ie
)
{
LOG
.
error
(
"Notification consumer thread sleep interrupted"
);
}
}
}
}
finally
{
}
finally
{
RequestContext
.
clear
();
RequestContext
.
clear
();
...
@@ -564,8 +567,8 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -564,8 +567,8 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
private
void
recordFailedMessages
()
{
private
void
recordFailedMessages
()
{
//logging failed messages
//logging failed messages
for
(
HookNotification
message
:
failedMessages
)
{
for
(
String
message
:
failedMessages
)
{
FAILED_LOG
.
error
(
"[DROPPED_NOTIFICATION] {}"
,
AbstractNotification
.
getMessageJson
(
message
)
);
FAILED_LOG
.
error
(
"[DROPPED_NOTIFICATION] {}"
,
message
);
}
}
failedMessages
.
clear
();
failedMessages
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
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