/** * Closes given {@link #transportManagers} of this <tt>Conference</tt> and removes corresponding * channel bundle. */ void closeTransportManager(TransportManager transportManager) { synchronized (transportManagers) { for (Iterator<IceUdpTransportManager> i = transportManagers.values().iterator(); i.hasNext(); ) { if (i.next() == transportManager) { i.remove(); // Presumably, we have a single association for // transportManager. break; } } // Close manager try { transportManager.close(); } catch (Throwable t) { logger.warn( "Failed to close an IceUdpTransportManager of" + " conference " + getID() + "!", t); // The whole point of explicitly closing the // transportManagers of this Conference is to prevent memory // leaks. Hence, it does not make sense to possibly leave // TransportManagers open because a TransportManager has // failed to close. if (t instanceof InterruptedException) Thread.currentThread().interrupt(); else if (t instanceof ThreadDeath) throw (ThreadDeath) t; } } }
private void deleteJsonJobs(ApplicationInfo appInfo, List<CIJob> selectedJobs) throws PhrescoException { try { if (CollectionUtils.isEmpty(selectedJobs)) { return; } Gson gson = new Gson(); List<CIJob> jobs = getJobs(appInfo); if (CollectionUtils.isEmpty(jobs)) { return; } // all values Iterator<CIJob> iterator = jobs.iterator(); // deletable values for (CIJob selectedInfo : selectedJobs) { while (iterator.hasNext()) { CIJob itrCiJob = iterator.next(); if (itrCiJob.getName().equals(selectedInfo.getName())) { iterator.remove(); break; } } } writeJsonJobs(appInfo, jobs, CI_CREATE_NEW_JOBS); } catch (Exception e) { throw new PhrescoException(e); } }
private void rm(Channel chan) { synchronized (chls) { for (Iterator<DarkChannel> i = chls.iterator(); i.hasNext(); ) { DarkChannel c = i.next(); if (c.chan == chan) i.remove(); } } }
String filter(String[] args, boolean include) { verifyCommand(args, String.format(_filterHelp, args[0]), null, 3, 3); Collection<String> list = new ArrayList<String>(Processor.split(args[1])); Pattern pattern = Pattern.compile(args[2]); for (Iterator<String> i = list.iterator(); i.hasNext(); ) { if (pattern.matcher(i.next()).matches() == include) i.remove(); } return Processor.join(list); }
/** Closes the {@link #transportManagers} of this <tt>Conference</tt>. */ private void closeTransportManagers() { synchronized (transportManagers) { for (Iterator<IceUdpTransportManager> i = transportManagers.values().iterator(); i.hasNext(); ) { IceUdpTransportManager transportManager = i.next(); i.remove(); closeTransportManager(transportManager); } } }
public void drawsmall(GOut g, Coord br, int h) { Coord c; if (qline != null) { if ((rqline == null) || !rqline.text.equals(qline.line)) { String pre = String.format("%s> ", qline.chan.name()); rqline = qfnd.render(pre + qline.line); rqpre = pre.length(); } c = br.sub(0, 20); g.chcolor(24, 24, 16, 200); g.frect(c, rqline.tex().sz()); g.chcolor(); g.image(rqline.tex(), c); int lx = rqline.advance(qline.point + rqpre); g.line(new Coord(br.x + lx + 1, br.y - 18), new Coord(br.x + lx + 1, br.y - 6), 1); } else { c = br.sub(0, 5); } long now = System.currentTimeMillis(); synchronized (notifs) { for (Iterator<Notification> i = notifs.iterator(); i.hasNext(); ) { Notification n = i.next(); if (now - n.time > 5000) { i.remove(); continue; } if ((c.y -= n.msg.sz().y) < br.y - h) break; g.chcolor(24, 24, 16, 200); g.frect(c, n.chnm.tex().sz().add(n.msg.tex().sz().x + selw, 0)); g.chcolor(); g.image(n.chnm.tex(), c, br.sub(0, h), br.add(selw - 10, 0)); g.image(n.msg.tex(), c.add(selw, 0)); } } }