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.cyberway.issue.crawler.framework.CrawlController.java

private void setupBdb() throws FatalConfigurationException, AttributeNotFoundException {
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);//from   w w  w  . j a va2 s  . c  o  m
    int bdbCachePercent = ((Integer) this.order.getAttribute(null, CrawlOrder.ATTR_BDB_CACHE_PERCENT))
            .intValue();
    if (bdbCachePercent > 0) {
        // Operator has expressed a preference; override BDB default or 
        // je.properties value
        envConfig.setCachePercent(bdbCachePercent);
    }
    envConfig.setLockTimeout(5000000); // 5 seconds
    if (LOGGER.isLoggable(Level.FINEST)) {
        envConfig.setConfigParam("java.util.logging.level", "SEVERE");
        envConfig.setConfigParam("java.util.logging.level.evictor", "SEVERE");
        envConfig.setConfigParam("java.util.logging.ConsoleHandler.on", "true");
    }

    if (!getCheckpointCopyBdbjeLogs()) {
        // If we are not copying files on checkpoint, then set bdbje to not
        // remove its log files so that its possible to later assemble
        // (manually) all needed to run a recovery using mix of current
        // bdbje logs and those its marked for deletion.
        envConfig.setConfigParam("je.cleaner.expunge", "false");
    }

    try {
        this.bdbEnvironment = new EnhancedEnvironment(getStateDisk(), envConfig);
        if (LOGGER.isLoggable(Level.FINE)) {
            // Write out the bdb configuration.
            envConfig = bdbEnvironment.getConfig();
            LOGGER.fine("BdbConfiguration: Cache percentage " + envConfig.getCachePercent() + ", cache size "
                    + envConfig.getCacheSize());
        }
    } catch (DatabaseException e) {
        e.printStackTrace();
        throw new FatalConfigurationException(e.getMessage());
    }
}

From source file:com.sun.grizzly.http.jk.server.JkMain.java

private void preProcessProperties() {
    Enumeration keys = props.keys();
    Vector v = new Vector();

    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        Object newName = replacements.get(key);
        if (newName != null) {
            v.addElement(key);/*w  ww  .  j a  va 2s .c o  m*/
        }
    }
    keys = v.elements();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        Object propValue = props.getProperty(key);
        String replacement = (String) replacements.get(key);
        props.put(replacement, propValue);
        if (LoggerUtils.getLogger().isLoggable(Level.FINEST)) {
            LoggerUtils.getLogger().log(Level.FINEST,
                    "Substituting " + key + " " + replacement + " " + propValue);
        }
    }
}

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

