Examples of CopyOnWriteList


Examples of hudson.util.CopyOnWriteList

     * to cascadingJobProperties set.
     *
     * @param properties list of {@link JobProperty}
     */
    private void convertCascadingJobProperties(CopyOnWriteList<JobProperty<? super JobT>> properties) {
        CopyOnWriteList parameterDefinitionProperties = new CopyOnWriteList();
        for (JobProperty property : properties) {
            if (property instanceof AuthorizationMatrixProperty) {
                continue;
            }
            if (property instanceof ParametersDefinitionProperty) {
                parameterDefinitionProperties.add(property);
                continue;
            }
            BaseProjectProperty projectProperty = CascadingUtil.getBaseProjectProperty(this,
                property.getDescriptor().getJsonSafeClassName());
            addCascadingJobProperty(projectProperty);
View Full Code Here

Examples of hudson.util.CopyOnWriteList

    /**
     * @return list of cascading {@link JobProperty} instances. Includes {@link ParametersDefinitionProperty} and
     *         children of {@link JobProperty} from external plugins.
     */
    private CopyOnWriteList getCascadingJobProperties() {
        CopyOnWriteList result = new CopyOnWriteList();
        CopyOnWriteList<ParametersDefinitionProperty> definitionProperties = getParameterDefinitionProperties();
        if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) {
            for (String key : cascadingJobProperties) {
                IProjectProperty projectProperty = CascadingUtil.getProjectProperty(this, key);
                Object value = projectProperty.getValue();
                if (null != value) {
                    result.add(value);
                }
            }
        }
        if (null != definitionProperties && !definitionProperties.isEmpty()) {
            result.addAll(definitionProperties.getView());
        }
        return result;
    }
View Full Code Here

Examples of hudson.util.CopyOnWriteList

        JobProperty jobProperty = (JobProperty) jobProp;
        jobProperty.setOwner(this);
        if (jobProperty instanceof AuthorizationMatrixProperty) {
            properties.add(jobProp);
        } else if (jobProperty instanceof ParametersDefinitionProperty) {
            CopyOnWriteList list = CascadingUtil.getCopyOnWriteListProjectProperty(this,
                PARAMETERS_DEFINITION_JOB_PROPERTY_PROPERTY_NAME).getOriginalValue();
            if (null != list) {
                list.add(jobProp);
            }
        } else {
            BaseProjectProperty projectProperty = CascadingUtil.getBaseProjectProperty(this,
                jobProperty.getDescriptor().getJsonSafeClassName());
            projectProperty.setValue(jobProperty);
View Full Code Here

Examples of hudson.util.CopyOnWriteList

    public void removeProperty(JobProperty<? super JobT> jobProp) throws IOException {
        JobProperty jobProperty = (JobProperty) jobProp;
        if (jobProperty instanceof AuthorizationMatrixProperty) {
            properties.remove(jobProp);
        } else if (jobProperty instanceof ParametersDefinitionProperty) {
            CopyOnWriteList list = CascadingUtil.getCopyOnWriteListProjectProperty(this,
                PARAMETERS_DEFINITION_JOB_PROPERTY_PROPERTY_NAME).getOriginalValue();
            if (null != list) {
                list.remove(jobProp);
            }
        } else {
            removeCascadingJobProperty(jobProperty.getDescriptor().getJsonSafeClassName());
        }
        save();
View Full Code Here

Examples of hudson.util.CopyOnWriteList

     * List contains cascadable {@link JobProperty} if any.
     * @since 2.2.0
     */
    @Exported(name = "property", inline = true)
    public List<JobProperty<? super JobT>> getAllProperties() {
        CopyOnWriteList cascadingJobProperties = getCascadingJobProperties();
        List<JobProperty<? super JobT>> result = properties.getView();
        if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) {
            result = Collections.unmodifiableList(ListUtils.union(result, cascadingJobProperties.getView()));
        }
        return result;
    }
View Full Code Here

Examples of hudson.util.CopyOnWriteList

        JSONObject json = req.getSubmittedForm();
        description = req.getParameter("description");
        keepDependencies = req.getParameter("keepDependencies") != null;
        properties.clear();
        setCascadingProjectName(StringUtils.trimToNull(req.getParameter("cascadingProjectName")));
        CopyOnWriteList parameterDefinitionProperties = new CopyOnWriteList();
        int i = 0;
        for (JobPropertyDescriptor d : JobPropertyDescriptor.getPropertyDescriptors(Job.this.getClass())) {
            if (!CascadingUtil.isCascadableJobProperty(d)) {
                String name = "jobProperty" + i;
                JSONObject config = json.getJSONObject(name);
                JobProperty prop = d.newInstance(req, config);
                if (null != prop) {
                    prop.setOwner(this);
                    if (prop instanceof AuthorizationMatrixProperty) {
                        properties.add(prop);
                    } else if (prop instanceof ParametersDefinitionProperty) {
                        parameterDefinitionProperties.add(prop);
                    }
                }
            } else {
                BaseProjectProperty property = CascadingUtil.getBaseProjectProperty(this,
                    d.getJsonSafeClassName());
View Full Code Here

Examples of net.timewalker.ffmq3.utils.concurrent.CopyOnWriteList

        assertEquals(4, child3.size());
    }
   
    public void testConcurrency() throws Exception
    {
        final CopyOnWriteList cowList = new CopyOnWriteList();
        cowList.add("v1");
        cowList.add("v2");
        cowList.add("v3");
        assertEquals(0, cowList.getShareLevel());
        assertEquals(3, cowList.size());

        Thread[] threads = new Thread[10];
        for(int n=0;n<threads.length;n++)
            threads[n] = new Thread() {
            /*
             * (non-Javadoc)
             * @see java.lang.Thread#run()
             */
            public void run() {
                try
                {
                    for (int i = 0 ; i < 100000 ; i++)
                    {
                        CopyOnWriteList copy = cowList.fastCopy();
                        int size = copy.size();
                        for (int j = 0 ; j < size ; j++)
                            copy.get(j);
                    }
                }
                catch (Exception e)
                {
                    e.printStackTrace();
View Full Code Here

Examples of net.timewalker.ffmq3.utils.concurrent.CopyOnWriteList

{
    protected boolean failed;
   
    public void testFirstGen()
    {
        CopyOnWriteList cowList = new CopyOnWriteList();
       
        assertEquals(0, cowList.getShareLevel());
        cowList.add("v1");
        cowList.add("v2");
        cowList.add("v3");
        assertEquals(0, cowList.getShareLevel());
        assertEquals(3, cowList.size());
       
        CopyOnWriteList child1 = cowList.fastCopy();
        CopyOnWriteList child2 = cowList.fastCopy();
        CopyOnWriteList child3 = cowList.fastCopy();
        assertEquals(3, cowList.getShareLevel());
       
        child1.add("v4");
        assertEquals(2, cowList.getShareLevel());
        assertEquals(3, cowList.size());
        assertEquals(0, child1.getShareLevel());
        assertEquals(2, child2.getShareLevel());
        assertEquals(2, child3.getShareLevel());
        assertEquals(4, child1.size());
        assertEquals(3, child2.size());
        assertEquals(3, child3.size());
    }
View Full Code Here

Examples of net.timewalker.ffmq3.utils.concurrent.CopyOnWriteList

        assertEquals(3, child3.size());
    }
   
    public void testMultipleGen()
    {
        CopyOnWriteList cowList = new CopyOnWriteList();
       
        assertEquals(0, cowList.getShareLevel());
        cowList.add("v1");
        cowList.add("v2");
        cowList.add("v3");
        assertEquals(0, cowList.getShareLevel());
        assertEquals(3, cowList.size());
       
        CopyOnWriteList child1 = cowList.fastCopy();
        CopyOnWriteList child2 = child1.fastCopy();
        CopyOnWriteList child3 = child2.fastCopy();
        assertEquals(3, cowList.getShareLevel());
       
        child3.add("v4");
        assertEquals(2, cowList.getShareLevel());
        assertEquals(3, cowList.size());
        assertEquals(2, child1.getShareLevel());
        assertEquals(2, child2.getShareLevel());
        assertEquals(0, child3.getShareLevel());
        assertEquals(3, child1.size());
        assertEquals(3, child2.size());
        assertEquals(4, child3.size());
    }
View Full Code Here

Examples of net.timewalker.ffmq3.utils.concurrent.CopyOnWriteList

                    "DeliveryMode.NON_PERSISTENT" : "DeliveryMode.PERSISTENT"),
                    "INVALID_DELIVERY_MODE");
     
        String connectionID = session.getConnection().getId();
       
        CopyOnWriteList subscriptionsSnapshot;
        synchronized (subscriptionMap)
        {
          sentToTopicCount++;
          if (subscriptions.isEmpty())
            return;
         
          subscriptionsSnapshot = subscriptions.fastCopy();
        }
       
        for (int i = 0; i < subscriptionsSnapshot.size(); i++)
    {
        LocalTopicSubscription subscription = (LocalTopicSubscription)subscriptionsSnapshot.get(i);
           
            // No-local filtering
            if (subscription.getNoLocal() && subscription.getConnectionID().equals(connectionID))
                continue;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.