Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-1696 stop previous thread when notifier is configured #1640

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,4 @@ public void bootstrap() {
scheduleExecutor(new DatadogNotificationRunnable(queue, executionOptions));
}

@Override
public void shutdown() {
super.reset();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -101,8 +101,4 @@ public void bootstrap() {
}
}

@Override
public void shutdown() {
super.reset();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -81,8 +81,4 @@ public void bootstrap() {
scheduleExecutor(new HipchatNotificationRunnable(queue, executionOptions));
}

@Override
public void shutdown() {
super.reset();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -123,11 +123,6 @@ public void bootstrap() {
}
}

@Override
public void shutdown() {
super.reset();
}

@Override
@Subscribe
public void handleNotification(JmsNotificationEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,5 @@ public void bootstrap() {
executionOptions = (NewRelicNotifierConfigurationExecutionOptions) getNotifierConfigurationExecutionOptions();
scheduleExecutor(new NewRelicNotificationRunnable(queue, executionOptions));
}

@Override
public void shutdown() {
super.reset();
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -82,8 +82,4 @@ public void bootstrap() {
scheduleExecutor(new SlackNotificationRunnable(queue, executionOptions));
}

@Override
public void shutdown() {
super.reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void bootstrap() {

@Override
public void shutdown() {
super.reset();
super.shutdown();
if (snmp != null) {
try {
snmp.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -116,7 +116,7 @@ public void bootstrap() {

@Override
public void shutdown() {
super.reset();
super.shutdown();
if (connection != null) {
connection.disconnect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public NotifierConfigurationExecutionOptions getNotifierConfigurationExecutionOp
return null;
}

/**
* Unregisters a service and cleans up any information stored in it
* This function does NOT restart the service.
* @param service
*/
protected void reset(BaseNotifierService service) {
eventBus.unregister(service);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -85,12 +85,27 @@ protected ScheduledFuture scheduleExecutor(NotificationRunnable notificationRunn
TimeUnit.MILLISECONDS);
}

/**
* Unregisters the service and cleans up any information stored in it
* This function does NOT restart the service.
*/
protected void reset() {
super.reset(this);
queue.resetQueue();
if (scheduledFuture != null) {
scheduledFuture.cancel(true);
}
initializeExecutor();
//initializeExecutor();
}

/**
* Shuts down the service
*/
@Override
public void shutdown(){
if (executor != null){
executor.shutdown();
}
reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,4 @@ public void bootstrap() {
executionOptions = (EventbusNotifierConfigurationExecutionOptions) getNotifierConfigurationExecutionOptions();
}

@Override
public void shutdown() {
super.reset();
}
}