Example usage for java.util.logging Level FINEST

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

Introduction

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

Prototype

Level FINEST

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

Click Source Link

Document

FINEST indicates a highly detailed tracing message.

Usage

From source file:com.ibm.team.build.internal.hjplugin.util.Helper.java

/**
 * Given a value that may be a parameter, resolve the parameter to its default value while trimming for whitespace.
 * If the resolved value of the parameter is <code>null</null>, then the value is returned as such, 
 * after trimming for whitespace.//from   w w  w .  j  a  va2  s.  co m
 * If the given value is not a parameter, then trim whitespace and return it.
 * @param job
 * @param value - the value which could be a parameter. May be <code>null</code>
 * @param listener
 * @return a {@link String} which is the value to the parameter resolves to or the value itself, after trimming for whitespace
 */
public static String parseConfigurationValue(Job<?, ?> job, String value, TaskListener listener) {
    LOGGER.finest("Helper.parseConfigurationValue for Job: Enter");
    // First nullify the value if it is empty
    value = Util.fixEmptyAndTrim(value);
    if (value == null) {
        return null;
    }
    String paramValue = value;
    // Check whether value itself is a job parameter
    if (Helper.isAParameter(value)) {
        paramValue = Helper.resolveJobParameter(job, value, listener);
        if (paramValue != null) {
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.finest("Found value for job parameter '" + value + "' : " + paramValue);
            }
            return paramValue;
        } else {
            paramValue = value;
        }
    }
    return paramValue;
}

From source file:org.apache.reef.io.network.NetworkServiceTest.java

/**
 * NetworkService messaging rate benchmark.
 *//*from  w  w w  .ja v  a 2s .  c  o m*/
@Test
public void testMessagingNetworkServiceRateDisjoint() throws Exception {

    Assume.assumeFalse("Use log level INFO to run benchmarking", LOG.isLoggable(Level.FINEST));

    LOG.log(Level.FINEST, name.getMethodName());

    final IdentifierFactory factory = new StringIdentifierFactory();

    final Injector injector = Tang.Factory.getTang().newInjector();
    injector.bindVolatileParameter(NameServerParameters.NameServerIdentifierFactory.class, factory);
    injector.bindVolatileInstance(LocalAddressProvider.class, this.localAddressProvider);

    try (final NameServer server = injector.getInstance(NameServer.class)) {
        final int nameServerPort = server.getPort();

        final BlockingQueue<Object> barrier = new LinkedBlockingQueue<>();

        final int numThreads = 4;
        final int size = 2000;
        final int numMessages = 300000 / (Math.max(1, size / 512));
        final int totalNumMessages = numMessages * numThreads;

        final ExecutorService e = Executors.newCachedThreadPool();
        for (int t = 0; t < numThreads; t++) {
            final int tt = t;

            e.submit(new Runnable() {
                @Override
                public void run() {
                    try {
                        final Monitor monitor = new Monitor();

                        // network service
                        final String name2 = "task2-" + tt;
                        final String name1 = "task1-" + tt;
                        final Configuration nameResolverConf = Tang.Factory.getTang()
                                .newConfigurationBuilder(NameResolverConfiguration.CONF
                                        .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, localAddress)
                                        .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort)
                                        .build())
                                .build();

                        final Injector injector = Tang.Factory.getTang().newInjector(nameResolverConf);

                        LOG.log(Level.FINEST, "=== Test network service receiver start");
                        LOG.log(Level.FINEST, "=== Test network service sender start");
                        try (final NameResolver nameResolver = injector.getInstance(NameResolver.class)) {
                            injector.bindVolatileParameter(
                                    NetworkServiceParameters.NetworkServiceIdentifierFactory.class, factory);
                            injector.bindVolatileInstance(NameResolver.class, nameResolver);
                            injector.bindVolatileParameter(NetworkServiceParameters.NetworkServiceCodec.class,
                                    new StringCodec());
                            injector.bindVolatileParameter(
                                    NetworkServiceParameters.NetworkServiceTransportFactory.class,
                                    injector.getInstance(MessagingTransportFactory.class));
                            injector.bindVolatileParameter(
                                    NetworkServiceParameters.NetworkServiceExceptionHandler.class,
                                    new ExceptionHandler());

                            final Injector injectorNs2 = injector.forkInjector();
                            injectorNs2.bindVolatileParameter(
                                    NetworkServiceParameters.NetworkServiceHandler.class,
                                    new MessageHandler<String>(name2, monitor, numMessages));
                            final NetworkService<String> ns2 = injectorNs2.getInstance(NetworkService.class);

                            final Injector injectorNs1 = injector.forkInjector();
                            injectorNs1.bindVolatileParameter(
                                    NetworkServiceParameters.NetworkServiceHandler.class,
                                    new MessageHandler<String>(name1, null, 0));
                            final NetworkService<String> ns1 = injectorNs1.getInstance(NetworkService.class);

                            ns2.registerId(factory.getNewInstance(name2));
                            final int port2 = ns2.getTransport().getListeningPort();
                            server.register(factory.getNewInstance(name2),
                                    new InetSocketAddress(localAddress, port2));

                            ns1.registerId(factory.getNewInstance(name1));
                            final int port1 = ns1.getTransport().getListeningPort();
                            server.register(factory.getNewInstance(name1),
                                    new InetSocketAddress(localAddress, port1));

                            final Identifier destId = factory.getNewInstance(name2);
                            final String message = StringUtils.repeat('1', size);

                            try (Connection<String> conn = ns1.newConnection(destId)) {
                                conn.open();
                                for (int i = 0; i < numMessages; i++) {
                                    conn.write(message);
                                }
                                monitor.mwait();
                            } catch (final NetworkException e) {
                                e.printStackTrace();
                                throw new RuntimeException(e);
                            }
                        }
                    } catch (final Exception e) {
                        e.printStackTrace();
                        throw new RuntimeException(e);
                    }
                }
            });
        }

        // start and time
        final long start = System.currentTimeMillis();
        final Object ignore = new Object();
        for (int i = 0; i < numThreads; i++) {
            barrier.add(ignore);
        }
        e.shutdown();
        e.awaitTermination(100, TimeUnit.SECONDS);
        final long end = System.currentTimeMillis();

        final double runtime = ((double) end - start) / 1000;
        LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + totalNumMessages / runtime
                + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime); // x2 for unicode chars
    }
}

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

