Example usage for java.util.logging Level FINER

List of usage examples for java.util.logging Level FINER

Introduction

In this page you can find the example usage for java.util.logging Level FINER.

Prototype

Level FINER

To view the source code for java.util.logging Level FINER.

Click Source Link

Document

FINER indicates a fairly detailed tracing message.

Usage

From source file:com.wills.clientproxy.HessianLBProxy.java

/**
 * Handles the object invocation./* w  w w  .j a v  a 2s . c o m*/
 * 
 * @param proxy
 *            the proxy object to invoke
 * @param method
 *            the method to call
 * @param args
 *            the arguments to the proxy object
 */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    String mangleName;

    HessianClusterNode hcn = _cm.getAvailableNodeByStraitegy();
    if (hcn == null) {
        throw new Exception("no available server node found!");
    }
    if (hcn == null || hcn.getNode() == null) {
        throw new Exception("no server available");
    }

    threadLocal.set(new URL(hcn.getURL() + this._type.getSimpleName()));

    try {
        lock.readLock().lock();
        mangleName = _mangleMap.get(method);
    } finally {
        lock.readLock().unlock();
    }

    if (mangleName == null) {
        String methodName = method.getName();
        Class<?>[] params = method.getParameterTypes();
        // equals and hashCode are special cased
        if (methodName.equals("equals") && params.length == 1 && params[0].equals(Object.class)) {
            Object value = args[0];
            if (value == null || !Proxy.isProxyClass(value.getClass()))
                return Boolean.FALSE;

            Object proxyHandler = Proxy.getInvocationHandler(value);

            if (!(proxyHandler instanceof HessianLBProxy))
                return Boolean.FALSE;

            HessianLBProxy handler = (HessianLBProxy) proxyHandler;

            return new Boolean(false);
        } else if (methodName.equals("hashCode") && params.length == 0)
            return new Integer(_cm.hashCode());
        else if (methodName.equals("getHessianType"))
            return proxy.getClass().getInterfaces()[0].getName();
        else if (methodName.equals("getHessianURL"))
            return threadLocal.get().toString();
        else if (methodName.equals("toString") && params.length == 0)
            return "HessianProxy[" + threadLocal.get() + "]";

        if (!_factory.isOverloadEnabled())
            mangleName = method.getName();
        else
            mangleName = mangleName(method);

        try {
            lock.writeLock().lock();
            _mangleMap.put(method, mangleName);
        } finally {
            lock.writeLock().unlock();
        }
    }
    InputStream is = null;
    HessianConnection conn = null;

    try {
        if (log.isLoggable(Level.FINER))
            log.finer("Hessian[" + threadLocal.get() + "] calling " + mangleName);
        conn = sendRequest(mangleName, args, threadLocal.get());

        if (conn.getStatusCode() != 200) {
            throw new HessianProtocolException("http code is " + conn.getStatusCode());
        }

        is = conn.getInputStream();

        if (log.isLoggable(Level.FINEST)) {
            PrintWriter dbg = new PrintWriter(new LogWriter(log));
            HessianDebugInputStream dIs = new HessianDebugInputStream(is, dbg);

            dIs.startTop2();

            is = dIs;
        }

        AbstractHessianInput in;

        int code = is.read();

        if (code == 'H') {
            int major = is.read();
            int minor = is.read();

            in = _factory.getHessian2Input(is);

            Object value = in.readReply(method.getReturnType());

            return value;
        } else if (code == 'r') {
            int major = is.read();
            int minor = is.read();

            in = _factory.getHessianInput(is);

            in.startReplyBody();

            Object value = in.readObject(method.getReturnType());

            if (value instanceof InputStream) {
                value = new ResultInputStream(conn, is, in, (InputStream) value);
                is = null;
                conn = null;
            } else
                in.completeReply();

            return value;
        } else
            throw new HessianProtocolException("'" + (char) code + "' is an unknown code");
    } catch (HessianProtocolException e) {
        throw new HessianRuntimeException(e);
    } finally {
        try {
            if (is != null)
                is.close();
        } catch (Exception e) {
            log.log(Level.FINE, e.toString(), e);
        }

        try {
            if (conn != null)
                conn.destroy();
        } catch (Exception e) {
            log.log(Level.FINE, e.toString(), e);
        }
    }
}

