List of usage examples for java.util.concurrent ConcurrentHashMap size
public int size()
From source file:hu.sztaki.lpds.pgportal.services.asm.ASMService.java
public String getRuntimeID(String userID, String workflowID) { ConcurrentHashMap runtimes = ((ConcurrentHashMap) PortalCacheService.getInstance().getUser(userID) .getWorkflow(workflowID).getAllRuntimeInstance()); if (runtimes.size() > 0) { Object firstID = runtimes.keySet().iterator().next(); return firstID.toString(); }/* w w w . ja va 2s.c om*/ return null; }
From source file:com.pari.nm.utils.db.InventoryDBHelper.java
public static void insertExternalDeviceDetails(int nccmId, int customerId, String ipAddress, Long externalId, String serviceName, int wingId, boolean replace) throws Exception { Connection c = DBHelper.getConnection(); PreparedStatement ps = null;/*www . j av a2 s.c om*/ try { ConcurrentHashMap<Integer, String> nodeMap = getExternalNodeInfo(serviceName, externalId); if (nodeMap != null && nodeMap.size() > 0) { if (replace) { try { String query = "delete from external_device where EXTERNAL_ID=" + externalId + " and SERVICE_NAME='" + serviceName + "'"; DBHelper.executeUpdate(query); } catch (Exception ex) { logger.error("Exception while deleting external_device: EXTERNAL_ID=" + externalId + " and SERVICE_NAME='" + serviceName + "'", ex); } } else { throw new Exception("An Entry already Exist with the same EXTERNALID=" + externalId + " and SERVICENAME='" + serviceName + "'"); } } } catch (SQLException e) { logger.error("Exception while retrieving external_device: EXTERNAL_ID=" + externalId + " and SERVICE_NAME='" + serviceName + "'", e); } try { ps = c.prepareStatement( "insert into external_device(NCCM_ID, CUSTOMER_ID, IPADDRESS, EXTERNAL_ID, SERVICE_NAME, WING_INSTANCE_ID) values (?,?,?,?,?,?)"); ps.setInt(1, nccmId); ps.setInt(2, customerId); ps.setString(3, ipAddress); ps.setLong(4, externalId); ps.setString(5, serviceName); ps.setInt(6, wingId); ps.executeUpdate(); } catch (Exception ex) { ex.printStackTrace(); } finally { try { ps.close(); } catch (Exception ex) { } DBHelper.releaseConnection(c); } }