Skip to content

Package: ProbeNotifier

ProbeNotifier

nameinstructionbranchcomplexitylinemethod
ProbeNotifier()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
notifyBufferAllocated(DefaultMonitoringConfig, int)
M: 26 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
notifyBufferAllocatedFromPool(DefaultMonitoringConfig, int)
M: 26 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
notifyBufferReleasedToPool(DefaultMonitoringConfig, int)
M: 26 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.glassfish.grizzly.memory;
18:
19: import org.glassfish.grizzly.monitoring.DefaultMonitoringConfig;
20:
21: /**
22: * Utility class, which has notification methods for different {@link MemoryProbe} events.
23: *
24: * @author Alexey Stashok
25: */
26: final class ProbeNotifier {
27:
28: /**
29: * Notify registered {@link MemoryProbe}s about the "allocated" event.
30: *
31: * @param size buffer size
32: */
33: static void notifyBufferAllocated(final DefaultMonitoringConfig<MemoryProbe> config, final int size) {
34:
35: final MemoryProbe[] probes = config.getProbesUnsafe();
36:• if (probes != null) {
37:• for (MemoryProbe probe : probes) {
38: probe.onBufferAllocateEvent(size);
39: }
40: }
41: }
42:
43: /**
44: * Notify registered {@link MemoryProbe}s about the "allocated from pool" event.
45: *
46: * @param size buffer size
47: */
48: static void notifyBufferAllocatedFromPool(final DefaultMonitoringConfig<MemoryProbe> config, final int size) {
49:
50: final MemoryProbe[] probes = config.getProbesUnsafe();
51:• if (probes != null) {
52:• for (MemoryProbe probe : probes) {
53: probe.onBufferAllocateFromPoolEvent(size);
54: }
55: }
56: }
57:
58: /**
59: * Notify registered {@link MemoryProbe}s about the "release to pool" event.
60: *
61: * @param size buffer size
62: */
63: static void notifyBufferReleasedToPool(final DefaultMonitoringConfig<MemoryProbe> config, final int size) {
64:
65: final MemoryProbe[] probes = config.getProbesUnsafe();
66:• if (probes != null) {
67:• for (MemoryProbe probe : probes) {
68: probe.onBufferReleaseToPoolEvent(size);
69: }
70: }
71: }
72:
73: }