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.server.xmpp.Sender.java

/**
 * Sends a message to many devices, retrying in case of unavailability.
 *
 * <p>//from  w  w w .ja  v a  2  s  .c o  m
 * <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.
* @throws org.json.simple.parser.ParseException 
 */
public MulticastResult send(Message message, List<String> regIds, int retries)
        throws IOException, org.json.simple.parser.ParseException, ParseException {
    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.info("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.info("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:com.neophob.sematrix.core.glue.Collector.java

/**
 * load a saved preset.//  w  w w.  j a v  a  2s  . c  om
 *
 * @param preset the new current status
 */
public void setCurrentStatus(List<String> preset) {
    LOG.log(Level.FINEST, "--------------");
    long start = System.currentTimeMillis();
    setLoadingPresent(true);
    for (String s : preset) {
        s = StringUtils.trim(s);
        s = StringUtils.removeEnd(s, ";");
        LOG.log(Level.FINEST, "LOAD PRESET: " + s);
        MessageProcessor.processMsg(StringUtils.split(s, ' '), false, null);
    }
    setLoadingPresent(false);
    long needed = System.currentTimeMillis() - start;
    LOG.log(Level.INFO, "Preset loaded in " + needed + "ms");
}

From source file:jenkins.plugins.openstack.compute.SlaveOptionsDescriptor.java

@Restricted(DoNotUse.class)
@InjectOsAuth//  w w w  .j av a2  s  .  c  om
public ListBoxModel doFillKeyPairNameItems(@QueryParameter String keyPairName,
        @QueryParameter String endPointUrl, @QueryParameter String identity, @QueryParameter String credential,
        @QueryParameter String zone) {

    ListBoxModel m = new ListBoxModel();
    m.add("None specified", "");

    try {
        Openstack openstack = Openstack.Factory.get(endPointUrl, identity, credential, zone);
        for (String keyPair : openstack.getSortedKeyPairNames()) {
            m.add(keyPair);
        }
        return m;
    } catch (AuthenticationException | FormValidation | ConnectionException ex) {
        LOGGER.log(Level.FINEST, "Openstack call failed", ex);
    } catch (Exception ex) {
        LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
    }

    if (Util.fixEmpty(keyPairName) != null) {
        m.add(keyPairName);
    }

    return m;
}

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

public void saveProperties() {
    if (!saveProperties) {
        return;/* w w  w. j av  a  2s.c  o  m*/
    }

    if (propsF == null) {
        LoggerUtils.getLogger().log(Level.WARNING, "No properties file specified. Unable to save");
        return;
    }
    // Temp - to check if it works
    File outFile = new File(propsF.getParentFile(), propsF.getName() + ".save");
    LoggerUtils.getLogger().log(Level.FINEST, "Saving properties " + outFile);
    try {
        props.store(new FileOutputStream(outFile), "AUTOMATICALLY GENERATED");
    } catch (IOException ex) {
        LoggerUtils.getLogger().log(Level.WARNING, "Unable to save to " + outFile, ex);
    }
}

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

public void moveToNextPool() {
    HLogger.log(Level.FINEST, "in moveToNextPool()");
    Pool oldPool = getPool(getCurrPoolName());
    HLogger.log(Level.FINEST, "oldPool: " + oldPool);

    // generate new pool name
    String newPoolName = getNextPoolName();
    HLogger.log(Level.FINEST, "newPoolNAme: " + newPoolName);

    // set old pool status to maturing
    oldPool.setStatus(PoolStatus.MATURING);
    HLogger.log(Level.FINEST, "Set oldpool status to " + oldPool.getStatus());

    // address for the current pool we're creating
    String oldAddress = oldPool.getPoolAddress();
    HLogger.log(Level.FINEST, "oldAddress: " + oldAddress);
    if (oldAddress == null || "".equals(oldAddress)) {
        oldAddress = rpcWorker.getPoolAddress(oldPool.getPoolName());
        oldPool.setPoolAddress(oldAddress);
        HLogger.log(Level.FINEST, "oldAddress: " + oldAddress);
    }/* ww w.j av a  2 s .  c om*/

    HLogger.log(Level.FINEST, "amount: " + oldPool.calculateFillAmount());
    HLogger.log(Level.FINEST, "fee: " + Constants.XFER_FEE);
    // xfer into the now full pool
    rpcWorker.xferCoins("pool", oldAddress, oldPool.calculateFillAmount() - Constants.XFER_FEE);
    // set the timestamp the pool was started
    long t = System.currentTimeMillis();
    oldPool.setStartTimestamp(t);
    HLogger.log(Level.FINEST, "set startTimestamp to: " + t);
    // set currentpool to new pool
    setCurrPoolName(newPoolName);
    HLogger.log(Level.FINEST, "Switched currPoolName to: " + getCurrPoolName());

    // update and save all
    HLogger.log(Level.FINEST, "calling updateAndSave()");
    updateAndSave();
}

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

/**
 * Returns the snapshot UUID from the previous build, sometimes only a successful build
 * @param build// www  .ja v a 2 s. c  o  m
 * @param facade
 * @param loginInfo
 * @param streamName
 * @param clientLocale
 * @return
 * @throws Exception
 */
public static Tuple<Run<?, ?>, String> getSnapshotUUIDFromPreviousBuild(final Run<?, ?> build, String toolkit,
        RTCLoginInfo loginInfo, String processArea, String buildStream, final boolean onlyGoodBuild,
        Locale clientLocale) throws Exception {
    Tuple<Run<?, ?>, String> snapshotDetails = new Tuple<Run<?, ?>, String>(null, null);
    if (buildStream == null) {
        return snapshotDetails;
    }
    snapshotDetails = getValueForBuildStream(new IJenkinsBuildIterator() {

        @Override
        public Run<?, ?> nextBuild(Run<?, ?> build) {
            if (onlyGoodBuild) {
                return build.getPreviousSuccessfulBuild();
            } else {
                return build.getPreviousBuild();
            }
        }

        @Override
        public Run<?, ?> firstBuild() {
            return build;
        }
    }, toolkit, loginInfo, processArea, buildStream, onlyGoodBuild, "team_scm_snapshotUUID", clientLocale);
    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("Helper.getSnapshotUUIDFromPreviousBuild : "
                + ((snapshotDetails.getSecond() == null) ? "No snapshotUUID found from a previous build"
                        : snapshotDetails.getSecond()));
    }
    return snapshotDetails;
}

From source file:is.hi.bok.deduplicator.DeDuplicator.java

@Override
protected void initialTasks() {
    // Read settings and set appropriate class variables.

    // Index location
    String indexLocation = (String) readAttribute(ATTR_INDEX_LOCATION, "");
    try {/* w w w .j  a v a2  s. co  m*/
        FSDirectory indexDir = FSDirectory.open(new File(indexLocation));
        // https://issues.apache.org/jira/browse/LUCENE-1566
        // Reduce chunksize to avoid OOM to half the size of the default (=100 MB)
        int chunksize = indexDir.getReadChunkSize();
        indexDir.setReadChunkSize(chunksize / 2);
        IndexReader reader = DirectoryReader.open(indexDir);
        index = new IndexSearcher(reader);
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Unable to find/open index.", e);
    }

    // Matching method
    String matchingMethod = (String) readAttribute(ATTR_MATCHING_METHOD, DEFAULT_MATCHING_METHOD);
    lookupByURL = matchingMethod.equals(DEFAULT_MATCHING_METHOD);

    // Try equivalent matches
    equivalent = ((Boolean) readAttribute(ATTR_EQUIVALENT, DEFAULT_EQUIVALENT)).booleanValue();

    // Mime filter
    mimefilter = (String) readAttribute(ATTR_MIME_FILTER, DEFAULT_MIME_FILTER);

    // Filter mode (blacklist (default) or whitelist)
    blacklist = ((String) readAttribute(ATTR_FILTER_MODE, DEFAULT_FILTER_MODE)).equals(DEFAULT_FILTER_MODE);

    // Analysis (None (default), Timestamp only or Timestamp and ETag)
    String analysisMode = (String) readAttribute(ATTR_ANALYSIS_MODE, DEFAULT_ANALYSIS_MODE);
    if (analysisMode.equals(AVAILABLE_ANALYSIS_MODES[1])) {
        // Timestamp only
        doTimestampAnalysis = true;
    } else if (analysisMode.equals(AVAILABLE_ANALYSIS_MODES[2])) {
        // Both timestamp and ETag
        doTimestampAnalysis = true;
        doETagAnalysis = true;
    }

    // Log file/level
    String lev = (String) readAttribute(ATTR_LOG_LEVEL, DEFAULT_LOG_LEVEL);
    if (lev.equals(Level.FINEST.toString())) {
        logger.setLevel(Level.FINEST);
    } else if (lev.equals(Level.INFO.toString())) {
        logger.setLevel(Level.INFO);
    } // Severe effectively means default level.

    // Track per host stats
    statsPerHost = ((Boolean) readAttribute(ATTR_STATS_PER_HOST, DEFAULT_STATS_PER_HOST)).booleanValue();

    // Change content size
    changeContentSize = ((Boolean) readAttribute(ATTR_CHANGE_CONTENT_SIZE, DEFAULT_CHANGE_CONTENT_SIZE))
            .booleanValue();

    // Origin handling.
    String originHandling = (String) readAttribute(ATTR_ORIGIN_HANDLING, DEFAULT_ORIGIN_HANDLING);
    if (originHandling.equals(ORIGIN_HANDLING_NONE) == false) {
        useOrigin = true;
        if (originHandling.equals(ORIGIN_HANDLING_INDEX)) {
            useOriginFromIndex = true;
        }
    }

    // Range Filter type
    useSparseRangeFilter = ((Boolean) readAttribute(ATTR_USE_SPARSE_RANGE_FILTER,
            DEFAULT_USE_SPARSE_RANGE_FILTER)).booleanValue();

    // Initialize some internal variables:
    stats = new Statistics();
    if (statsPerHost) {
        perHostStats = new HashMap<String, Statistics>();
    }
}

From source file:be.fedict.eidviewer.gui.printing.IDPrintout.java

public boolean imageUpdate(Image image, int i, int i1, int i2, int i3, int i4) {
    logger.log(Level.FINEST, "ImageUpdate{0}{1}{2}{3}{4}", new Object[] { i, i1, i2, i3, i4 });
    return true;//  w  ww  . j ava 2  s.  co  m
}

From source file:com.archivas.clienttools.arcutils.impl.adapter.HCAPAdapter.java

public InputStream getInputStream(final String path, final String query) throws StorageAdapterException {
    LOG.log(Level.FINEST, "getHost()=" + getHost() + ", profile=" + getProfile().toDetailString());
    return getInputStream(getHost(), path, query, true, null);
}

From source file:com.vaadin.server.communication.PushHandler.java

/**
 * Tries to send a critical notification to the client and close the
 * connection. Does nothing if the connection is already closed.
 *///w  w  w. j a  v a  2s  .  c om
private static void sendNotificationAndDisconnect(AtmosphereResource resource, String notificationJson) {
    // TODO Implemented differently from sendRefreshAndDisconnect
    try {
        resource.getResponse().getWriter().write(notificationJson);
        resource.resume();
    } catch (Exception e) {
        getLogger().log(Level.FINEST, "Failed to send critical notification to client", e);
    }
}