@Override
public void run() {
    LOG.log(Level.INFO, "Attempting to run framework. Nothing to do.");
    LOG.log(Level.FINEST, "Paradigm shift enabled.");
    LOG.log(Level.FINEST, "Spin and poll surplanted by event based execution.");
    LOG.log(Level.FINEST, "Mesos-OODT Fusion complete.");
    //Don't run anything
    return;//from w ww  . j ava 2  s. c  om
}

From source file:fr.ortolang.diffusion.api.content.ContentResource.java

private ResponseBuilder handleExport(boolean followSymlink, String filename, String format,
        final List<String> paths, final Pattern pattern) throws UnsupportedEncodingException {
    ResponseBuilder builder;/*from   w w w.j  a va  2  s . com*/
    switch (format) {
    case "zip": {
        LOGGER.log(Level.FINE, "exporting using format zip");
        builder = Response.ok();
        builder.header("Content-Disposition",
                "attachment; filename*=UTF-8''" + URLEncoder.encode(filename, "utf-8") + ".zip");
        builder.type("application/zip");
        StreamingOutput stream = output -> {
            try (ZipArchiveOutputStream out = new ZipArchiveOutputStream(output)) {
                for (String path : paths) {
                    try {
                        String key = resolveContentPath(path);
                        ArchiveEntryFactory factory = (name, time, size) -> {
                            ZipArchiveEntry entry = new ZipArchiveEntry(name);
                            if (time != -1) {
                                entry.setTime(time);
                            }
                            if (size != -1) {
                                entry.setSize(size);
                            }
                            return entry;
                        };
                        exportToArchive(key, out, factory, PathBuilder.fromPath(path), false, pattern);
                    } catch (AccessDeniedException e) {
                        LOGGER.log(Level.FINEST, "access denied during export to zip", e);
                    } catch (BrowserServiceException | CoreServiceException | AliasNotFoundException
                            | KeyNotFoundException | OrtolangException e) {
                        LOGGER.log(Level.INFO, "unable to export path to zip", e);
                    } catch (InvalidPathException e) {
                        LOGGER.log(Level.FINEST, "invalid path during export to zip", e);
                    } catch (PathNotFoundException e) {
                        LOGGER.log(Level.FINEST, "path not found during export to zip", e);
                    } catch (ExportToArchiveIOException e) {
                        LOGGER.log(Level.SEVERE,
                                "unexpected IO error during export to archive, stopping export", e);
                        break;
                    }
                }
            }
        };
        builder.entity(stream);
        break;
    }
    case "tar": {
        LOGGER.log(Level.FINE, "exporting using format tar");
        builder = Response.ok();
        builder.header("Content-Disposition",
                "attachment; filename*=UTF-8''" + URLEncoder.encode(filename, "utf-8") + ".tar.gz");
        builder.type("application/x-gzip");
        StreamingOutput stream = output -> {
            try (GzipCompressorOutputStream gout = new GzipCompressorOutputStream(output);
                    TarArchiveOutputStream out = new TarArchiveOutputStream(gout)) {
                for (String path : paths) {
                    try {
                        String key = resolveContentPath(path);
                        ArchiveEntryFactory factory = (name, time, size) -> {
                            TarArchiveEntry entry = new TarArchiveEntry(name);
                            if (time != -1) {
                                entry.setModTime(time);
                            }
                            if (size != -1) {
                                entry.setSize(size);
                            }
                            return entry;
                        };
                        exportToArchive(key, out, factory, PathBuilder.fromPath(path), false, pattern);
                    } catch (BrowserServiceException | CoreServiceException | AliasNotFoundException
                            | KeyNotFoundException | OrtolangException e) {
                        LOGGER.log(Level.INFO, "unable to export path to tar", e);
                    } catch (InvalidPathException e) {
                        LOGGER.log(Level.FINEST, "invalid path during export to tar", e);
                    } catch (PathNotFoundException e) {
                        LOGGER.log(Level.FINEST, "path not found during export to tar", e);
                    } catch (ExportToArchiveIOException e) {
                        LOGGER.log(Level.SEVERE,
                                "unexpected IO error during export to archive, stopping export", e);
                        break;
                    }
                }
            }
        };
        builder.entity(stream);
        break;
    }
    default:
        builder = Response.status(Status.BAD_REQUEST).entity("export format [" + format + "] is not supported");
    }
    return builder;
}