From source file:com.granule.json.utils.XML.java

/**
 * Method to do the transform from an XML input stream to a JSON stream.
 * Neither input nor output streams are closed.  Closure is left up to the caller.  Same as calling toJson(inStream, outStream, false);  (Default is compact form)
 *
 * @param XMLStream The XML stream to convert to JSON
 * @param JSONStream The stream to write out JSON to.  The contents written to this stream are always in UTF-8 format.
 * //from  w  w  w .j  ava 2  s.  co  m
 * @throws SAXException Thrown is a parse error occurs.
 * @throws IOException Thrown if an IO error occurs.
 */
public static void toJson(InputStream XMLStream, OutputStream JSONStream) throws SAXException, IOException {
    if (logger.isLoggable(Level.FINER)) {
        logger.entering(className, "toJson(InputStream, OutputStream)");
    }
    toJson(XMLStream, JSONStream, false);

    if (logger.isLoggable(Level.FINER)) {
        logger.entering(className, "toJson(InputStream, OutputStream)");
    }
}

From source file:org.b3log.latke.servlet.HTTPRequestDispatcher.java

/**
 * Dispatches with the specified context.
 * // w  w w . j a  va2 s. c  o m
 * @param context the specified specified context
 * @throws ServletException servlet exception
 * @throws IOException io exception 
 */
public static void dispatch(final HTTPRequestContext context) throws ServletException, IOException {
    final HttpServletRequest request = context.getRequest();

    String requestURI = (String) request.getAttribute(Keys.HttpRequest.REQUEST_URI);

    if (Strings.isEmptyOrNull(requestURI)) {
        requestURI = request.getRequestURI();
    }

    String method = (String) request.getAttribute(Keys.HttpRequest.REQUEST_METHOD);

    if (Strings.isEmptyOrNull(method)) {
        method = request.getMethod();
    }

    LOGGER.log(Level.FINER, "Request[requestURI={0}, method={1}]", new Object[] { requestURI, method });

    try {
        final Object processorMethodRet = RequestProcessors.invoke(requestURI, Latkes.getContextPath(), method,
                context);
    } catch (final Exception e) {
        final String exceptionTypeName = e.getClass().getName();

        LOGGER.log(Level.FINER,
                "Occured error while processing request[requestURI={0}, method={1}, exceptionTypeName={2}, errorMsg={3}]",
                new Object[] { requestURI, method, exceptionTypeName, e.getMessage() });
        if ("com.google.apphosting.api.ApiProxy$OverQuotaException".equals(exceptionTypeName)) {
            PageCaches.removeAll();

            context.getResponse().sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
            return;
        }

        throw new ServletException(e);
    } catch (final Error e) {
        final Runtime runtime = Runtime.getRuntime();

        LOGGER.log(Level.FINER, "Memory status[total={0}, max={1}, free={2}]",
                new Object[] { runtime.totalMemory(), runtime.maxMemory(), runtime.freeMemory() });

        LOGGER.log(Level.SEVERE, e.getMessage(), e);

        throw e;
    }

    // XXX: processor method ret?

    final HttpServletResponse response = context.getResponse();

    if (response.isCommitted()) { // Sends rdirect or send error
        final PrintWriter writer = response.getWriter();

        writer.flush();
        writer.close();

        return;
    }

    AbstractHTTPResponseRenderer renderer = context.getRenderer();

    if (null == renderer) {
        renderer = new HTTP404Renderer();
    }

    renderer.render(context);
}

From source file:com.granule.json.utils.internal.JSONSAXHandler.java

/**
 * Internal method to start JSON generation.
 */// w  w  w  .  j  av a  2 s  .c  o  m
