Example usage for java.util Hashtable values

List of usage examples for java.util Hashtable values

Introduction

In this page you can find the example usage for java.util Hashtable values.

Prototype

Collection values

To view the source code for java.util Hashtable values.

Click Source Link

Usage

From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java

public synchronized void updateState() {
    final TileCache tileCache = JAI.getDefaultInstance().getTileCache();

    int selectedIndex = tabbedPane.getSelectedIndex();
    //System.out.println("selectedIndex = " + selectedIndex);

    if (selectedIndex == 1) {
        // (1) if graph view visible
        if (tileCache instanceof CacheDiagnostics) {
            CacheDiagnostics cacheDiagnostics = (CacheDiagnostics) tileCache;
            cacheDiagnostics.enableDiagnostics();
            final Millisecond t = new Millisecond();
            update(0, t, cacheDiagnostics.getCacheTileCount());
            update(1, t, cacheDiagnostics.getCacheHitCount());
            update(2, t, cacheDiagnostics.getCacheMissCount());
            update(3, t, cacheDiagnostics.getCacheMemoryUsed() / 1024);
        }//from ww  w  .  j  a  v a2 s .c om
    } else if (selectedIndex == 2) {
        // (2) if table view visible
        if (tileCache instanceof SunTileCache) {
            SunTileCache stc = (SunTileCache) tileCache;
            synchronized (stc) {
                Hashtable cachedObject = (Hashtable) stc.getCachedObject();
                Collection<CachedTile> tiles = cachedObject.values();
                //                dumpImageTree(tiles);
                updateTableModel(tiles);
            }
        }
    } else if (selectedIndex == 0) {
        // (3) if info view visible
        StringBuilder sb = new StringBuilder();
        if (tileCache != null) {

            sb.append("tileCache.memoryCapacity: \t");
            sb.append(tileCache.getMemoryCapacity() / (1024 * 1024));
            sb.append(" MB\n");

            sb.append("tileCache.memoryThreshold: \t");
            sb.append(tileCache.getMemoryThreshold());
            sb.append("\n");

            sb.append("tileCache.tileComparator: \t");
            sb.append(tileCache.getTileComparator());
            sb.append("\n");

            sb.append("tileCache.class: \t");
            sb.append(tileCache.getClass().getName());
            sb.append("\n");
        }
        if (tileCache instanceof SunTileCache) {
            SunTileCache sunTileCache = (SunTileCache) tileCache;

            sb.append("sunTileCache.cacheMemoryUsed: \t");
            sb.append(sunTileCache.getCacheMemoryUsed() / (1024 * 1024));
            sb.append(" MB\n");

            sb.append("sunTileCache.cacheHitCount: \t");
            sb.append(sunTileCache.getCacheHitCount());
            sb.append("\n");

            sb.append("sunTileCache.cacheMissCount: \t");
            sb.append(sunTileCache.getCacheMissCount());
            sb.append("\n");

            sb.append("sunTileCache.cacheTileCount: \t");
            sb.append(sunTileCache.getCacheTileCount());
            sb.append("\n");
        }
        textarea.setText(sb.toString());
    }
}

From source file:net.timbusproject.extractors.debiansoftwareextractor.Engine.java

private JSONObject extractInstalledPackages()
        throws JSchException, InterruptedException, JSONException, IOException {
    if (isSsh()) {
        log.info("Connecting to " + sshManager.getHost() + ":" + sshManager.getPort() + "...");
        try {//from   w  ww  . j  av  a  2  s .c om
            sshManager.connect();
        } catch (JSchException e) {
            log.error("Connection failed.");
            throw e;
        }
    }
    log.info("Starting installed packages extraction...");

    if (((ch.qos.logback.classic.Logger) log).getLevel().equals(Level.INFO))
        log.info("Extracting...");
    log.debug("Extracting installed packages...");
    Hashtable<String, JSONObject> table = extractAllDpkgPackages();
    log.debug("Extracting licenses...");
    extractLicenses(table);
    log.debug("Extracting installers...");
    extractInstallers(table);
    JSONObject extraction = newExtraction(table.values());

    log.info("Extraction finished.");
    if (isSsh()) {
        log.info("Closing connection from " + sshManager.getHost() + ":" + sshManager.getPort() + "...");
        sshManager.disconnect();
    }

    return extraction;
}

From source file:com.smartitengineering.dao.impl.hibernate.AbstractDAO.java

protected List<Template> readList(Class entityClass, Hashtable<String, QueryParameter> parameter) {
    return readList(entityClass, parameter.values().toArray(new QueryParameter[0]));
}

From source file:edu.ku.brc.af.ui.forms.persist.ViewLoader.java

/**
 * Re-maps and clones the definitions./*from   w  w  w  .j a v a  2  s .co m*/
 * @param viewDefs the hash table to be mapped
 * @throws Exception
 */
public static void mapDefinitionViewDefs(final Hashtable<String, ViewDefIFace> viewDefs) throws Exception {
    // Now that all the definitions have been read in
    // cycle thru and have all the tableform objects clone there definitions
    for (ViewDefIFace viewDef : new Vector<ViewDefIFace>(viewDefs.values())) {
        if (viewDef.getType() == ViewDefIFace.ViewType.formtable) {
            String viewDefName = ((FormViewDefIFace) viewDef).getDefinitionName();
            if (viewDefName != null) {
                //log.debug(viewDefName);
                ViewDefIFace actualDef = viewDefs.get(viewDefName);
                if (actualDef != null) {
                    viewDefs.remove(viewDef.getName());
                    actualDef = (ViewDef) actualDef.clone();
                    actualDef.setType(ViewDefIFace.ViewType.formtable);
                    actualDef.setName(viewDef.getName());
                    viewDefs.put(actualDef.getName(), actualDef);

                } else {
                    String msg = "Couldn't find the ViewDef for formtable definition name["
                            + ((FormViewDefIFace) viewDef).getDefinitionName() + "]";
                    log.error(msg);
                    FormDevHelper.appendFormDevError(msg);
                }
            }
        }
    }
}