@Test
public void testMultithreadedSharedConnMessagingNetworkServiceRate() 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 int[] messageSizes = { 2000 }; // {1,16,32,64,512,64*1024,1024*1024};

        for (final int size : messageSizes) {
            final int numMessages = 300000 / (Math.max(1, size / 512));
            final int numThreads = 2;
            final int totalNumMessages = numMessages * numThreads;
            final Monitor monitor = new Monitor();

            // network service
            final String name2 = "task2";
            final String name1 = "task1";
            final Configuration nameResolverConf = Tang.Factory.getTang()
                    .newConfigurationBuilder(NameResolverConfiguration.CONF
                            .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, this.localAddress)
                            .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort).build())
                    .build();/*from  w ww. j a  v  a  2  s  . c o m*/

            final Injector injector2 = 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 = injector2.getInstance(NameResolver.class)) {
                injector2.bindVolatileParameter(NetworkServiceParameters.NetworkServiceIdentifierFactory.class,
                        factory);
                injector2.bindVolatileInstance(NameResolver.class, nameResolver);
                injector2.bindVolatileParameter(NetworkServiceParameters.NetworkServiceCodec.class,
                        new StringCodec());
                injector2.bindVolatileParameter(NetworkServiceParameters.NetworkServiceTransportFactory.class,
                        injector.getInstance(MessagingTransportFactory.class));
                injector2.bindVolatileParameter(NetworkServiceParameters.NetworkServiceExceptionHandler.class,
                        new ExceptionHandler());

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

                final Injector injectorNs1 = injector2.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("task2"),
                        new InetSocketAddress(this.localAddress, port2));

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

                final Identifier destId = factory.getNewInstance(name2);

                try (final Connection<String> conn = ns1.newConnection(destId)) {
                    conn.open();

                    final String message = StringUtils.repeat('1', size);
                    final ExecutorService e = Executors.newCachedThreadPool();

                    final long start = System.currentTimeMillis();
                    for (int i = 0; i < numThreads; i++) {
                        e.submit(new Runnable() {

                            @Override
                            public void run() {
                                for (int i = 0; i < numMessages; i++) {
                                    conn.write(message);
                                }
                            }
                        });
                    }

                    e.shutdown();
                    e.awaitTermination(30, TimeUnit.SECONDS);
                    monitor.mwait();

                    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:edu.umass.cs.gigapaxos.PaxosInstanceStateMachine.java

/**
 * For legacy reasons, this method still accepts JSONObject in addition to
 * PaxosPacket as the first argument.//from w  w w . j a  v a 2  s. com
 * 
 * @param obj
 * @param mode
 * @throws JSONException
 */
private void handlePaxosMessage(PaxosPacket pp, SyncMode mode) throws JSONException {
    long methodEntryTime = System.currentTimeMillis();
    assert (pp != null || !mode.equals(SyncMode.DEFAULT_SYNC));

    Level level = Level.FINEST;
    if (pp != null)
        log.log(level, "{0} received {1}", new Object[] { this, pp.getSummary(log.isLoggable(level)) });

    if (pp != null && pp.getVersion() != this.getVersion())
        return;

    /* Note: Because incoming messages may be handled concurrently, some
     * messages may continue to get processed for a little while after a
     * stop has been executed and even after isStopped() is true (because
     * isStopped() was false when those messages came in here). But that is
     * okay coz these messages can not spawn unsafe outgoing messages (as
     * messaging is turned off for all but DECISION or CHECKPOINT_STATE
     * packets) and can not change any disk state. */
    if (this.paxosState.isStopped()) {
        log.log(Level.INFO, "{0} stopped; dropping {1}", new Object[] { this, pp.getSummary() });
        return;
    }

    // recovery means we won't send any replies
    boolean recovery = pp != null ? PaxosPacket.isRecovery(pp) : false;
    /* The reason we should not process regular messages until this instance
     * has rolled forward is that it might respond to a prepare with a list
     * of accepts fetched from disk that may be inconsistent with its
     * acceptor state. */
    if (!this.paxosManager.hasRecovered(this) && !recovery)
        return; // only process recovery message during rollForward

    PaxosPacket.PaxosPacketType msgType = pp != null ? pp.getType() : PaxosPacket.PaxosPacketType.NO_TYPE;
    log.log(Level.FINEST, "{0} received {1}:{2}",
            new Object[] { this, msgType, pp != null ? pp.getSummary(log.isLoggable(Level.FINEST)) : pp });

    boolean isPoke = msgType.equals(PaxosPacketType.NO_TYPE);
    if (!isPoke)
        this.markActive();
    else
        log.log(Level.FINER, "{0} received NO_TYPE poke {1};", new Object[] { this, mode });

    MessagingTask[] mtasks = new MessagingTask[3];
    /* Check for coordinator'ing upon *every* message except poke messages.
     * Pokes are primarily for sync'ing decisions and could be also used to
     * resend accepts. There is little reason to send prepares proactively
     * if no new activity is happening. */
    mtasks[0] = (!recovery ?
    // check run for coordinator if not active
            (!PaxosCoordinator.isActive(this.coordinator)
                    // ignore pokes unless not caught up
                    && (!isPoke || !PaxosCoordinator.caughtUp(this.coordinator))) ? checkRunForCoordinator()
                            // else reissue long waiting accepts
                            : this.pokeLocalCoordinator()
            // neither during recovery
            : null);

    log.log(level, "{0} about to switch on packet type {1}",
            new Object[] { this, pp != null ? pp.getSummary(log.isLoggable(level)) : null });

    MessagingTask mtask = null;
    MessagingTask[] batchedTasks = null;

    switch (msgType) {
    case REQUEST:
        batchedTasks = handleRequest((RequestPacket) pp);
        // send RequestPacket to current coordinator
        break;
    // replica --> coordinator
    case PROPOSAL:
        batchedTasks = handleProposal((ProposalPacket) pp);
        // unicast ProposalPacket to coordinator or multicast AcceptPacket
        break;
    // coordinator --> replica
    case DECISION:
        mtask = handleCommittedRequest((PValuePacket) pp);
        // send nothing, but log decision
        break;
    case BATCHED_COMMIT:
        mtask = handleBatchedCommit((BatchedCommit) pp);
        // send nothing, but log decision
        break;
    // coordinator --> replica
    case PREPARE:
        mtask = handlePrepare((PreparePacket) pp);
        // send PreparePacket prepare reply to coordinator
        break;
    // replica --> coordinator
    case PREPARE_REPLY:
        mtask = handlePrepareReply((PrepareReplyPacket) pp);
        // send AcceptPacket[] to all
        break;
    // coordinator --> replica
    case ACCEPT:
        batchedTasks = handleAccept((AcceptPacket) pp);
        // send AcceptReplyPacket to coordinator
        break;
    // replica --> coordinator
    case ACCEPT_REPLY:
        mtask = handleAcceptReply((AcceptReplyPacket) pp);
        // send PValuePacket decision to all
        break;
    case BATCHED_ACCEPT_REPLY:
        batchedTasks = handleBatchedAcceptReply((BatchedAcceptReply) pp);
        // send PValuePacket decisions to all
        break;
    case BATCHED_ACCEPT:
        batchedTasks = handleBatchedAccept((BatchedAccept) pp);
        break;
    case SYNC_DECISIONS_REQUEST:
        mtask = handleSyncDecisionsPacket((SyncDecisionsPacket) pp);
        // send SynchronizeReplyPacket to sender
        break;
    case CHECKPOINT_STATE:
        mtask = handleCheckpoint((StatePacket) pp);
        break;
    case NO_TYPE: // not a real packet
        // sync if needed on poke
        mtasks[0] = (mtasks[0] != null) ? mtasks[0] : this.syncLongDecisionGaps(null, mode);
        break;
    default:
        assert (false) : "Paxos instance received an unrecognizable packet: " + (pp.getSummary());
    }
    mtasks[1] = mtask;

    // special case for method returning array of messaging tasks
    if (batchedTasks != null) {
        // mtasks[1] = batchedTasks[0];
        // mtasks[2] = batchedTasks[1];
        mtasks = MessagingTask.combine(mtasks, batchedTasks);
    }

    instrumentDelay(toLog.handlePaxosMessage, methodEntryTime);

    this.checkIfTrapped(pp, mtasks[1]); // just to print a warning
    if (!recovery) {
        this.sendMessagingTask(mtasks);
    }
}

From source file:edu.biu.scapi.comm.CommunicationSetup.java

/** 
 * This function serves as a barrier. It is called from the prepareForCommunication function. The idea
 * is to let all the threads finish running before proceeding. 
 *///w  w w. j  av  a 2s  . c o  m
private void verifyConnectingStatus() {
    boolean allConnected = false;
    //while the thread has not been stopped and not all the channels are connected
    while (!bTimedOut && !(allConnected = establishedConnections.areAllConnected())) {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {

            Logging.getLogger().log(Level.FINEST, e.toString());
        }
    }
    //If we already know that all the connectios were established we can stop the watchdog.
    if (allConnected)
        watchdog.stop();
}

From source file:com.funambol.tools.test.PostSyncML.java

private void compare(String msgFile) throws IOException, TestFailedException {
    File responseFile = new File(responseDir, msgFile);
    File referenceFile = new File(referenceDir, msgFile);

    SAXBuilder sb = new SAXBuilder();
    sb.setFactory(new DomFactory());

    try {//from  ww  w.  jav a 2s. co  m
        Document response = sb.build(responseFile);
        Document reference = sb.build(referenceFile);

        OtaUpdate update = new OtaUpdate(false);

        UniqueId id = new UniqueId("SyncMLTest", msgFile);
        Element diffs = update.generateDiffs(response.getRootElement(), reference.getRootElement(), id);

        if (log.isLoggable(Level.FINEST)) {
            saveDiffs(diffs, new File(errorDir, msgFile + ".dbg"));
        }

        if (checkDiffs(diffs)) {
            saveDiffs(diffs, new File(errorDir, msgFile));

            throw new TestFailedException(
                    "Test failed on " + msgFile + ". Diff file saved in " + new File(errorDir, msgFile));
        }
    } catch (JDOMException e) {
        IOTools.writeFile(e.getMessage(), new File(errorDir, msgFile));
        throw new TestFailedException("Test failed on " + msgFile + ": " + e.getMessage()
                + ". Error message saved in " + new File(errorDir, msgFile));
    }
}

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

@Override
public void destroy() throws IOException {
    running = false;/* www  .  j a va2  s  .c  o m*/
    try {
        /* If we disabled the channel return */
        if (port == 0) {
            return;
        }
        tp.shutdown();

        selector.wakeup().close();
        sSocket.close(); // XXX?

        if (tpOName != null) {
            Registry.getRegistry(null, null).unregisterComponent(tpOName);
        }
        if (rgOName != null) {
            Registry.getRegistry(null, null).unregisterComponent(rgOName);
        }
    } catch (Exception e) {
        LoggerUtils.getLogger().info("Error shutting down the channel " + port + " " + e.toString());
        if (LoggerUtils.getLogger().isLoggable(Level.FINEST)) {
            LoggerUtils.getLogger().log(Level.FINEST, "Trace", e);
        }
    }
}

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

@Override
public SerializedView saveSerializedView(FacesContext facesContext) throws IllegalStateException {
    if (log.isLoggable(Level.FINEST))
        log.finest("Entering saveSerializedView");

    checkForDuplicateIds(facesContext, facesContext.getViewRoot(), new HashSet<String>());

    if (log.isLoggable(Level.FINEST))
        log.finest("Processing saveSerializedView - Checked for duplicate Ids");

    ExternalContext externalContext = facesContext.getExternalContext();

    // SerializedView already created before within this request?
    Object serializedView = externalContext.getRequestMap().get(SERIALIZED_VIEW_REQUEST_ATTR);
    if (serializedView == null) {
        if (log.isLoggable(Level.FINEST))
            log.finest("Processing saveSerializedView - create new serialized view");

        // first call to saveSerializedView --> create SerializedView
        Object treeStruct = getTreeStructureToSave(facesContext);
        Object compStates = getComponentStateToSave(facesContext);
        serializedView = new Object[] { treeStruct, compStates };
        externalContext.getRequestMap().put(SERIALIZED_VIEW_REQUEST_ATTR, serializedView);

        if (log.isLoggable(Level.FINEST))
            log.finest("Processing saveSerializedView - new serialized view created");
    }/*from w w  w  . j av a  2  s. com*/

    Object[] serializedViewArray = (Object[]) serializedView;

    if (!isSavingStateInClient(facesContext)) {
        if (log.isLoggable(Level.FINEST))
            log.finest("Processing saveSerializedView - server-side state saving - save state");
        //save state in server session
        saveSerializedViewInServletSession(facesContext, serializedView);

        if (log.isLoggable(Level.FINEST))
            log.finest("Exiting saveSerializedView - server-side state saving - saved state");
        return new SerializedView(serializedViewArray[0], new Object[0]);
    }

    if (log.isLoggable(Level.FINEST))
        log.finest("Exiting saveSerializedView - client-side state saving");

    return new SerializedView(serializedViewArray[0], serializedViewArray[1]);
}

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

/**
 * Returns the stream change data from the previous build irrespective of its status
 * @param job/* www .  j a va 2  s  .c om*/
 * @param toolkit
 * @param loginInfo
 * @param processArea
 * @param buildStream
 * @param clientLocale
 * @return
 * @throws Exception
 */
public static Tuple<Run<?, ?>, String> getStreamChangesDataFromLastBuild(final Job<?, ?> job, String toolkit,
        RTCLoginInfo loginInfo, String processArea, String buildStream, Locale clientLocale) throws Exception {
    Tuple<Run<?, ?>, String> streamChangesData = new Tuple<Run<?, ?>, String>(null, null);
    if (buildStream == null) {
        return streamChangesData;
    }
    streamChangesData = getValueForBuildStream(new IJenkinsBuildIterator() {
        @Override
        public Run<?, ?> nextBuild(Run<?, ?> build) {
            return build.getPreviousBuild();
        }

        @Override
        public Run<?, ?> firstBuild() {
            return job.getLastBuild();
        }
    }, toolkit, loginInfo, processArea, buildStream, false, "team_scm_streamChangesData", clientLocale);
    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("Helper.getStreamChangesDataFromLastBuild : " + ((streamChangesData.getSecond() == null)
                ? "No stream changes data found from a previous build"
                : streamChangesData.getSecond()));
    }
    return streamChangesData;
}

From source file:io.hops.hopsworks.api.zeppelin.socket.NotebookServer.java

private void authenticateUser(Session session, Project project, String user) {
    //returns the user role in project. Null if the user has no role in project
    this.userRole = projectTeamBean.findCurrentRole(project, user);
    LOG.log(Level.FINEST, "User role in this project {0}", this.userRole);
    Users users = userBean.findByEmail(user);
    if (users == null || this.userRole == null) {
        try {//from   w w  w  .  j a va 2s.c o m
            session.close(new CloseReason(CloseReason.CloseCodes.VIOLATED_POLICY,
                    "You do not have a role in this project."));
        } catch (IOException ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    }
    this.hdfsUsername = hdfsUsersController.getHdfsUserName(project, users);
}