use of com.sun.enterprise.v3.services.impl.GrizzlyProxy in project Payara by payara.
the class VirtualServer method getHttpProbeImpl.
private List<HttpProbeImpl> getHttpProbeImpl() {
List<HttpProbeImpl> httpProbes = new ArrayList<>();
for (final NetworkListener listener : getGrizzlyNetworkListeners()) {
final GrizzlyProxy proxy = (GrizzlyProxy) grizzlyService.lookupNetworkProxy(listener);
if (proxy != null) {
GenericGrizzlyListener grizzlyListener = (GenericGrizzlyListener) proxy.getUnderlyingListener();
List<HttpCodecFilter> codecFilters = grizzlyListener.getFilters(HttpCodecFilter.class);
if (codecFilters != null && !codecFilters.isEmpty()) {
for (HttpCodecFilter codecFilter : codecFilters) {
HttpProbe[] probes = codecFilter.getMonitoringConfig().getProbes();
if (probes != null) {
for (HttpProbe probe : probes) {
if (probe instanceof HttpProbeImpl) {
httpProbes.add((HttpProbeImpl) probe);
}
}
}
}
}
}
}
return httpProbes;
}
use of com.sun.enterprise.v3.services.impl.GrizzlyProxy in project Payara by payara.
the class VirtualServer method addProbes.
/**
* Sets all the monitoring probes used in the virtual server
*
* @param globalAccessLoggingEnabled
* @see org.glassfish.grizzly.http.HttpProbe
*/
void addProbes(boolean globalAccessLoggingEnabled) {
for (final NetworkListener listener : getGrizzlyNetworkListeners()) {
try {
final GrizzlyProxy proxy = (GrizzlyProxy) grizzlyService.lookupNetworkProxy(listener);
if (proxy != null) {
GenericGrizzlyListener grizzlyListener = (GenericGrizzlyListener) proxy.getUnderlyingListener();
List<HttpCodecFilter> codecFilters = grizzlyListener.getFilters(HttpCodecFilter.class);
if (codecFilters == null || codecFilters.isEmpty()) {
// if it's AJP listener - it's ok if we didn't find HttpCodecFilter
if (grizzlyListener.isAjpEnabled()) {
continue;
}
_logger.log(Level.SEVERE, LogFacade.CODE_FILTERS_NULL, new Object[] { listener.getName(), codecFilters });
} else {
for (HttpCodecFilter codecFilter : codecFilters) {
if (codecFilter.getMonitoringConfig().getProbes().length == 0) {
HttpProbeImpl httpProbe = new HttpProbeImpl(listener, isAccessLoggingEnabled(globalAccessLoggingEnabled));
codecFilter.getMonitoringConfig().addProbes(httpProbe);
}
}
}
grizzlyListener.getTransport().getConnectionMonitoringConfig().addProbes(new ConnectionProbe.Adapter() {
RequestProbeProvider requestProbeProvider = webContainer.getRequestProbeProvider();
@Override
public void onReadEvent(Connection connection, Buffer data, int size) {
if (requestProbeProvider != null) {
requestProbeProvider.dataReceivedEvent(size, _id);
}
}
@Override
public void onWriteEvent(Connection connection, Buffer data, long size) {
if (requestProbeProvider != null) {
requestProbeProvider.dataSentEvent(size, _id);
}
}
});
} else {
// check the listener is enabled before spitting out the SEVERE log
if (Boolean.parseBoolean(listener.getEnabled())) {
_logger.log(Level.SEVERE, LogFacade.PROXY_NULL, new Object[] { listener.getName() });
}
}
} catch (Exception ex) {
_logger.log(Level.SEVERE, LogFacade.ADD_HTTP_PROBES_ERROR, ex);
}
}
}
Aggregations