Package com.jamonapi

Examples of com.jamonapi.Monitor


    //public Object processService(PortletRequest request, PortletResponse response) throws PortletException, IOException {
      //HashMap map = new HashMap();
    public void processService(PortletRequest request, PortletResponse response) throws PortletException, IOException {
    //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
     
      Monitor monitor = null;
      PortletTracer.info(Constants.NOME_MODULO, "AdapterPortlet", "processService", "Invocato");
        try {
            SourceBean serviceRequest = null;
            EMFErrorHandler emfErrorHandler = null;
           
            RequestContainer requestContainer = new RequestContainer();
            RequestContainer.setRequestContainer(requestContainer);
            ResponseContainer responseContainer = new ResponseContainer();
            ResponseContainer.setResponseContainer(responseContainer);
            RequestContextIFace requestContext = new DefaultRequestContext(requestContainer,
                    responseContainer);
           
            // try to get from the request the loopback attribute. If present the method has to serve
            // a loopback request (the method has been called from the doRenderService)
            // if not present is a normal request
            boolean isLoop = request.getAttribute(Constants.PUBLISHING_MODE_LOOPBACK) != null;
            if(isLoop) {
              // remove from the request the loopback attribute
              request.removeAttribute(Constants.PUBLISHING_MODE_LOOPBACK);
              //String responseContainerName = (String)request.getAttribute(Constants.RESPONSE_CONTAINER);
             
              //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
              // get from the session the previous response container name
              //String responseContainerName = (String)request.getPortletSession().getAttribute(RESPONSE_CONTAINER_NAME);
              // get from the session the previous response container
              //ResponseContainer loopbackResponseContainer = (ResponseContainer)request.getPortletSession().getAttribute(responseContainerName);
              ResponseContainer loopbackResponseContainer = (ResponseContainer)request.getPortletSession().getAttribute(Constants.RESPONSE_CONTAINER);
              //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
             
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.DEBUG,
                    "AdapterPortlet::service: loop-back rilevato");
                serviceRequest =
                    loopbackResponseContainer.getLoopbackServiceRequest();
                if (serviceRequest == null)
                    serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
                else {
                    Object newServiceRequest =
                        serviceRequest.getAttribute(Constants.SERVICE_REQUEST);
                    if ((newServiceRequest != null)
                        && (newServiceRequest instanceof SourceBean))
                        serviceRequest = (SourceBean) newServiceRequest;
                } // if (serviceRequest == null)
                emfErrorHandler = loopbackResponseContainer.getErrorHandler();
                if (emfErrorHandler == null)
                    emfErrorHandler = new EMFErrorHandler();
            } // if (isLoop)
            else {
              monitor = MonitorFactory.start("controller.adapter.portlet");
              serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
              requestContainer.setServiceRequest(serviceRequest);
             
                boolean isMultipart = false;
               
                // only an ActionRequest can have a multipart content
                if (request instanceof ActionRequest && PortletFileUpload.isMultipartContent((ActionRequest) request)) {
                  isMultipart = true;
                }
               
                if (isMultipart) {
                  handleMultipartForm((ActionRequest) request, requestContext);
                } else {
                  handleSimpleForm(request, requestContext);
                }
             
              // ***************** START SERVICE ***********************************************
              String actionName = (String) request.getAttribute("ACTION_NAME");
              if(actionName!=null) {
                request.removeAttribute("ACTION_NAME");
                serviceRequest.setAttribute("ACTION_NAME", actionName);
                serviceRequest.setAttribute(NEW_SESSION, "TRUE");
              }
              String page = (String)request.getAttribute("PAGE");
              if(page!=null) {
                request.removeAttribute("PAGE");
                serviceRequest.setAttribute("PAGE", page);
                serviceRequest.setAttribute(NEW_SESSION, "TRUE");
             
            // *******************************************************************************************
              emfErrorHandler = new EMFErrorHandler();
            }
           
            //***************** NAVIGATION CONTROL *******************************************************
            String navigation = getInitParameter("light_navigation");
            if ("enabled".equalsIgnoreCase(navigation)) {
              serviceRequest = LightNavigationManager.controlLightNavigation(request, serviceRequest);
            }
            //updates service request after LightNavigationManager control
            requestContainer.setServiceRequest(serviceRequest);
            //********************************************************************************************
           
            boolean isRequestedSessionIdValid = true;
            PortletSession session = request.getPortletSession(true);
            /*
            if (session.isNew()) {
                String newSessionString =
                    (String) (serviceRequest.getAttribute(NEW_SESSION));
                isRequestedSessionIdValid =
                    ((newSessionString != null)
                        && (newSessionString.equalsIgnoreCase("TRUE")));
            } // if (session.isNew())
            */
            synchronized (session) {
               
              // try to get the previous request container. Download from the session the previous
              // request container name and if it isn't null (it's null only formthe first invocation)
              //use it for download the request container object
              RequestContainer parentRequestContainer = null;
             
              //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
              //String parentRequestContainerName =
              //  (String) session.getAttribute(REQUEST_CONTAINER_NAME);
              //if(parentRequestContainerName != null) {
              //  parentRequestContainer = (RequestContainer) session.getAttribute(parentRequestContainerName);
              //}
              parentRequestContainer = (RequestContainer) session.getAttribute(Constants.REQUEST_CONTAINER);
              //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************

                if (!Navigator.isNavigatorEnabled()) {
                    if (parentRequestContainer == null)
                        requestContainer.setSessionContainer(
                            new PortletSessionContainer(true));
                    else
                        requestContainer.setSessionContainer(
                            parentRequestContainer.getSessionContainer());
                }
                else {
                    if (parentRequestContainer == null)
                        requestContainer.setSessionContainer(
                            new PortletSessionContainer(true));
                    else {
                        requestContainer.setSessionContainer(
                            new PortletSessionContainer(false));
                        requestContainer.setParent(parentRequestContainer);
                    } // if (parentRequestContainer == null) else
                } // if (!Navigator.isNavigatorEnabled())
               
                //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
                //session.setAttribute(Constants.REQUEST_CONTAINER, requestContainer);
                //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
               
            } // synchronized (session)
            if (!isRequestedSessionIdValid) {
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.WARNING,
                    "AdapterPortlet::processAction: sessione scaduta !");
                SessionExpiredUtility.setSessionExpiredAction(serviceRequest);
            } // if (!isRequestedSessionIdValid)
           
            requestContainer.setAttribute(
                    HTTP_SESSION_ID,
                    request.getPortletSession().getId());
            String channelType = "PORTLET";
            String channelTypeParameter =
                (String) (serviceRequest.getAttribute(Constants.CHANNEL_TYPE));
            String channelTypeHeader =
                (String) (requestContainer.getAttribute(HTTP_ACCEPT_HEADER));
            if (((channelTypeParameter != null)
                && channelTypeParameter.equalsIgnoreCase(Constants.WAP_CHANNEL))
                || ((channelTypeHeader != null)
                    && (channelTypeHeader.indexOf(WAP_MIME_TYPE) != -1)))
                channelType = Constants.WAP_CHANNEL;
            requestContainer.setChannelType(channelType);


            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.DEBUG,
                "AdapterPortlet::processAction: requestContainer",
                requestContainer);
            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.DEBUG,
                "AdapterPortlet::processAction: sessionContainer",
                requestContainer.getSessionContainer());

            responseContainer.setErrorHandler(emfErrorHandler);
            SourceBean serviceResponse =
                new SourceBean(Constants.SERVICE_RESPONSE);
            responseContainer.setServiceResponse(serviceResponse);
            try {
                Navigator.checkNavigation(requestContainer);
            } // try
            catch (NavigationException ne) {
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.CRITICAL,
                    "AdapterPortlet::processAction: ",
                    ne);
                requestContainer.setServiceRequest(
                    NavigationErrorUtility.getNavigationErrorServiceRequest());
            } // catch (NavigationException ne)
            serviceRequest = requestContainer.getServiceRequest();

            CoordinatorIFace coordinator =
                DispatcherManager.getCoordinator(requestContext);
            Exception serviceException = null;
            if (coordinator == null) {
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.WARNING,
                    "AdapterPortlet::processAction: coordinator nullo !");
                serviceException = new Exception("Coordinatore non trovato");
                emfErrorHandler.addError(
                    new EMFInternalError(
                        EMFErrorSeverity.ERROR,
                        "Coordinatore non trovato !"));
            } // if (coordinator == null)
            else {
                ((RequestContextIFace) coordinator).setRequestContext(
                    requestContext);
                responseContainer.setBusinessType(
                        coordinator.getBusinessType());
                    responseContainer.setBusinessName(
                        coordinator.getBusinessName());
                try {
                    coordinator.service(serviceRequest, serviceResponse);
                } // try
                catch (Exception ex) {
                    TracerSingleton.log(
                        Constants.NOME_MODULO,
                        TracerSingleton.CRITICAL,
                        "AdapterPortlet::processAction:",
                        ex);
                    serviceException = ex;
                    emfErrorHandler.addError(
                        new EMFInternalError(EMFErrorSeverity.ERROR, ex));
                    responseContainer.setAttribute(PORTLET_EXCEPTION, serviceException);
                } // catch (Exception ex)
                 ((RequestContextIFace) coordinator).setRequestContext(null);
            } // if (coordinator == null) else
           
            //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
            //synchronized (session) {
            //    session.setAttribute(
            //        Constants.REQUEST_CONTAINER,
            //        session.getAttribute(Constants.REQUEST_CONTAINER));
            //} // synchronized (session)
            //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
           
            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.DEBUG,
                "AdapterPortlet::processAction: responseContainer",
                responseContainer);
            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.DEBUG,
                "AdapterPortlet::processAction: sessionContainer",
                requestContainer.getSessionContainer());
               
      if (serializeSession) {
        TracerSingleton.log(
          Constants.NOME_MODULO,
          TracerSingleton.DEBUG,
          "AdapterPortlet::processAction: sessionContainer size ["
            + Serializer.serialize(
              requestContainer.getSessionContainer()).length
            + "]");
      }
     
      //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
            //String requestContainerName =
            //    Constants.REQUEST_CONTAINER
            //        + requestContainer.hashCode();
            //String responseContainerName =
            //    Constants.RESPONSE_CONTAINER
            //        + responseContainer.hashCode();                          

            // set into the session new request and response container produced
            //session.setAttribute(requestContainerName, requestContainer);
            //session.setAttribute(responseContainerName, responseContainer);
            // set into the session the name of the new request and response container produced
            //session.setAttribute(REQUEST_CONTAINER_NAME, requestContainerName);
            //session.setAttribute(RESPONSE_CONTAINER_NAME, responseContainerName);
            // if the response is of type ActionResponse (the method has been called from the container)
            // set the name of the container like parameter of the request for the render method
            //if(response instanceof ActionResponse) {
            //  ((ActionResponse)response).setRenderParameter(REQUEST_CONTAINER_NAME, requestContainerName);
            //  ((ActionResponse)response).setRenderParameter(RESPONSE_CONTAINER_NAME, responseContainerName);
            //}
            // if the response is of type RenderResponse the method has been called from the doRenderService
            // method and the container names must be returned to the method into an hashmap (it's not possible
            // to set them like parameters because the container will not call automatically the render service)
            //else if(response instanceof RenderResponse){
            //  map.put(REQUEST_CONTAINER_NAME, requestContainerName);
            //  map.put(RESPONSE_CONTAINER_NAME, responseContainerName);
            //}
            session.setAttribute(Constants.REQUEST_CONTAINER, requestContainer);
            session.setAttribute(Constants.RESPONSE_CONTAINER, responseContainer);
            //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
           
        } // try
        catch (Exception ex) {
            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.CRITICAL,
                "AdapterPortlet::processAction: ",
                ex);
        } // catch (Excpetion ex) try
        finally {   
          RequestContainer.delRequestContainer();
            ResponseContainer.delResponseContainer();
            if (monitor != null)
                monitor.stop();
        } // finally
       
        //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
        //return map;
        //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
 
