List of usage examples for java.util.concurrent CopyOnWriteArraySet CopyOnWriteArraySet
public CopyOnWriteArraySet(Collection<? extends E> c)
From source file:org.apache.bval.jsr.xml.ValidationParser.java
public static ValidationParser processValidationConfig(final String file, final ConfigurationImpl targetConfig, final boolean ignoreXml) { final ValidationParser parser = new ValidationParser(); if (!ignoreXml) { parser.xmlConfig = parseXmlConfig(file); }// w ww . j a v a 2 s.c o m if (parser.xmlConfig != null) { if (parser.xmlConfig.getExecutableValidation() == null) { final ExecutableValidationType value = new ExecutableValidationType(); value.setEnabled(true); final DefaultValidatedExecutableTypesType defaultValidatedExecutableTypes = new DefaultValidatedExecutableTypesType(); value.setDefaultValidatedExecutableTypes(defaultValidatedExecutableTypes); defaultValidatedExecutableTypes.getExecutableType().add(ExecutableType.CONSTRUCTORS); defaultValidatedExecutableTypes.getExecutableType().add(ExecutableType.NON_GETTER_METHODS); parser.xmlConfig.setExecutableValidation(value); } applySimpleConfig(parser.xmlConfig, targetConfig); parser.bootstrap = new BootstrapConfigurationImpl(parser.xmlConfig.getDefaultProvider(), parser.xmlConfig.getConstraintValidatorFactory(), parser.xmlConfig.getMessageInterpolator(), parser.xmlConfig.getTraversableResolver(), parser.xmlConfig.getParameterNameProvider(), new CopyOnWriteArraySet<String>(parser.xmlConfig.getConstraintMapping()), parser.xmlConfig.getExecutableValidation().getEnabled(), new CopyOnWriteArraySet<ExecutableType>(targetConfig.getExecutableValidation()), toMap(parser.xmlConfig.getProperty())); return parser; } else { // default config final CopyOnWriteArraySet<ExecutableType> executableTypes = new CopyOnWriteArraySet<ExecutableType>(); executableTypes.add(ExecutableType.CONSTRUCTORS); executableTypes.add(ExecutableType.NON_GETTER_METHODS); parser.bootstrap = new BootstrapConfigurationImpl(null, null, null, null, null, new CopyOnWriteArraySet<String>(), true, executableTypes, new HashMap<String, String>()); targetConfig.setExecutableValidation(executableTypes); } return parser; }
From source file:org.apache.ranger.biz.SessionMgr.java
public void resetUserModulePermission(UserSessionBase userSession) { XXUser xUser = daoManager.getXXUser().findByUserName(userSession.getLoginId()); if (xUser != null) { List<String> permissionList = daoManager.getXXModuleDef() .findAccessibleModulesByUserId(userSession.getUserId(), xUser.getId()); CopyOnWriteArraySet<String> userPermissions = new CopyOnWriteArraySet<String>(permissionList); UserSessionBase.RangerUserPermission rangerUserPermission = userSession.getRangerUserPermission(); if (rangerUserPermission == null) { rangerUserPermission = new UserSessionBase.RangerUserPermission(); }//from w ww. ja v a 2 s .co m rangerUserPermission.setUserPermissions(userPermissions); rangerUserPermission.setLastUpdatedTime(Calendar.getInstance().getTimeInMillis()); userSession.setRangerUserPermission(rangerUserPermission); logger.info("UserSession Updated to set new Permissions to User: " + userSession.getLoginId()); } else { logger.error("No XUser found with username: " + userSession.getLoginId() + "So Permission is not set for the user"); } }
From source file:org.jiemamy.utils.collection.CollectionsUtil.java
/** * {@link CopyOnWriteArraySet}?????//from ww w.j ava 2 s. c o m * * @param <E> {@link CopyOnWriteArraySet}?? * @param c * @return {@link CopyOnWriteArraySet}??? * @throws IllegalArgumentException ?{@code null}??? * @see CopyOnWriteArraySet#CopyOnWriteArraySet(Collection) */ public static <E> CopyOnWriteArraySet<E> newCopyOnWriteArraySet(Collection<? extends E> c) { Validate.notNull(c); return new CopyOnWriteArraySet<E>(c); }
From source file:org.diorite.impl.DioriteCore.java
@Override public Collection<Player> getOnlinePlayers() { return new CopyOnWriteArraySet<>(this.playersManager.getRawPlayers().values()); }
From source file:com.google.dexmaker.ProxyBuilder.java
private static <T> Set<T> asSet(T... array) { return new CopyOnWriteArraySet<T>(Arrays.asList(array)); }
From source file:org.apache.cxf.cwiki.SiteExporter.java
public void loadPages() throws Exception { Document doc = DOMUtils.newDocument(); Element el = doc.createElementNS(SOAPNS, "ns1:getPages"); Element el2 = doc.createElement("in0"); el.appendChild(el2);/*from w w w . ja v a2s . c o m*/ el2.setTextContent(loginToken); el2 = doc.createElement("in1"); el.appendChild(el2); el2.setTextContent(spaceKey); doc.appendChild(el); doc = getDispatch().invoke(doc); Set<String> allPages = new CopyOnWriteArraySet<String>(pages.keySet()); Set<Page> newPages = new CopyOnWriteArraySet<Page>(); List<Future<?>> futures = new ArrayList<Future<?>>(allPages.size()); // XMLUtils.printDOM(doc.getDocumentElement()); Node nd = doc.getDocumentElement().getFirstChild().getFirstChild(); while (nd != null) { if (nd instanceof Element) { futures.add(loadPage((Element) nd, allPages, newPages)); } nd = nd.getNextSibling(); } for (Future<?> f : futures) { //wait for all the pages to be done f.get(); } for (Page p : newPages) { //pages have been added, need to check checkForChildren(p); } for (String id : allPages) { //these pages have been deleted Page p = pages.remove(id); checkForChildren(p); File file = new File(outputDir, p.createFileName()); if (file.exists()) { callSvn("rm", file.getAbsolutePath()); svnCommitMessage.append("Deleted: " + file.getName() + "\n"); } if (file.exists()) { file.delete(); } } while (checkIncludes()) { // nothing } }