From source file:com.clothcat.hpoolauto.model.HtmlGenerator.java

/**
 * calculate the percentage of poolSize investment is and return it as a
 * string with 3 digit precision/*from  w  w w  .ja v  a2  s.  c  o  m*/
 */
private static String calcPercentage(long poolSize, long invSize) {
    double d = ((double) poolSize * 100) / invSize;
    HLogger.log(Level.FINEST, "calcPercentage(" + poolSize + ", " + invSize + ");\n" + "calculated: " + d);
    return String.format("%.3f", d);
}

From source file:com.sun.grizzly.http.jk.common.ChannelNioSocket.java

public void accept(MsgContext ep) throws IOException {
    if (sSocket == null) {
        return;//  ww w.j  a v  a 2  s.c  o  m
    }
    synchronized (this) {
        while (paused) {
            try {
                wait();
            } catch (InterruptedException ie) {
                //Ignore, since can't happen
            }
        }
    }
    SocketChannel sc = sSocket.getChannel().accept();
    Socket s = sc.socket();
    ep.setNote(socketNote, s);
    if (LoggerUtils.getLogger().isLoggable(Level.FINEST)) {
        LoggerUtils.getLogger().log(Level.FINEST, "Accepted socket " + s + " channel " + sc.isBlocking());
    }

    try {
        setSocketOptions(s);
    } catch (SocketException sex) {
        LoggerUtils.getLogger().log(Level.FINEST, "Error initializing Socket Options", sex);
    }

    requestCount++;

    sc.configureBlocking(false);
    InputStream is = new SocketInputStream(sc);
    OutputStream os = new SocketOutputStream(sc);
    ep.setNote(isNote, is);
    ep.setNote(osNote, os);
    ep.setControl(tp);
}