View Full Code Here


              } // if (publisherType.equalsIgnoreCase(Constants.LOOP_PUBLISHER_TYPE)
                // || publisherType.equalsIgnoreCase(SERVLET_PUBLISHER_TYPE) ||
                // publisherType.equalsIgnoreCase(JSP_PUBLISHER_TYPE))
              else {
                  response.setContentType(HTTP_CONTENT_TYPE);
                  Monitor renderingMonitor =
                          MonitorFactory.start(
                              "view.portlet."
                                  + publisherType.toLowerCase()
                                  + "."
                                  + publisher.getName().toLowerCase());
                  try {
                      response.getWriter().print(
                          PresentationRendering.render(
                              responseContainer,
                              resources));
                      response.getWriter().flush();
                  } // try
                  catch (Exception ex) {
                    TracerSingleton.log(
                              Constants.NOME_MODULO,
                              TracerSingleton.DEBUG,
                              "AdapterPortlet::doView:eccezzione", ex);
                  } // catch (Exception ex)
                  finally {
                    // Allow better garbage collection
                    publisher.release();
                    // Stop performance measurement
                      renderingMonitor.stop();
                  } // finally
              } // if (publisherType.equalsIgnoreCase(AF_PUBLISHER_TYPE)
              // || publisherType.equalsIgnoreCase(SERVLET_PUBLISHER_TYPE) ||
              // publisherType.equalsIgnoreCase(JSP_PUBLISHER_TYPE)) else
          } //if (requestContainer == null && responseContainer == null) else