From source file:com.smartitengineering.dao.impl.hibernate.AbstractDAO.java

protected Object readOther(Class entityClass, Hashtable<String, QueryParameter> parameter) {
    return readOther(entityClass, parameter.values().toArray(new QueryParameter[0]));
}

From source file:com.smartitengineering.dao.impl.hibernate.AbstractDAO.java

protected Template readSingle(Class entityClass, Hashtable<String, QueryParameter> parameter) {
    return readSingle(entityClass, parameter.values().toArray(new QueryParameter[0]));
}

From source file:com.smartitengineering.dao.impl.hibernate.AbstractDAO.java

protected List<? extends Object> readOtherList(Class entityClass, Hashtable<String, QueryParameter> parameter) {
    return readOtherList(entityClass, parameter.values().toArray(new QueryParameter[0]));
}

From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java

/**
 * force shutdown everything/*w w  w  .  j a  va  2 s . c o  m*/
 */
public synchronized void shutdownDbmsPools() {
    //force shutdown
    //runnable
    datasourceCleaner.shutdown();
    datasourceCleaner = null;
    //shell for the runnable
    cleanerThread.interrupt();//stop the thread
    cleanerThread = null;

    if (dbmsPoolTable == null) {
        return;
    }
    Enumeration<String> allDbmsKeys = dbmsPoolTable.keys();
    while (allDbmsKeys.hasMoreElements()) {
        String dbmsKey = allDbmsKeys.nextElement();
        PooledDataSourceProvider provider = this.getProvider(dbmsKey);
        Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsKey);
        for (DataSource ds : dsTable.values()) {
            try {
                provider.closePooledDataSource(ds);
            } catch (SQLException e) {
                //          todo          logger.error("Failed to close datasource in dbms poolKey = "
                //                            + dbmsKey);
            }
        }
        dsTable.clear();
    }
    dbmsPoolTable.clear();
    dbmsPoolTable = null;
}

From source file:com.easemob.qixin.activity.ContactlistFragment.java

/**
 * ??/*from w  w  w .j  a  v  a 2 s.  c o  m*/
 * 
 * @param context
 * @return +
 */
private List<QXUser> loadConversationsWithRecentChat() {

    Hashtable<String, EMConversation> conversations = EMChatManager.getInstance().getAllConversations();
    // messages size0conversation
    /**
     * ??lastMsgTime?? ??Collection.sort
     * ??ConversationSort????? ???
     */
    List<Pair<Long, String>> sortList = new ArrayList<Pair<Long, String>>();
    synchronized (conversations) {
        for (EMConversation conversation : conversations.values()) {
            if (conversation.getAllMessages().size() != 0) {
                sortList.add(new Pair<Long, String>(conversation.getLastMessage().getMsgTime(),
                        conversation.getUserName()));
            }
        }
    }
    try {
        // Internal is TimSort algorithm, has bug
        sortConversationByLastChatTime(sortList);
    } catch (Exception e) {
        e.printStackTrace();
    }
    list.clear();
    for (Pair<Long, String> sortItem : sortList) {
        for (QXUser user : DemoApplication.getInstance().getAllUsers()) {
            if (user.getHXid().equals(sortItem.second)) {
                list.add(user);
            }
        }
    }
    return list;
}

From source file:org.scify.NewSumServer.Server.Utils.Main.java

private static void parseCommandLine(String[] args) {
    // Parse command line
    Hashtable hSwitches;
    hSwitches = utils.parseCommandLineSwitches(args);

    sPathToSources = utils.getSwitch(hSwitches, "PathToSources", sPathToSources);
    sBaseDir = addSuffix(utils.getSwitch(hSwitches, "BaseDir", sBaseDir));
    sindexPath = addSuffix(utils.getSwitch(hSwitches, "indexPath", sindexPath));
    sSummaryPath = addSuffix(utils.getSwitch(hSwitches, "SummaryPath", sSummaryPath));
    sArticlePath = addSuffix(utils.getSwitch(hSwitches, "ArticlePath", sArticlePath));
    sToolPath = addSuffix(utils.getSwitch(hSwitches, "ToolPath", sToolPath));
    iOutputSize = Integer.valueOf(utils.getSwitch(hSwitches, "outputSize", String.valueOf(iOutputSize)))
            .intValue();//  w ww . j  av  a 2s. c  o m
    iArticleDays = Integer.valueOf(utils.getSwitch(hSwitches, "ArticleMaxDays", String.valueOf(iArticleDays)))
            .intValue();
    bUseInputDirData = Boolean.valueOf(utils.getSwitch(hSwitches, "useInputDirData", Boolean.FALSE.toString()));
    bDebugRun = Boolean.valueOf(utils.getSwitch(hSwitches, "DebugRun", Boolean.FALSE.toString()));
    NVSThreshold = Double.valueOf(utils.getSwitch(hSwitches, "NVSThreshold", "0.20"));
    SSThreshold = Double.valueOf(utils.getSwitch(hSwitches, "SSThreshold", "0.10"));
    //checking user input
    checkPaths(hSwitches.values().toArray()); // Check Switches
}