From source file:com.github.danielfernandez.matchday.data.Data.java

public static void initializeAllData(final ReactiveMongoTemplate mongoTemplate) {

    /*/*from ww w.  j av  a2s  . c  om*/
     *  Drop collections, then create them again
     */
    final Mono<Void> initializeCollections = mongoTemplate.dropCollection(Team.class)
            .then(mongoTemplate.dropCollection(Match.class)).then(mongoTemplate.dropCollection(Player.class))
            .then(mongoTemplate.dropCollection(MatchEvent.class))
            .then(mongoTemplate.dropCollection(MatchComment.class))
            .then(mongoTemplate.createCollection(Team.class)).then(mongoTemplate.createCollection(Match.class))
            .then(mongoTemplate.createCollection(Player.class))
            .then(mongoTemplate.createCollection(MatchEvent.class,
                    CollectionOptions.empty().size(104857600).capped())) // max: 100MBytes
            .then(mongoTemplate.createCollection(MatchComment.class,
                    CollectionOptions.empty().size(104857600).capped())) // max: 100MBytes
            .then();

    /*
     * Add some test data to the collections: teams and players will come from the
     * utility Data class, but we will generate matches between teams randomly each
     * time the application starts (for the fun of it)
     */
    final Mono<Void> initializeData = mongoTemplate
            // Insert all the teams into the corresponding collection and log
            .insert(Data.TEAMS, Team.class).log(LOGGER_INITIALIZE, Level.FINEST)
            // Collect all inserted team codes and randomly shuffle the list
            .map(Team::getCode).collectList().doOnNext(Collections::shuffle)
            .flatMapMany(list -> Flux.fromIterable(list))
            // Create groups of two teams and insert a new Match for them
            .buffer(2).map(twoTeams -> new Match(twoTeams.get(0), twoTeams.get(1)))
            .flatMap(mongoTemplate::insert).log(LOGGER_INITIALIZE, Level.FINEST)
            .concatMap(match -> mongoTemplate
                    .insert(new MatchEvent(match.getId(), MatchEvent.Type.MATCH_START, null, null)))
            // Finally insert the players into their corresponding collection
            .thenMany(Flux.fromIterable(Data.PLAYERS)).flatMap(mongoTemplate::insert)
            .log(LOGGER_INITIALIZE, Level.FINEST).then();

    /*
     * Perform the initialization, blocking (that's OK, we are bootstrapping a testing app)
     */
    initializeCollections.then(initializeData).block();

}

From source file:be.appfoundry.custom.google.android.gcm.server.Sender.java

/**
 * Sends a message to many devices, retrying in case of unavailability.
 * <p/>//  ww w  .jav  a  2 s . co m
 * <p/>
 * <strong>Note: </strong> this method uses exponential back-off to retry in
 * case of service unavailability and hence could block the calling thread
 * for many seconds.
 *
 * @param message message to be sent.
 * @param regIds  registration id of the devices that will receive
 *                the message.
 * @param retries number of retries in case of service unavailability errors.
 * @return combined result of all requests made.
 * @throws IllegalArgumentException if registrationIds is {@literal null} or
 *                                  empty.
 * @throws InvalidRequestException  if GCM didn't returned a 200 or 503 status.
 * @throws IOException              if message could not be sent.
 */