private void startJSON() throws SAXException {
    if (logger.isLoggable(Level.FINER))
        logger.entering(className, "startJSON()");

    this.head = new JSONObject("", null);
    this.current = head;

    if (logger.isLoggable(Level.FINER))
        logger.exiting(className, "startJSON()");
}

From source file:edu.cwru.sepia.model.SimpleModel.java

private LinkedList<Action> calculatePrimitives(Action action) {
    LinkedList<Action> primitives = null;
    Unit actor = state.getUnit(action.getUnitId());
    switch (action.getType()) {
    case PRIMITIVEMOVE:
    case PRIMITIVEATTACK:
    case PRIMITIVEGATHER:
    case PRIMITIVEDEPOSIT:
    case PRIMITIVEBUILD:
    case PRIMITIVEPRODUCE:
    case FAILED:/*from  w ww . j a v a  2 s .  c o m*/
        //The only primitive action needed to execute a primitive action is itself
        primitives = new LinkedList<Action>();
        primitives.add(action);
        break;
    case COMPOUNDMOVE:
        LocatedAction aMove = (LocatedAction) action;
        primitives = planner.planMove(actor, aMove.getX(), aMove.getY());
        break;
    case COMPOUNDGATHER:
        TargetedAction aGather = (TargetedAction) action;
        int resourceId = aGather.getTargetId();
        primitives = planner.planGather(actor, state.getResource(resourceId));
        break;
    case COMPOUNDATTACK:
        TargetedAction aAttack = (TargetedAction) action;
        int targetId = aAttack.getTargetId();
        primitives = planner.planAttack(actor, state.getUnit(targetId));
        break;
    case COMPOUNDBUILD:
        LocatedProductionAction aBuild = (LocatedProductionAction) action;
        int buildTemplateId = aBuild.getTemplateId();
        primitives = planner.planBuild(actor, aBuild.getX(), aBuild.getY(),
                (UnitTemplate) state.getTemplate(buildTemplateId));
        break;
    case COMPOUNDDEPOSIT:
        TargetedAction aDeposit = (TargetedAction) action;
        int depotId = aDeposit.getTargetId();
        primitives = planner.planDeposit(actor, state.getUnit(depotId));
        break;
    default:
        primitives = null;

    }
    if (logger.isLoggable(Level.FINER))
        logger.finer("Action " + action + " was turned into the following list of primitives: " + primitives);
    return primitives;
}

From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java

@Override
public void finer(Throwable ex) {
    logger.logp(Level.FINER, "", "", "", ex);
}

From source file:name.richardson.james.bukkit.utilities.persistence.database.AbstractDatabaseLoader.java

@Override
public final boolean validate() {
    for (final Class<?> ebean : this.classes) {
        try {/*from ww  w . j a  v a 2 s  .com*/
            this.ebeanserver.find(ebean).findRowCount();
        } catch (final Exception exception) {
            logger.log(Level.WARNING, localisation.getMessage("schema-invalid"));
            return false;
        }
    }
    logger.log(Level.FINER, "Database schema is valid.");
    return true;
}

From source file:org.geoserver.gwc.wms.CachingWebMapService.java

private void setConditionalGetHeaders(RawMap map, ConveyorTile cachedTile, GetMapRequest request, String etag) {
    map.setResponseHeader("ETag", etag);

    final long tileTimeStamp = cachedTile.getTSCreated();
    final String ifModSinceHeader = request.getHttpRequestHeader("If-Modified-Since");
    // commons-httpclient's DateUtil can encode and decode timestamps formatted as per RFC-1123,
    // which is one of the three formats allowed for Last-Modified and If-Modified-Since headers
    // (e.g. 'Sun, 06 Nov 1994 08:49:37 GMT'). See
    // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1

    final String lastModified = org.apache.commons.httpclient.util.DateUtil.formatDate(new Date(tileTimeStamp));
    map.setResponseHeader("Last-Modified", lastModified);

    final Date ifModifiedSince;
    if (ifModSinceHeader != null && ifModSinceHeader.length() > 0) {
        try {// w  w  w .  j a v a  2  s .c o m
            ifModifiedSince = DateUtil.parseDate(ifModSinceHeader);
            // the HTTP header has second precision
            long ifModSinceSeconds = 1000 * (ifModifiedSince.getTime() / 1000);
            long tileTimeStampSeconds = 1000 * (tileTimeStamp / 1000);
            if (ifModSinceSeconds >= tileTimeStampSeconds) {
                throw new HttpErrorCodeException(HttpServletResponse.SC_NOT_MODIFIED);
            }
        } catch (DateParseException e) {
            if (LOGGER.isLoggable(Level.FINER)) {
                LOGGER.finer("Can't parse client's If-Modified-Since header: '" + ifModSinceHeader + "'");
            }
        }
    }
}

