public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
      throws IOException, PortletException {

    PortletRequestDataSample portletRequestDataSample = null;

    try {
      if (_monitoringPortletResourceRequest) {
        portletRequestDataSample =
            new PortletRequestDataSample(
                PortletRequestType.RESOURCE, resourceRequest, resourceResponse);

        portletRequestDataSample.prepare();
      }

      _invokerPortlet.serveResource(resourceRequest, resourceResponse);

      if (_monitoringPortletResourceRequest) {
        portletRequestDataSample.capture(RequestStatus.SUCCESS);
      }
    } catch (Exception e) {
      _processException(_monitoringPortletResourceRequest, portletRequestDataSample, e);
    } finally {
      if (portletRequestDataSample != null) {
        _singleDestinationMessageSender.send(portletRequestDataSample);

        DataSampleThreadLocal.addDataSample(portletRequestDataSample);
      }
    }
  }
  public void processEvent(EventRequest eventRequest, EventResponse eventResponse)
      throws IOException, PortletException {

    PortletRequestDataSample portletRequestDataSample = null;

    try {
      if (_monitoringPortletEventRequest) {
        portletRequestDataSample =
            new PortletRequestDataSample(PortletRequestType.EVENT, eventRequest, eventResponse);

        portletRequestDataSample.prepare();
      }

      _invokerPortlet.processEvent(eventRequest, eventResponse);

      if (_monitoringPortletEventRequest) {
        portletRequestDataSample.capture(RequestStatus.SUCCESS);
      }
    } catch (Exception e) {
      _processException(_monitoringPortletEventRequest, portletRequestDataSample, e);
    } finally {
      if (portletRequestDataSample != null) {
        _singleDestinationMessageSender.send(portletRequestDataSample);

        DataSampleThreadLocal.addDataSample(portletRequestDataSample);
      }
    }
  }