List of usage examples for java.util Map clear
void clear();
From source file:com.googlecode.ehcache.annotations.key.CachingReflectionHelper.java
public void clearCache() { final Map<Class<?>, Set<ImplementsMethod>> cache = this.getCache(); cache.clear(); }
From source file:com.denimgroup.threadfix.csv2ssl.serializer.RecordToXMLSerializer.java
public static String getFromExcel(XSSFWorkbook wb, String... format) { StringBuilder builder = getStart(); int line = Configuration.CONFIG.shouldSkipFirstLine ? 1 : 0; XSSFSheet ws = wb.getSheetAt(0); // read the first sheet int totalColumns = ws.getRow(0).getLastCellNum(); int totalRows = ws.getLastRowNum(); Map<String, String> rowMap = map(); for (; line <= totalRows; line++) { // we want <= because the index returned from ws.getLastRowNum() is valid XSSFRow row = ws.getRow(line);// ww w. j a va 2s . c o m for (int column = 0; column < totalColumns; column++) { XSSFCell cell = row.getCell(column); if (cell == null) { // cells are null if there's no data in them; this is fine. continue; } String value = cell.toString(); if (format.length > column) { rowMap.put(format[column], value); } else { System.err.println("format wasn't long enough for column. Column length = " + totalColumns + ", format was " + format.length); } } addRecord(builder, line, rowMap); rowMap.clear(); } return writeEnd(builder); }
From source file:cc.unlimitedbladeworks.biz.admin.impl.AdminManagerImpl.java
@Override public void init() { //???// ww w. ja v a2s . c o m Map<String, Object> map = new HashMap<>(); for (String key : BizKvTags.TAGS) { map.clear(); map.put(BizKvDO.keyStr, key); List<BizKvDO> list = bizKvDao.queryAll(map); if (null == list || list.isEmpty()) { BizKvDO bizKvDO = new BizKvDO(); bizKvDO.setDefaultInsertValue(); bizKvDO.setKey(key); bizKvDO.setValueInt(0); bizKvDao.insertItem(bizKvDO); } } }
From source file:com.blockwithme.longdb.leveldb.LevelDBDatabase.java
@Override protected void openInternal(final Map<Base36, LevelDBTable> theTables) { theTables.clear(); final String[] dataDirs = dbFolder.list(DirectoryFileFilter.INSTANCE); if (dataDirs != null) { for (final String dir : dataDirs) { final File path = getDir(dir); final LevelDBTable table = new LevelDBTable(this, path, Base36.get(dir), false); theTables.put(Base36.get(dir.toLowerCase()), table); }/*from ww w .j a v a2 s.c om*/ } }
From source file:net.kamhon.ieagle.util.MessageFactory.java
private void processIsAlwaysReload() { if (isAlwaysReload()) { // remove all object MESSAGE_RESOURCES.clear();//from w w w.j a v a 2s . co m Class<?> type = ResourceBundle.class; try { Field cacheList = type.getDeclaredField("cacheList"); cacheList.setAccessible(true); Map<?, ?> cache = (Map<?, ?>) cacheList.get(ResourceBundle.class); cache.clear(); log.debug("cache.size() = " + cache.size()); } catch (Exception ex) { log.fatal(ex, ex.fillInStackTrace()); } } }
From source file:com.liferay.ci.jenkins.cache.LiferayJenkinsBuildCache.java
public void clear(String portletId) { Map<String, JSONArray> portletCache = _getPortletCache(portletId); portletCache.clear(); }
From source file:cc.unlimitedbladeworks.dal.dao.BizKvDaoTest.java
/** * Test of updateItemByIdOrKey method, of class BizKvDao. *//*from w ww.java 2 s . c o m*/ @Test public void testUpdateItemByIdOrKey() { System.out.println("updateItemByIdOrKey"); Map<String, Object> map = new HashMap<>(); map.clear(); long now = new Date().getTime(); map.put(BizKvDO.gmtUpdateStr, now); map.put(BizKvDO.keyStr, "click"); map.put(BizKvDO.valueIntStr, 10); Integer expResult = null; Integer result = bizKvDao.updateItemByIdOrKey(map); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); }
From source file:cc.unlimitedbladeworks.dal.dao.BizKvDaoTest.java
/** * Test of addValueIntByIdOrKey method, of class BizKvDao. */// w w w .j ava2s.c o m @Test public void testAddValueIntByIdOrKey() { System.out.println("addValueIntByIdOrKey"); Map<String, Object> map = new HashMap<>(); map.clear(); long now = new Date().getTime(); map.put(BizKvDO.gmtUpdateStr, now); map.put(BizKvDO.keyStr, "click"); map.put(BizKvDO.valueIntStr, 1); Integer expResult = null; Integer result = bizKvDao.addValueIntByIdOrKey(map); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); }
From source file:com.blockwithme.longdb.leveldb.LevelDBBackend.java
@Override protected void openInternal(final Map<String, LevelDBDatabase> theDatabase) { theDatabase.clear(); try {/*from w ww . j av a2 s .c o m*/ final File dataRoot = new File(rootFolder); if (!dataRoot.exists()) FileUtils.forceMkdir(dataRoot); final String[] dataDirs = dataRoot.list(DirectoryFileFilter.INSTANCE); if (dataDirs != null && dataDirs.length > 0) { for (final String dir : dataDirs) { final String fullPath = dataRoot.getAbsolutePath() + File.separator + dir; final LevelDBDatabase bdb = new LevelDBDatabase(this, new File(fullPath), dir); theDatabase.put(dir.toLowerCase(), bdb); } } } catch (final Exception e) { throw new DBException("Error creating connection: " + theDatabase, e); } }
From source file:com.inmobi.conduit.local.LocalStreamServiceTest.java
public static ConduitConfig buildTestConduitConfig(String jturl, String hdfsurl, String rootdir, String retentioninhours, String trashretentioninhours) throws Exception { Map<String, Integer> sourcestreams = new HashMap<String, Integer>(); sourcestreams.put("cluster1", new Integer(retentioninhours)); Map<String, SourceStream> streamMap = new HashMap<String, SourceStream>(); streamMap.put("stream1", new SourceStream("stream1", sourcestreams, false)); sourcestreams.clear(); Map<String, DestinationStream> deststreamMap = new HashMap<String, DestinationStream>(); deststreamMap.put("stream1", new DestinationStream("stream1", Integer.parseInt(retentioninhours), Boolean.TRUE, false)); sourcestreams.clear();/*from www . j a v a2s . c om*/ /* * sourcestreams.put("cluster2", new Integer(2)); streamMap.put("stream2", * new SourceStream("stream2", sourcestreams)); */ Set<String> sourcestreamnames = new HashSet<String>(); for (Map.Entry<String, SourceStream> stream : streamMap.entrySet()) { sourcestreamnames.add(stream.getValue().getName()); } Map<String, Cluster> clusterMap = new HashMap<String, Cluster>(); clusterMap.put("cluster1", ClusterTest.buildLocalCluster(rootdir, "cluster1", hdfsurl, jturl, sourcestreamnames, deststreamMap)); Map<String, String> defaults = new HashMap<String, String>(); defaults.put(ConduitConfigParser.ROOTDIR, rootdir); defaults.put(ConduitConfigParser.RETENTION_IN_HOURS, retentioninhours); defaults.put(ConduitConfigParser.TRASH_RETENTION_IN_HOURS, trashretentioninhours); /* * clusterMap.put( "cluster2", ClusterTest.buildLocalCluster("cluster2", * "file:///tmp", conf.get("mapred.job.tracker"))); */ return new ConduitConfig(streamMap, clusterMap, defaults); }