View Full Code Here

   * @param state
   * @param profile
   * @return
   */
  public static boolean canDev(String state, List folders, IEngUserProfile profile) {
    Monitor monitor =MonitorFactory.start("spagobi.core.ObjectAccessVerifier.canDev");
    logger.debug("IN.state=" + state);
    boolean canDev = false;
    if(isAbleToExec(state, profile)) {

      Iterator folderIt = folders.iterator();
      while(folderIt.hasNext()){
        LowFunctionality folder =(LowFunctionality) folderIt.next();
        canDev = canDevInternal(folder, profile);
        if (canDev){
          logger.debug("OUT.return true");
          monitor.stop();
          return true;
        }
      }
      logger.debug("OUT.return false");
      monitor.stop();
      return false;

    } else{
      logger.debug("OUT.return false");
      monitor.stop();
      return false;
    }
  }
View Full Code Here

        } // while (names.hasMoreElements())
    }
   
    public void service(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
        Monitor monitor = null;
      IEventNotifier eventNotifier = null;
      RequestContextIFace requestContext = null;

        try {
          SourceBean serviceRequest = null;
            EMFErrorHandler emfErrorHandler = null;
            EMFExceptionHandler exceptionHandler = new EMFExceptionHandler();
           
            // Retrieve LOOP responseContainer, if any
            ResponseContainer loopbackResponseContainer = ResponseContainer.getResponseContainer();
           
            RequestContainer requestContainer = new RequestContainer();
            RequestContainer.setRequestContainer(requestContainer);
           
            ResponseContainer responseContainer = new ResponseContainer();
            ResponseContainer.setResponseContainer(responseContainer);
           
            requestContext = new DefaultRequestContext(requestContainer,
                    responseContainer);
           
            // Retrieve HTTP session
            HttpSession session = request.getSession(true);

          eventNotifier = EventNotifierFactory.getEventNotifier();
          eventNotifier.notifyEvent(
                new ServiceStartEvent(session),
                requestContext);
           
          // Trace only after calling listener, so the session id can be written on log files
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: invocato");

            boolean loopback = (request.getAttribute(Constants.PUBLISHING_MODE_LOOPBACK) != null);
            if (loopback) {
                TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                "AdapterHTTP::service: loop-back rilevato");

                // remove from the request the loopback attribute
              request.removeAttribute(Constants.PUBLISHING_MODE_LOOPBACK);
           
                loopbackResponseContainer = ResponseContainerAccess.getResponseContainer(request);
                serviceRequest = loopbackResponseContainer.getLoopbackServiceRequest();
                if (serviceRequest == null) {
                    serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
                } else {
                    Object newServiceRequest = serviceRequest
                            .getAttribute(Constants.SERVICE_REQUEST);
                    if ((newServiceRequest != null) && (newServiceRequest instanceof SourceBean))
                        serviceRequest = (SourceBean) newServiceRequest;
                } // if (serviceRequest == null)
                requestContainer.setServiceRequest(serviceRequest);
               
                // The errors are kept in loop mode, so retrieve old error handler
                emfErrorHandler = loopbackResponseContainer.getErrorHandler();
               
                if (emfErrorHandler == null) {
                    emfErrorHandler = new EMFErrorHandler();
                }
            } // if (loopbackResponseContainer != null)
            else {
                monitor = MonitorFactory.start("controller.adapter.http");
                serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
                requestContainer.setServiceRequest(serviceRequest);

                // Get header parameter before parsing the request
                setHttpRequestData(request, requestContainer);
               
                // Check if the service was invoked with the .action or .page URL
                handleServiceName(serviceRequest, requestContainer);
               
                boolean isMultipart = ServletFileUpload.isMultipartContent(new ServletRequestContext(request));
                if (isMultipart) {
                  handleMultipartForm(request, requestContext);
                } else {
                  handleSimpleForm(request, requestContext);
                }

                emfErrorHandler = new EMFErrorHandler();
            } // if (loopbackResponseContainer != null) else

           
            //***************** NAVIGATION CONTROL *******************************************************
            serviceRequest = LightNavigationManager.controlLightNavigation(request, serviceRequest);
            requestContainer.setServiceRequest(serviceRequest);
            //********************************************************************************************
           
            Exception serviceException = null;
            CoordinatorIFace coordinator = null;
            try {
              responseContainer.setErrorHandler(emfErrorHandler);
             
              String channelType = Constants.HTTP_CHANNEL;
              String channelTypeParameter = (String) (serviceRequest
                      .getAttribute(Constants.CHANNEL_TYPE));
              String channelTypeHeader = (String) (requestContainer.getAttribute(HTTP_ACCEPT_HEADER));
              if (((channelTypeParameter != null) && channelTypeParameter
                      .equalsIgnoreCase(Constants.WAP_CHANNEL))
                      || ((channelTypeHeader != null) && (channelTypeHeader.indexOf(WAP_MIME_TYPE) != -1)))
                  channelType = Constants.WAP_CHANNEL;
              requestContainer.setChannelType(channelType);
              requestContainer.setInternalRequest(request);
              requestContainer.setInternalResponse(response);
              requestContainer.setAdapterConfig(getServletConfig());
              TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: requestContainer", requestContainer);
              TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: sessionContainer", requestContainer
                              .getSessionContainer());
 
              SourceBean serviceResponse = new SourceBean(Constants.SERVICE_RESPONSE);
              responseContainer.setServiceResponse(serviceResponse);

              checkSession(session, requestContext);
                Navigator.checkNavigation(requestContainer);
             
              // Refresh service request because Navigator services can changed it
              serviceRequest = requestContainer.getServiceRequest();
             
              // Suspend/Resume service
              handleSuspendResume(serviceRequest, requestContainer);
             
              coordinator = DispatcherManager.getCoordinator(requestContext);
              if (coordinator == null) {
                  TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.WARNING,
                          "AdapterHTTP::service: coordinator nullo !");
                  serviceException = new Exception("Coordinatore non trovato");
                  emfErrorHandler.addError(new EMFInternalError(EMFErrorSeverity.ERROR,
                          "Coordinatore non trovato !"));
              } // if (coordinator == null)
              else {
                  ((RequestContextIFace) coordinator).setRequestContext(requestContext);
                  responseContainer.setBusinessType(coordinator.getBusinessType());
                  responseContainer.setBusinessName(coordinator.getBusinessName());
                  responseContainer.setPublisherName(coordinator.getPublisherName());
                      coordinator.service(serviceRequest, serviceResponse);
                     
                    ((RequestContextIFace) coordinator).setRequestContext(null);
//                    requestContainer.setInternalRequest(null);
              } // if (coordinator == null) else

            } // try
            catch (Exception ex) {
              ServiceIFace service = (coordinator != null)? coordinator.getService() : null;
              exceptionHandler.handleException(ex, service, requestContext);
            } // catch (Exception ex)
           
