Example usage for java.lang Thread dumpStack

List of usage examples for java.lang Thread dumpStack

Introduction

In this page you can find the example usage for java.lang Thread dumpStack.

Prototype

public static void dumpStack() 

Source Link

Document

Prints a stack trace of the current thread to the standard error stream.

Usage

From source file:org.cloudata.core.common.io.CWritableUtils.java

public static String readString(DataInput in) throws IOException {
    int length = in.readInt();
    if (length > 1024 * 1024 * 5) {
        LOG.error("too long String length: " + length);
        Thread.dumpStack();
        throw new IOException("WritableUtils.readString: too long String length: " + length);
    }/*  w  w  w. j  av a2s.c  o m*/
    if (length == -1)
        return null;
    byte[] buffer = new byte[length];
    //long time1 = System.currentTimeMillis();
    in.readFully(buffer); // could/should use readFully(buffer,0,length)?
    //long time2 = System.currentTimeMillis();
    String result = new String(buffer, "UTF-8");
    //long time3 = System.currentTimeMillis();
    //System.out.println("readString:" + (time2-time1) + "," + (time3-time1));
    return result;
}

From source file:org.cloudata.core.common.io.CWritableUtils.java

public static String readString(DataInput in, int maxLength) throws IOException {
    int length = in.readInt();
    if (length > maxLength) {
        Thread.dumpStack();
        throw new IOException("WritableUtils.readString:too long String length: " + length);
    }//from ww  w.  ja v  a 2  s  .  co  m
    if (length == -1)
        return null;
    byte[] buffer = new byte[length];
    in.readFully(buffer); // could/should use readFully(buffer,0,length)?
    return new String(buffer, "UTF-8");
}

From source file:org.cloudata.core.fs.PipeBasedCommitLogFileSystem.java

void returnToCache(String tabletName, CommitLogClient fs) throws IOException {
    if (fs == null) {
        Thread.dumpStack();
    }/*from w w w . j  a v a 2  s.c om*/

    ServerSet set = serverLocationManager.getReplicaAddresses(tabletName);
    CommitLogFileSystemInfo fsInfo = fsCache.get(set);

    if (fsInfo == null) {
        fsInfo = new CommitLogFileSystemInfo();
        CommitLogFileSystemInfo previous = fsCache.putIfAbsent(set, fsInfo);
        fsInfo = (previous == null) ? fsInfo : previous;
    }

    fsInfo.add(fs);
}

From source file:org.codinjutsu.tools.jenkins.logic.RequestManager.java

private boolean handleNotYetLoggedInState() {
    boolean threadStack = false;
    boolean result = false;
    if (SwingUtilities.isEventDispatchThread()) {
        logger.warn("RequestManager.handleNotYetLoggedInState called from EDT");
        threadStack = true;/*from www  . ja  v a 2s. co  m*/
    }
    if (securityClient == null) {
        logger.warn("Not yet logged in, all calls until login will fail");
        threadStack = true;
        result = true;
    }
    if (threadStack)
        Thread.dumpStack();
    return result;
}

From source file:org.dllearner.reasoning.SPARQLReasoner.java

public SortedSet<OWLIndividual> getIndividuals(OWLClassExpression description, int limit,
        Set<OWLIndividual> indValues) {
    // we need to copy it to get something like A AND B from A AND A AND B
    description = duplicator.duplicateObject(description);

    SortedSet<OWLIndividual> individuals = new TreeSet<>();
    String query;// w ww  . j  a v a2 s  . c  o  m

    if (indValues != null) {
        String tp = converter.convert("?ind", description);
        query = "SELECT DISTINCT ?ind WHERE { \n" + "VALUES ?ind { \n";
        for (OWLIndividual x : indValues) {
            query += "<" + x.toStringID() + "> ";
        }
        query += "}. \n " + tp + "\n}";
        //query = converter.asQuery("?ind", description).toString();
        //System.exit(1); // XXX
    } else {
        query = converter.asQuery("?ind", description, false).toString();//System.out.println(query);
    }
    if (limit != 0) {
        query += " LIMIT " + limit;
    }
    //      query = String.format(SPARQLQueryUtils.PREFIXES + " SELECT ?ind WHERE {?ind rdf:type/rdfs:subClassOf* <%s> .}", description.asOWLClass().toStringID());
    if (logger.isDebugEnabled()) {
        Thread.dumpStack();
        logger.debug(sparql_debug, "get individuals query: " + query);
    }
    ResultSet rs = executeSelectQuery(query);
    while (rs.hasNext()) {
        QuerySolution qs = rs.next();
        if (qs.get("ind").isURIResource()) {
            individuals.add(df.getOWLNamedIndividual(IRI.create(qs.getResource("ind").getURI())));
        }
    }
    logger.debug(sparql_debug, "get individuals result: " + individuals);
    return individuals;
}

