Skip to content

Commit

Permalink
Merge pull request #4834 from Pandrex247/FISH-82
Browse files Browse the repository at this point in the history
FISH-82 Command Line option --warmup results in an Exception when Payara Micro instance stops when Request Tracing is activated
  • Loading branch information
Pandrex247 authored Aug 18, 2020
2 parents ed0d7d3 + 461f457 commit df195d8
Showing 1 changed file with 10 additions and 5 deletions.
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) 2017-2019 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2017-2020 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 @@ -44,13 +44,13 @@
import fish.payara.nucleus.requesttracing.store.strategy.ReservoirTraceStorageStrategy;
import fish.payara.nucleus.requesttracing.store.strategy.TraceStorageStrategy;
import fish.payara.nucleus.store.ClusteredStore;
import org.glassfish.api.event.Events;
import org.glassfish.hk2.api.ServiceHandle;
import org.glassfish.internal.api.Globals;

import java.util.Map;
import java.util.UUID;

import org.glassfish.api.event.Events;
import org.glassfish.internal.api.Globals;

/**
* A factory for generating a
* {@link fish.payara.nucleus.requesttracing.store.RequestTraceStoreInterface}.
Expand Down Expand Up @@ -87,7 +87,12 @@ public static RequestTraceStoreInterface getStore(Events events, boolean reservo
}

// Get a clustered store if possible
ClusteredStore clusteredStore = Globals.getDefaultHabitat().getService(ClusteredStore.class);
ClusteredStore clusteredStore = null;
ServiceHandle<ClusteredStore> serviceHandle = Globals.getDefaultHabitat().getServiceHandle(ClusteredStore.class);
if (serviceHandle != null && serviceHandle.isActive()) {
clusteredStore = serviceHandle.getService();
}

if (clusteredStore != null && clusteredStore.isEnabled()) {
Map<UUID, RequestTrace> store = (Map) clusteredStore.getMap(storeName);
return new ClusteredRequestTraceStore(store, strategy);
Expand Down

0 comments on commit df195d8

Please sign in to comment.