//            requestContainer.setInternalResponse(null);
//            requestContainer.setAdapterConfig(null);
            // nel caso in cui sia attiva la persistenza della sessione
            // forza la scrittura sul database
            synchronized (session) {
                session.setAttribute(Constants.REQUEST_CONTAINER, session.getAttribute(Constants.REQUEST_CONTAINER));
            } // synchronized (session)
           
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                    "AdapterHTTP::service: responseContainer", responseContainer);
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                    "AdapterHTTP::service: sessionContainer", requestContainer
                            .getSessionContainer());

            if (serializeSession) {
                TracerSingleton
                        .log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                                "AdapterHTTP::service: sessionContainer size ["
                                        + Serializer.serialize(requestContainer
                                                .getSessionContainer()).length + "]");
            }

            render(requestContext, serviceException);
        } // try
        catch (Exception ex) {
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.CRITICAL,
                    "AdapterHTTP::service: ", ex);
        } // catch (Excpetion ex) try
        finally {
            RequestContainer.delRequestContainer();
            ResponseContainer.delResponseContainer();
            if (monitor != null) {
                monitor.stop();
            }
           
            if (eventNotifier != null) {
              eventNotifier.notifyEvent(
                new ServiceEndEvent(null),
View Full Code Here

     * @return the string
     */
    public String fireEvent(String token, String user, String description,
      String parameters, String rolesHandler, String presentationHandler) {
  logger.debug("IN");
  Monitor monitor =MonitorFactory.start("spagobi.service.event.fireEvent");
  try {
      validateTicket(token, user);
      return fireEvent(user, description, parameters,rolesHandler, presentationHandler);
  } catch (SecurityException e) {
      logger.error("SecurityException", e);
      return null;
  } finally {
      monitor.stop();
      logger.debug("OUT");
 

    }
View Full Code Here

    ArrayList<String> keys = new ArrayList<String>();

    Iterator iter = MonitorFactory.getFactory().iterator();

    while (iter.hasNext()) {
      Monitor monitor = (Monitor) iter.next();
      keys.add(monitor.getLabel());
    }

    return keys;
  }
View Full Code Here

  @Override
  public void doFilter(ServletRequest request, ServletResponse response,
      FilterChain filterChain) throws IOException, ServletException {

    Monitor monitor = MonitorFactory.start(request.getRemoteAddr());

    try {
      filterChain.doFilter(request, response);
    } finally {
      monitor.stop();
    }
  }
View Full Code Here

                    groovyEngine.setVariable(QUERY_BUILDER, requestBuilder);

                    Object result = null;

                    Monitor monitor = MonitorFactory.start(monKey);

                    try {
                        result = groovyEngine.evaluate(scriptText);
                    } catch (Throwable throwable) {

                        log.error("Evaluation failed for the script:\n\n" +
                            scriptText, throwable);

                        JOptionPane.showMessageDialog(
                            panel,
                            throwable.getMessage(),
                            "Evaluation failed!",
                            JOptionPane.ERROR_MESSAGE);

                        return;
                    } finally {
                        monitor.stop();
                        log.info ("JAMon report: " + monitor);
                    }

                    log.info("result: " + result);
View Full Code Here

    public void run() {
        call();
    }

    public V call() {
        Monitor monitor = null;
        try {
            if (init()) {
                before();
                V result = null;

                try {
                    lastException = null;
                    lastRun = System.currentTimeMillis();
                    monitor = MonitorFactory.start(getClass().getName()+".doJob()");
                    result = doJobWithResult();
                    monitor.stop();
                    monitor = null;
                    wasError = false;
                } catch (PlayException e) {
                    throw e;
                } catch (Exception e) {
                    StackTraceElement element = PlayException.getInterestingStrackTraceElement(e);
                    if (element != null) {
                        throw new JavaExecutionException(Play.classes.getApplicationClass(element.getClassName()), element.getLineNumber(), e);
                    }
                    throw e;
                }
                after();
                return result;
            }
        } catch (Throwable e) {
            onException(e);
        } finally {
            if(monitor != null) {
                monitor.stop();
            }
            _finally();
        }
        return null;
    }
View Full Code Here

     * Run the code in a new thread took from a thread pool.
     * @param invocation The code to run
     * @return The future object, to know when the task is completed
     */
    public static Future<?> invoke(final Invocation invocation) {
        Monitor monitor = MonitorFactory.getMonitor("Invoker queue size", "elmts.");
        monitor.add(executor.getQueue().size());
        invocation.waitInQueue = MonitorFactory.start("Waiting for execution");
        return executor.submit(invocation);
    }
View Full Code Here

TOP

Related Classes of com.jamonapi.Monitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.