Skip to content

Commit

Permalink
PAYARA-2781 Exception thrown in logs when shutting down Payara (#2799)
Browse files Browse the repository at this point in the history
* PAYARA-2781 Exception thrown in logs when shutting down Payara
  • Loading branch information
Cousjava committed May 31, 2018
1 parent eb01fbd commit ca5626d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 34 deletions.
Expand Up @@ -242,9 +242,13 @@ public synchronized ObjectName loadAMXMBeans() {

@Override
public synchronized void unloadAMXMBeans() {
final J2EEDomain j2eeDomain = getJ2EEDomainProxy();
if (j2eeDomain != null) {
ImplUtil.unregisterAMXMBeans(j2eeDomain);
try {
final J2EEDomain j2eeDomain = getJ2EEDomainProxy();
if (j2eeDomain != null) {
ImplUtil.unregisterAMXMBeans(j2eeDomain);
}
} catch (NullPointerException e){
logger.log(Level.FINEST, "NullPointerException when stopping AMX, AMX may not have been started", e);
}
}
}
Expand Down
Expand Up @@ -41,7 +41,6 @@

import com.sun.enterprise.config.serverbeans.Config;
import com.sun.enterprise.util.SystemPropertyConstants;
import fish.payara.nucleus.hazelcast.HazelcastRuntimeConfiguration;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.text.MessageFormat;
Expand Down Expand Up @@ -105,7 +104,8 @@
})
public class SetNetworkListenerConfiguration implements AdminCommand, EventListener {

private Logger LOGGER = LogFacade.getLogger();
private static final Logger LOGGER = LogFacade.getLogger();
private static final String ADMIN_LISTENER = "admin-listener";
private static final ResourceBundle rb = LogFacade.getLogger().getResourceBundle();

//Parameters
Expand Down Expand Up @@ -158,7 +158,7 @@ public void postConstuct(){
}
@Override
public void event(EventListener.Event event) {
if (event.is(EventTypes.PREPARE_SHUTDOWN)) {
if (event.is(EventTypes.SERVER_SHUTDOWN)) {
shutdownChange();
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public Object run(final NetworkListener listenerProxy) throws PropertyVetoExcept
}, listener);

String oldPort = listener.getPort();
if (port != null){
if (port != null && ADMIN_LISTENER.equals(listenerName)){

UnprocessedChangeEvent unprocessed = new UnprocessedChangeEvent(
new PropertyChangeEvent(this, "port", oldPort, port), listener.getName() + " port changed from " + oldPort + " to " + port);
Expand Down Expand Up @@ -283,7 +283,6 @@ public Object run(final NetworkListener listenerProxy) throws PropertyVetoExcept
}
}
}
ucl.getUnprocessedChangeEvents().removeAll(processed);
}

}
Expand Up @@ -73,7 +73,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.ReentrantLock;
import org.glassfish.grizzly.config.GrizzlyListener;
import org.glassfish.grizzly.config.dom.NetworkConfig;
import org.glassfish.grizzly.impl.FutureImpl;
import org.glassfish.grizzly.impl.SafeFutureImpl;
Expand Down Expand Up @@ -201,31 +200,7 @@ private <T extends ConfigBeanProxy> NotProcessed processNetworkListener(Changed.
} break;
case CHANGE:
// If the listener is the admin listener
if (isAdminListener && false) {
final boolean dynamic = isAdminDynamic(changedProperties);
// If configuration is dynamic then make the change
if (dynamic) {
GrizzlyProxy proxy = (GrizzlyProxy) grizzlyService.lookupNetworkProxy(listener);
if (proxy != null) {
GrizzlyListener netListener = proxy.getUnderlyingListener();
netListener.processDynamicConfigurationChange(
grizzlyService.getHabitat(), changedProperties);
return null;
}
}
// Otherwise return the unprocessed event, describing the changed values.
if (!isRedundantChange(changedProperties)) {
StringBuilder eventsMessage = new StringBuilder();
/* Add list of changed events to an events message.
* Usually only one message is sent to this method at a time, so the for loop should only run once,
* but it's there just in case.
*/
for (PropertyChangeEvent event : changedProperties) {
eventsMessage.append("\"").append(event.getPropertyName()).append("\" changed from \"").
append(event.getOldValue()).append("\" to \"").append(event.getNewValue()).append("\".\n");
}
return new NotProcessed(listener.getThreadPool() + " attribute " + eventsMessage.toString());
}
if (isAdminListener) {
return null;
}

Expand Down

0 comments on commit ca5626d

Please sign in to comment.