From source file:org.jahia.services.content.decorator.JCRNodeDecorator.java

public JCRNodeDecorator(JCRNodeWrapper node) {
    if (node instanceof JCRNodeDecorator) {
        logger.warn("An already decorated node shouldn't be decorated");
        Thread.dumpStack();
    }/*from  w w  w  . j a va 2  s. c om*/
    this.node = node;
}

From source file:org.jahia.services.render.Resource.java

/**
 * Get the node associated to the current resource, in case of a lazy resource the node will be load from jcr if it's null
 * This function shouldn't not be call before the CacheFilter to avoid loading of node from JCR.
 * Since CacheFilter is executed for each fragments now even if there are in cache.
 *
 * If the node is needed it should be requested after the CacheFilter or for cache key generation during aggregation
 *
 * @return The JCR Node if found, null if not
 *//*ww  w  .  jav  a  2 s. c  om*/
public JCRNodeWrapper getNode() {
    if (!isNodeLoaded()) {
        try {
            if (lazyNodeFlagWarning && sessionWrapper.getWorkspace().getName().equals(Constants.LIVE_WORKSPACE)
                    && !CONFIGURATION_PAGE.equals(contextConfiguration)) {

                logger.warn("Performance warning: node loaded from JCR before the cache filter for resource: "
                        + nodePath + ", render filter implementations have to be review, "
                        + "to avoid reading the node from the resource before the cache. "
                        + "You can enable debug log level to look at the current thread stack, "
                        + "this could help to identify the calling method");
                if (logger.isDebugEnabled()) {
                    Thread.dumpStack();
                }
            }

            node = sessionWrapper.getNode(nodePath);
        } catch (RepositoryException e) {
            throw new IllegalStateException(
                    "Lazy Node from resource failed to be load, because Node is not found anymore", e);
        }
    }
    return node;
}

From source file:org.nuxeo.ecm.platform.api.test.NXClientTestCase.java

protected void deploy(String bundle) {
    URL url = getResource(bundle);
    if (null == url) {
        log.error("cannot deploy bundle: " + bundle + ". not found");
        Thread.dumpStack();
        return;/*from   ww  w .j a  v  a  2  s. c  o m*/
    }
    try {
        Framework.getRuntime().getContext().deploy(url);
    } catch (Exception e) {
        log.error("cannot deploy bundle: " + bundle, e);
    }
}

From source file:org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement.java

public static void addListeners() {
    for (Class<? extends SQLElement> clazz : map.keySet()) {
        final SQLElement elt = Configuration.getInstance().getDirectory().getElement(clazz);
        if (elt != null) {
            elt.getTable().addTableModifiedListener(new SQLTableModifiedListener() {
                @Override//ww w  .j  a  v  a 2  s.  c  om
                public void tableModified(SQLTableEvent evt) {
                    if (evt.getMode() == Mode.ROW_UPDATED) {
                        SQLRow row = evt.getRow();
                        if (row.isArchived()) {
                            fixNumerotation(elt);
                        }
                    }

                }
            });
        } else {
            System.err.println(clazz);
            Thread.dumpStack();
        }

    }

}

From source file:org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement.java

/**
 * Ajout des mouvements de Stock//from  w w w.j  a v a2 s . c o m
 * 
 * @param rowOrigin SQLRow de la piece d'origine (ex : BL)
 * @param eltTable SQLTable des lments de la pice (ex : element du BL)
 * @param label label pour les mouvements de stocks
 * @param entry true si c'est une entre de stock
 * 
 */
