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:com.t3.client.TabletopTool.java

public static void startServer(String id, ServerConfig config, ServerPolicy policy, Campaign campaign)
        throws IOException {
    if (server != null) {
        Thread.dumpStack();
        showError("msg.error.alreadyRunningServer");
        return;/*from   w  w w  .j  a v a2 s  .  com*/
    }

    assetTransferManager.flush();

    // TODO: the client and server campaign MUST be different objects.
    // Figure out a better init method
    server = new T3Server(config, policy);
    server.setCampaign(campaign);

    serverPolicy = server.getPolicy();

    if (announcer != null) {
        announcer.stop();
    }
    // Don't announce personal servers
    if (!config.isPersonalServer()) {
        announcer = new ServiceAnnouncer(id, server.getConfig().getPort(), AppConstants.SERVICE_GROUP);
        announcer.start();
    }

    // Registered ?
    if (config.isServerRegistered() && !config.isPersonalServer()) {
        try {
            boolean worked = T3Registry.registerInstance(config.getServerName(), config.getPort());
            if (!worked) {
                TabletopTool.showError("msg.error.alreadyRegistered");
            }
            // TODO: I don't like this
        } catch (Exception e) {
            TabletopTool.showError("msg.error.failedCannotRegisterServer", e);
        }
    }
}

From source file:net.rptools.maptool.client.MapTool.java

public static void startServer(String id, ServerConfig config, ServerPolicy policy, Campaign campaign)
        throws IOException {
    if (server != null) {
        Thread.dumpStack();
        showError("msg.error.alreadyRunningServer");
        return;/*from   ww w. j  a  v a 2  s .  c om*/
    }

    assetTransferManager.flush();

    // TODO: the client and server campaign MUST be different objects.
    // Figure out a better init method
    server = new MapToolServer(config, policy);
    server.setCampaign(campaign);

    serverPolicy = server.getPolicy();

    if (announcer != null) {
        announcer.stop();
    }
    // Don't announce personal servers
    if (!config.isPersonalServer()) {
        announcer = new ServiceAnnouncer(id, server.getConfig().getPort(), AppConstants.SERVICE_GROUP);
        announcer.start();
    }

    // Registered ?
    if (config.isServerRegistered() && !config.isPersonalServer()) {
        try {
            int result = MapToolRegistry.registerInstance(config.getServerName(), config.getPort());
            if (result == 3) {
                MapTool.showError("msg.error.alreadyRegistered");
            }
            // TODO: I don't like this
        } catch (Exception e) {
            MapTool.showError("msg.error.failedCannotRegisterServer", e);
        }
    }
}

From source file:l2p.gameserver.model.pledge.Clan.java

public void setRankPrivs(int rank, int privs) {
    if (rank < RANK_FIRST || rank > RANK_LAST) {
        _log.warn("Requested set of invalid rank value: " + rank);
        Thread.dumpStack();
        return;/*w  w w.j  a va2s.c  om*/
    }

    if (_privs.get(rank) != null)
        _privs.get(rank).setPrivs(privs);
    else
        _privs.put(rank, new RankPrivs(rank, countMembersByRank(rank), privs));

    Connection con = null;
    PreparedStatement statement = null;
    try {
        //_log.warn("requested store clan privs in db for rank: " + rank + ", privs: " + privs);
        // Retrieve all skills of this L2Player from the database
        con = DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("REPLACE INTO clan_privs (clan_id,rank,privilleges) VALUES (?,?,?)");
        statement.setInt(1, getClanId());
        statement.setInt(2, rank);
        statement.setInt(3, privs);
        statement.execute();
    } catch (Exception e) {
        _log.warn("Could not store clan privs for rank: " + e);
        _log.error("", e);
    } finally {
        DbUtils.closeQuietly(con, statement);
    }
}

From source file:l2next.gameserver.model.pledge.Clan.java