public MulticastResult send(Message message, List<String> regIds, int retries) throws IOException {
    int attempt = 0;
    MulticastResult multicastResult;
    int backoff = BACKOFF_INITIAL_DELAY;
    // Map of results by registration id, it will be updated after each attempt
    // to send the messages
    Map<String, Result> results = new HashMap<String, Result>();
    List<String> unsentRegIds = new ArrayList<String>(regIds);
    boolean tryAgain;
    List<Long> multicastIds = new ArrayList<Long>();
    do {
        multicastResult = null;
        attempt++;
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Attempt #" + attempt + " to send message " + message + " to regIds " + unsentRegIds);
        }
        try {
            multicastResult = sendNoRetry(message, unsentRegIds);
        } catch (IOException e) {
            // no need for WARNING since exception might be already logged
            logger.log(Level.FINEST, "IOException on attempt " + attempt, e);
        }
        if (multicastResult != null) {
            long multicastId = multicastResult.getMulticastId();
            logger.fine("multicast_id on attempt # " + attempt + ": " + multicastId);
            multicastIds.add(multicastId);
            unsentRegIds = updateStatus(unsentRegIds, results, multicastResult);
            tryAgain = !unsentRegIds.isEmpty() && attempt <= retries;
        } else {
            tryAgain = attempt <= retries;
        }
        if (tryAgain) {
            int sleepTime = backoff / 2 + random.nextInt(backoff);
            sleep(sleepTime);
            if (2 * backoff < MAX_BACKOFF_DELAY) {
                backoff *= 2;
            }
        }
    } while (tryAgain);
    if (multicastIds.isEmpty()) {
        // all JSON posts failed due to GCM unavailability
        throw new IOException("Could not post JSON requests to GCM after " + attempt + " attempts");
    }
    // calculate summary
    int success = 0, failure = 0, canonicalIds = 0;
    for (Result result : results.values()) {
        if (result.getMessageId() != null) {
            success++;
            if (result.getCanonicalRegistrationId() != null) {
                canonicalIds++;
            }
        } else {
            failure++;
        }
    }
    // build a new object with the overall result
    long multicastId = multicastIds.remove(0);
    MulticastResult.Builder builder = new MulticastResult.Builder(success, failure, canonicalIds, multicastId)
            .retryMulticastIds(multicastIds);
    // add results, in the same order as the input
    for (String regId : regIds) {
        Result result = results.get(regId);
        builder.addResult(result);
    }
    return builder.build();
}

From source file:org.apache.myfaces.ov2021.application.jsp.JspStateManagerImpl.java

/**
 * See getTreeStructureToSave.//from   w  w  w  . ja  va2 s  .  c o m
 */
@Override
protected UIViewRoot restoreTreeStructure(FacesContext facesContext, String viewId, String renderKitId) {
    if (log.isLoggable(Level.FINEST))
        log.finest("Entering restoreTreeStructure");

    RenderKit rk = getRenderKitFactory().getRenderKit(facesContext, renderKitId);
    ResponseStateManager responseStateManager = rk.getResponseStateManager();

    UIViewRoot uiViewRoot;
    if (isSavingStateInClient(facesContext)) {
        //reconstruct tree structure from request
        Object treeStructure = responseStateManager.getTreeStructureToRestore(facesContext, viewId);
        if (treeStructure == null) {
            if (log.isLoggable(Level.FINE))
                log.fine("Exiting restoreTreeStructure - No tree structure state found in client request");
            return null;
        }

        TreeStructureManager tsm = new TreeStructureManager();
        uiViewRoot = tsm.restoreTreeStructure(treeStructure);
        if (log.isLoggable(Level.FINEST))
            log.finest("Tree structure restored from client request");
    } else {
        //reconstruct tree structure from ServletSession
        Integer serverStateId = getServerStateId(
                (Object[]) responseStateManager.getState(facesContext, viewId));

        Object[] stateObj = (Object[]) ((serverStateId == null) ? null
                : getSerializedViewFromServletSession(facesContext, viewId, serverStateId));
        if (stateObj == null) {
            if (log.isLoggable(Level.FINE))
                log.fine("Exiting restoreTreeStructure - No serialized view found in server session!");
            return null;
        }

        SerializedView serializedView = new SerializedView(stateObj[0], stateObj[1]);
        Object treeStructure = serializedView.getStructure();
        if (treeStructure == null) {
            if (log.isLoggable(Level.FINE))
                log.fine(
                        "Exiting restoreTreeStructure - No tree structure state found in server session, former UIViewRoot must have been transient");
            return null;
        }

        TreeStructureManager tsm = new TreeStructureManager();
        uiViewRoot = tsm.restoreTreeStructure(serializedView.getStructure());
        if (log.isLoggable(Level.FINEST))
            log.finest("Tree structure restored from server session");
    }

    if (log.isLoggable(Level.FINEST))
        log.finest("Exiting restoreTreeStructure");
    return uiViewRoot;
}