public void createMouvement(SQLRow rowOrigin, SQLTable eltTable, StockLabel label, boolean entry) {

    // On rcupre les articles qui composent la pice
    SQLSelect selEltfact = new SQLSelect(rowOrigin.getTable().getBase());
    selEltfact.addSelectStar(eltTable);
    selEltfact.setWhere(new Where((SQLField) eltTable.getForeignKeys(rowOrigin.getTable()).toArray()[0], "=",
            rowOrigin.getID()));

    List<SQLRow> lElt = SQLRowListRSH.execute(selEltfact);

    final boolean modeAvance = DefaultNXProps.getInstance().getBooleanValue("ArticleModeVenteAvance", false);
    SQLPreferences prefs = new SQLPreferences(eltTable.getDBRoot());
    final boolean createArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO,
            true);

    if (lElt != null) {
        List<Integer> l = new ArrayList<Integer>();
        for (SQLRow rowElt : lElt) {
            SQLRow rowArticleAssocie = (rowElt.getTable().contains("ID_ARTICLE")
                    ? rowElt.getForeign("ID_ARTICLE")
                    : null);

            int idArticle;

            // Si on a bien slectionn un article ou qu'il y a un code de saisi
            if ((rowArticleAssocie != null && !rowArticleAssocie.isUndefined())
                    || rowElt.getString("CODE").trim().length() > 0) {

                // Si l'article est  crer ou le lien est  refaire (ancienne version saisie
                // sans ID_ARTICLE en BD)
                if (rowArticleAssocie == null || rowArticleAssocie.isUndefined()) {
                    // on rcupre l'article qui lui correspond
                    SQLRowValues rowArticle = new SQLRowValues(sqlTableArticle);
                    for (SQLField field : sqlTableArticle.getFields()) {
                        if (rowElt.getTable().getFieldsName().contains(field.getName())) {
                            rowArticle.put(field.getName(), rowElt.getObject(field.getName()));
                        }
                    }
                    // rowArticle.loadAllSafe(rowEltFact);
                    if (modeAvance)
                        idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, createArticle);
                    else {
                        idArticle = ReferenceArticleSQLElement.getIdForCN(rowArticle, createArticle);
                    }
                    if (idArticle > 0 && idArticle != sqlTableArticle.getUndefinedID()) {
                        SQLRowValues rowVals = rowElt.asRowValues();
                        rowVals.put("ID_ARTICLE", idArticle);
                        try {
                            rowVals.update();
                        } catch (SQLException exn) {
                            // TODO Bloc catch auto-gnr
                            exn.printStackTrace();
                        }
                    }
                } else {
                    idArticle = rowArticleAssocie.getID();
                }

                // on cre un mouvement de stock pour chacun des articles
                SQLElement eltMvtStock = Configuration.getInstance().getDirectory()
                        .getElement("MOUVEMENT_STOCK");
                SQLRowValues rowVals = new SQLRowValues(eltMvtStock.getTable());
                if (entry) {
                    rowVals.put("QTE", (rowElt.getInt("QTE")));
                } else {
                    rowVals.put("QTE", -(rowElt.getInt("QTE")));
                }
                rowVals.put("NOM", label.getLabel(rowOrigin, rowElt));
                rowVals.put("IDSOURCE", rowOrigin.getID());
                rowVals.put("SOURCE", rowOrigin.getTable().getName());
                rowVals.put("ID_ARTICLE", idArticle);
                rowVals.put("DATE", rowOrigin.getObject("DATE"));
                try {
                    SQLRow row = rowVals.insert();
                    l.add(row.getID());
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
        CollectionMap<SQLRow, List<SQLRowValues>> map = updateStock(l, false);
        if (map.keySet().size() > 0 && !rowOrigin.getTable().getName().equalsIgnoreCase("TICKET_CAISSE")) {
            if (!rowOrigin.getTable().contains("ID_TARIF")) {
                System.err.println("Attention la table " + rowOrigin.getTable().getName()
                        + " ne contient pas le champ ID_TARIF. La cration automatique d'une commande fournisseur est donc impossible!");
                Thread.dumpStack();
            } else {
                if (JOptionPane.showConfirmDialog(null,
                        "Certains articles sont en dessous du stock minimum.\n Voulez crer une commande?") == JOptionPane.YES_OPTION) {
                    MouvementStockSQLElement.createCommandeF(map,
                            rowOrigin.getForeignRow("ID_TARIF").getForeignRow("ID_DEVISE"));
                }
            }
        }
    }
}