/** * @return A copy of the CheckedNamespace. */ private synchronized Set<String> getCheckedNamespace() { @SuppressWarnings("unchecked") final Set<String> result = (Set<String>) checkedNamespaces.clone(); return result; }
Collection getSuspendedEnvironments() { return (Collection) suspendedEnvironments.clone(); }
@SuppressWarnings("unchecked") public Set<String> getEphemerals(long sessionId) { HashSet<String> retv = ephemerals.get(sessionId); if (retv == null) { return new HashSet<String>(); } Set<String> cloned = null; synchronized (retv) { cloned = (HashSet<String>) retv.clone(); } return cloned; }
@SuppressWarnings("unchecked") public HashSet<String> getEphemerals(long sessionId) { HashSet<String> retv = ephemerals.get(sessionId); if (retv == null) { return new HashSet<String>(); } HashSet<String> cloned = null; synchronized (retv) { cloned = (HashSet<String>) retv.clone(); } return cloned; }
@SuppressWarnings("unchecked") public HashSet<String> getEphemerals(long sessionId) { HashSet<String> retv = ephemerals.get(sessionId); if (retv == null) { return new HashSet<String>(); } HashSet<String> cloned = null; synchronized(retv) { cloned = (HashSet<String>) retv.clone(); } return cloned; }
private static <T> boolean equalSets(Set<T> set1, Set<T> set2) { boolean isEqual = true; if (set1.size() != set2.size()) { System.out.println("sizes different: " + set1.size() + " vs. " + set2.size()); isEqual = false; } Set<T> newSet1 = (Set<T>) ((HashSet<T>) set1).clone(); newSet1.removeAll(set2); if (newSet1.size() > 0) { isEqual = false; System.out.println("set1 left with: " + newSet1); } Set<T> newSet2 = (Set<T>) ((HashSet<T>) set2).clone(); newSet2.removeAll(set1); if (newSet2.size() > 0) { isEqual = false; System.out.println("set2 left with: " + newSet2); } return isEqual; }
@Override public void copyToNewInstance(Object newInstance) throws UDFArgumentException { super.copyToNewInstance(newInstance); // Asserts the class invariant. (Same types.) GenericUDFInFile that = (GenericUDFInFile)newInstance; if (that != this) { that.set = (this.set == null ? null : (HashSet<String>)this.set.clone()); that.strObjectInspector = this.strObjectInspector; that.fileObjectInspector = this.fileObjectInspector; } }
/** * Returns a new {@code AttributedIterator} with the same source string, * begin, end, and current index as this attributed iterator. * * @return a shallow copy of this attributed iterator. * @see java.lang.Cloneable */ @Override @SuppressWarnings("unchecked") public Object clone() { try { AttributedIterator clone = (AttributedIterator) super.clone(); if (attributesAllowed != null) { clone.attributesAllowed = (HashSet<Attribute>) attributesAllowed .clone(); } return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }
public void deleteTopicPartitionGroup(TopicPartitionGroup topicPartitioGroup) throws IOException { HashSet<LogFilePath> paths = mFiles.get(topicPartitioGroup); if (paths == null) { return; } HashSet<LogFilePath> clonedPaths = (HashSet<LogFilePath>) paths.clone(); for (LogFilePath path : clonedPaths) { deletePath(path); } }
@Override public void copyToNewInstance(Object newInstance) throws UDFArgumentException { super.copyToNewInstance(newInstance); // Asserts the class invariant. (Same types.) GenericUDFInFile that = (GenericUDFInFile)newInstance; if (that != this) { that.set = (this.set == null ? null : (HashSet<String>)this.set.clone()); that.strObjectInspector = this.strObjectInspector; that.fileObjectInspector = this.fileObjectInspector; } }
CriticalSection(CriticalSection tn) { super(tn); this.IDNum = tn.IDNum; this.nestLevel = tn.nestLevel; this.origLock = tn.origLock; this.read = new CodeBlockRWSet(); this.read.union(tn.read); this.write = new CodeBlockRWSet(); this.write.union(tn.write); this.invokes = (HashSet<Unit>) tn.invokes.clone(); this.units = (HashSet<Unit>) tn.units.clone(); this.unitToRWSet = (HashMap<Unit, CodeBlockRWSet>) tn.unitToRWSet.clone(); this.unitToUses = (HashMap<Unit, List>) tn.unitToUses.clone(); this.wholeMethod = tn.wholeMethod; this.method = tn.method; this.setNumber = tn.setNumber; this.group = tn.group; this.edges = (HashSet<CriticalSectionDataDependency>) tn.edges.clone(); this.waits = (HashSet<Unit>) tn.waits.clone(); this.notifys = (HashSet<Unit>) tn.notifys.clone(); this.transitiveTargets = (HashSet<MethodOrMethodContext>) (tn.transitiveTargets == null ? null : tn.transitiveTargets.clone()); this.lockObject = tn.lockObject; this.lockObjectArrayIndex = tn.lockObjectArrayIndex; this.lockset = tn.lockset; }
/** * clear all the connections in the selector * */ @Override @SuppressWarnings("unchecked") synchronized public void closeAll() { selector.wakeup(); HashSet<NIOServerCnxn> cnxns; synchronized (this.cnxns) { cnxns = (HashSet<NIOServerCnxn>)this.cnxns.clone(); } // got to clear all the connections that we have in the selector for (NIOServerCnxn cnxn: cnxns) { try { // don't hold this.cnxns lock as deadlock may occur cnxn.close(); } catch (Exception e) { LOG.warn("Ignoring exception closing cnxn sessionid 0x" + Long.toHexString(cnxn.sessionId), e); } } }
/** Notify all waiters that this task has finished. * @see #run */ protected final void notifyFinished() { Iterator it; synchronized (this) { finished = true; RequestProcessor.logger().log(Level.FINE, "notifyFinished: {0}", this); // NOI18N notifyAll(); // fire the listeners if (list == null) { return; } it = ((HashSet) list.clone()).iterator(); } while (it.hasNext()) { TaskListener l = (TaskListener) it.next(); l.taskFinished(this); } }
@SuppressWarnings("unchecked") @Override public void commandRun() { if (!isZKServerRunning()) { pw.println(ZK_NOT_SERVING); } else { // clone should be faster than iteration // ie give up the cnxns lock faster HashSet<NIOServerCnxn> cnxns; synchronized (factory.cnxns) { cnxns = (HashSet<NIOServerCnxn>) factory.cnxns.clone(); } for (NIOServerCnxn c : cnxns) { c.dumpConnectionInfo(pw, false); pw.println(); } pw.println(); } } }
@SuppressWarnings("unchecked") @Override public RoutingRequest clone() { try { RoutingRequest clone = (RoutingRequest) super.clone(); clone.bannedRoutes = bannedRoutes.clone(); clone.bannedTrips = (HashMap<FeedScopedId, BannedStopSet>) bannedTrips.clone(); clone.bannedStops = bannedStops.clone(); clone.bannedStopsHard = bannedStopsHard.clone(); clone.whiteListedAgencies = (HashSet<String>) whiteListedAgencies.clone(); clone.whiteListedRoutes = whiteListedRoutes.clone(); clone.preferredAgencies = (HashSet<String>) preferredAgencies.clone(); clone.preferredRoutes = preferredRoutes.clone(); if (this.bikeWalkingOptions != this) clone.bikeWalkingOptions = this.bikeWalkingOptions.clone(); else clone.bikeWalkingOptions = clone; return clone; } catch (CloneNotSupportedException e) { /* this will never happen since our super is the cloneable object */ throw new RuntimeException(e); } }
synchronized(factory.cnxns){ cnxnset = (HashSet<NIOServerCnxn>)factory .cnxns.clone();
HashSet<H2ONode> nodes = (HashSet<H2ONode>)H2O.STATIC_H2OS.clone(); nodes.addAll(Paxos.PROPOSED.values()); bb.mark();
/** * Safely add a vertex to this area. This creates edges to all other vertices unless those edges would cross one of the original edges. */ public void addVertex(IntersectionVertex newVertex, Graph graph) { GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); if (edges.size() == 0) { throw new RuntimeException("Can't add a vertex to an empty area"); } @SuppressWarnings("unchecked") HashSet<IntersectionVertex> verticesCopy = (HashSet<IntersectionVertex>) vertices.clone(); VERTEX: for (IntersectionVertex v : verticesCopy) { LineString newGeometry = geometryFactory.createLineString(new Coordinate[] { newVertex.getCoordinate(), v.getCoordinate() }); // ensure that new edge does not leave the bounds of the original area, or // fall into any holes if (!originalEdges.union(originalEdges.getBoundary()).contains(newGeometry)) { continue VERTEX; } // check to see if this splits multiple NamedAreas. This code is rather similar to // code in OSMGBI, but the data structures are different createSegments(newVertex, v, areas, graph); } vertices.add(newVertex); }
@SuppressWarnings("unchecked") @Override public IParser setDontStripVersionsFromReferencesAtPaths(Collection<String> thePaths) { if (thePaths == null) { myDontStripVersionsFromReferencesAtPaths = Collections.emptySet(); } else if (thePaths instanceof HashSet) { myDontStripVersionsFromReferencesAtPaths = (Set<String>) ((HashSet<String>) thePaths).clone(); } else { myDontStripVersionsFromReferencesAtPaths = new HashSet<>(thePaths); } return this; }
/** * A clone of the Set of elements that can have their close-tags omitted. By * default it should be "AREA", "BASE", "BR", "COL", "HR", "IMG", "INPUT", * "LINK", "META", "P", "PARAM" * * @return A clone of the Set. */ public Set<String> getOmitElementCloseSet() { return (Set<String>) (internalGetOmitElementCloseSet().clone()); }