public RankPrivs getRankPrivs(int rank) {
    if (rank < RANK_FIRST || rank > RANK_LAST) {
        _log.warn("Requested invalid rank value: " + rank);
        Thread.dumpStack();
        return null;
    }/*from  w  w  w. ja va 2 s  .  c o  m*/
    if (_privs.get(rank) == null) {
        _log.warn("Request of rank before init: " + rank);
        Thread.dumpStack();
        setRankPrivs(rank, CP_NOTHING);
    }
    return _privs.get(rank);
}

From source file:l2next.gameserver.model.pledge.Clan.java

public void setRankPrivs(int rank, int privs) {
    if (rank < RANK_FIRST || rank > RANK_LAST) {
        _log.warn("Requested set of invalid rank value: " + rank);
        Thread.dumpStack();
        return;//from ww w. j  a  v  a 2 s  .c o  m
    }

    if (_privs.get(rank) != null) {
        _privs.get(rank).setPrivs(privs);
    } else {
        _privs.put(rank, new RankPrivs(rank, countMembersByRank(rank), privs));
    }

    Connection con = null;
    PreparedStatement statement = null;
    try {
        // _log.warn("requested store clan privs in db for rank: " + rank +
        // ", privs: " + privs);
        // Retrieve all skills of this L2Player from the database
        con = DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("REPLACE INTO clan_privs (clan_id,rank,privilleges) VALUES (?,?,?)");
        statement.setInt(1, getClanId());
        statement.setInt(2, rank);
        statement.setInt(3, privs);
        statement.execute();
    } catch (Exception e) {
        _log.warn("Could not store clan privs for rank: " + e);
        _log.error("", e);
    } finally {
        DbUtils.closeQuietly(con, statement);
    }
}

From source file:l2r.gameserver.model.pledge.Clan.java

public void setRankPrivs(int rank, int privs) {
    if (rank < RANK_FIRST || rank > RANK_LAST) {
        _log.warn("Requested set of invalid rank value: " + rank);
        Thread.dumpStack();
        return;//from w  w  w .jav  a2  s  .  c o m
    }

    if (_privs.get(rank) != null)
        _privs.get(rank).setPrivs(privs);
    else
        _privs.put(rank, new RankPrivs(rank, countMembersByRank(rank), privs));

    Connection con = null;
    PreparedStatement statement = null;
    try {
        //_log.warn("requested store clan privs in db for rank: " + rank + ", privs: " + privs);
        // Retrieve all skills of this L2Player from the database
        con = DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("REPLACE INTO clan_privs (clan_id,rank,privileges) VALUES (?,?,?)");
        statement.setInt(1, getClanId());
        statement.setInt(2, rank);
        statement.setInt(3, privs);
        statement.execute();
    } catch (Exception e) {
        _log.warn("Could not store clan privs for rank: " + e);
        _log.error("", e);
    } finally {
        DbUtils.closeQuietly(con, statement);
    }
}

From source file:lineage2.gameserver.model.pledge.Clan.java

/**
 * Method getRankPrivs.//from   www . j a  va2 s .c o m
 * @param rank int
 * @return RankPrivs
 */
public RankPrivs getRankPrivs(int rank) {
    if ((rank < RANK_FIRST) || (rank > RANK_LAST)) {
        _log.warn("Requested invalid rank value: " + rank);
        Thread.dumpStack();
        return null;
    }
    if (_privs.get(rank) == null) {
        _log.warn("Request of rank before init: " + rank);
        Thread.dumpStack();
        setRankPrivs(rank, CP_NOTHING);
    }
    return _privs.get(rank);
}

From source file:lineage2.gameserver.model.pledge.Clan.java

/**
 * Method setRankPrivs./* w ww .  j a  va  2  s  .  c  o m*/
 * @param rank int
 * @param privs int
 */