From source file:org.apache.oodt.cas.resource.scheduler.ResourceMesosScheduler.java

@Override
public void resourceOffers(SchedulerDriver driver, List<Offer> offers) {
    LOG.log(Level.INFO, "Offered mesos resources: " + offers.size() + " offers.");
    //Log, if possible the offers
    if (LOG.isLoggable(Level.FINER)) {
        for (Offer offer : offers) {
            try {
                this.mon.addNode(new ResourceNode(offer.getSlaveId().getValue(),
                        new URL("http://" + offer.getHostname()), -1));
            } catch (MalformedURLException e) {
                LOG.log(Level.WARNING, "Cannot add node to monitor (bad url).  Giving up: " + e.getMessage());
            } catch (MonitorException e) {
                LOG.log(Level.WARNING, "Cannot add node to monitor (unkn).  Giving up: " + e.getMessage());
            }/*from  w w  w.  j  a  v  a 2s  .c  o  m*/
            LOG.log(Level.FINER,
                    "Offer (" + offer.getId().getValue() + "): " + offer.getHostname() + "(Slave: "
                            + offer.getSlaveId().getValue() + ") "
                            + MesosUtilities.getResourceMessage(offer.getResourcesList()));
        }
    }
    List<JobSet> assignments = this.getJobAssignmentsJobs(offers);
    List<OfferID> used = new LinkedList<OfferID>();
    for (JobSet assignment : assignments) {
        //Launch tasks requires lists
        List<OfferID> ids = new LinkedList<OfferID>();
        List<TaskInfo> tasks = new LinkedList<TaskInfo>();
        tasks.add(assignment.task);
        used.add(assignment.offer.getId());
        ids.add(assignment.offer.getId());
        //Register locally and launch on mesos
        batch.registerExecutedJob(assignment.job.getJob().getId(), assignment.task.getTaskId());
        Status status = driver.launchTasks(ids, tasks); //Assumed one to one mapping
        if (status != Status.DRIVER_RUNNING)
            throw new MesosFrameworkException("Driver stopped: " + status.toString());
    }
    for (Offer offer : offers) {
        if (!used.contains(offer.getId())) {
            LOG.log(Level.INFO, "Rejecting Offer: " + offer.getId().getValue());
            driver.declineOffer(offer.getId());
        }
    }
}

From source file:org.jboss.arquillian.container.was.wlp_remote_8_5.WLPRestClient.java

/**
 * Queries the rest api for the servers name.
 * //from www . j  av a 2  s . com
 * @return the name of the running server e.g. defaultServer
 * @throws IOException
 * @throws ClientProtocolException
 */
public String getServerName() throws ClientProtocolException, IOException {
    if (log.isLoggable(Level.FINER)) {
        log.entering(className, "getServerName");
    }

    String restEndpoint = String.format(
            "https://%s:%d%sWebSphere:feature=kernel,name=ServerInfo/attributes/Name",
            configuration.getHostName(), configuration.getHttpsPort(), MBEANS_ENDPOINT);

    String jsonResponse = executor.execute(Request.Get(restEndpoint)).returnContent().asString();
    String serverName = parseJsonResponse(jsonResponse);

    if (log.isLoggable(Level.FINER)) {
        log.exiting(className, "isServerUp");
    }
    return serverName;
}