public void setRankPrivs(int rank, int privs) {
    if ((rank < RANK_FIRST) || (rank > RANK_LAST)) {
        _log.warn("Requested set of invalid rank value: " + rank);
        Thread.dumpStack();
        return;
    }
    if (_privs.get(rank) != null) {
        _privs.get(rank).setPrivs(privs);
    } else {
        _privs.put(rank, new RankPrivs(rank, countMembersByRank(rank), privs));
    }
    Connection con = null;
    PreparedStatement statement = null;
    try {
        con = DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("REPLACE INTO clan_privs (clan_id,rank,privilleges) VALUES (?,?,?)");
        statement.setInt(1, getClanId());
        statement.setInt(2, rank);
        statement.setInt(3, privs);
        statement.execute();
    } catch (Exception e) {
        _log.warn("Could not store clan privs for rank: " + e);
        _log.error("", e);
    } finally {
        DbUtils.closeQuietly(con, statement);
    }
}

From source file:JNLPAppletLauncher.java

/**
 * Method called by an extension such as JOGL or Java 3D to load the
 * specified library. Applications and applets should not call this method.
 *
 * @param libraryName name of the library to be loaded
 *
 * @throws SecurityException if the caller does not have permission to
 * call System.load/*from   ww  w .  j  a  v a2 s. c om*/
 */
public static void loadLibrary(String libraryName) {
    if (VERBOSE) {
        System.err.println("-----------");
        Thread.dumpStack();
    }

    if (DEBUG) {
        System.err.println("JNLPAppletLauncher.loadLibrary(\"" + libraryName + "\")");
    }

    String fullLibraryName = (String) nativeLibMap.get(libraryName);
    if (fullLibraryName == null) {
        // Throw UnsatisfiedLinkError to try to match behavior of System.loadLibrary()
        throw new UnsatisfiedLinkError(libraryName);
    }

    if (DEBUG) {
        System.err.println("    loading: " + fullLibraryName + "");
    }

    System.load(fullLibraryName);
}

From source file:lineage2.gameserver.model.Player.java

/**
 * Method setClassId./*from w  w w .  j  a v  a 2  s  .  c  om*/
 * @param id int
 * @param noban boolean
 * @param bity boolean
 */
public synchronized void setClassId(final int id, boolean noban, boolean bity) {
    ClassId classId = ClassId.VALUES[id];
    if (!noban && !classId.equalsOrChildOf(ClassId.VALUES[getActiveClassId()])
            && !getVarB("awakenByStoneOfDestiny", false)
            && !(getPlayerAccess().CanChangeClass || Config.EVERYBODY_HAS_ADMIN_RIGHTS)) {
        Thread.dumpStack();
        return;
    }
    ClassId oldClassId = getClassId();
    if (!_subClassList.containsClassId(id)) {
        final SubClass cclass = getActiveSubClass();
        final int oldClass = cclass.getClassId();
        _subClassList.changeSubClassId(oldClass, id);
        changeClassInDb(oldClass, id,
                cclass.getDefaultClassId() == 0 ? getSubClassList().getBaseSubClass().getDefaultClassId()
                        : cclass.getDefaultClassId());
        if (cclass.isBase()) {
            addClanPointsOnProfession(id);
        }
        switch (classId) {
        case CARDINAL:
            ItemFunctions.addItem(this, 15307, 7, true);
            break;
        case EVAS_SAINT:
            ItemFunctions.addItem(this, 15308, 7, true);
            break;
        case SHILLIEN_SAINT:
            ItemFunctions.addItem(this, 15309, 7, true);
            break;
        default:
            break;
        }
        rewardSkills(true, false);
        storeCharSubClasses();
        broadcastCharInfo();
    }
    if ((oldClassId == null) || !oldClassId.isOfRace(getClassId().getRace())
            || !oldClassId.isOfType(getClassId().getType())) {
        PlayerTemplate t = PlayerTemplateHolder.getInstance().getPlayerTemplate(getRace(), classId,
                Sex.VALUES[getSex()]);
        if (t == null) {
            _log.error("Missing template for classId: " + id);
            return;
        }
        _template = t;
    }
    if (isInParty()) {
        getParty().broadCast(new PartySmallWindowUpdate(this));
    }
    if (getClan() != null) {
        getClan().broadcastToOnlineMembers(new PledgeShowMemberListUpdate(this));
    }
    if (_matchingRoom != null) {
        _matchingRoom.broadcastPlayerUpdate(this);
    }
    sendPacket(new ExSubjobInfo(this, true));
}