Examples of ConcurrentLinkedQueue


Examples of java.util.concurrent.ConcurrentLinkedQueue

        Queue<Pipelineable<K>> pipeline = pipelines.get(key);
        if (pipeline == null) {
            synchronized (pipelines) {
                pipeline = pipelines.get(key);
                if (pipeline == null) {
                    pipeline = new ConcurrentLinkedQueue();
                    pipelines.put(key, pipeline);
                }
            }
        }
       
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

        try {
            final PackageBuilder packageBuilder = new PackageBuilder();
            packageBuilder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_MultithreadFiringCheck.drl" ) ) );
            final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
            ruleBase.addPackage( packageBuilder.getPackage() );
            final Queue errorList = new ConcurrentLinkedQueue();
            final Thread t[] = new Thread[50];
            for ( int i = 0; i < t.length; i++ ) {
                final int count = i;
                t[i] = new Thread( new Runnable() {
                    public void run() {
                        try {
                            final int iterations = count * 15 + 3000;
                            final List results = new ArrayList();
                            final StatefulSession session2 = ruleBase.newStatefulSession();
                            session2.setGlobal( "results",
                                                results );
                            session2.insert( new Integer( -1 ) );
                            for ( int k = 0; k < iterations; k++ ) {
                                session2.insert( new Integer( k ) );
                                if ( k + 1 != session2.getAgenda().agendaSize() ) {
                                    errorList.add( "THREAD-" + count + " ERROR: expected agenda size=" + (k + 1) + " but was " + session2.getAgenda().agendaSize() );
                                }
                            }
                            session2.fireAllRules();
                            session2.dispose();
                            if ( results.size() != iterations ) {
                                errorList.add( "THREAD-" + count + " ERROR: expected fire count=" + iterations + " but was " + results.size() );
                            }
                        } catch ( Exception e ) {
                            errorList.add( "THREAD-" + count + " EXCEPTION: " + e.getMessage() );
                            e.printStackTrace();
                        }
                    }
                } );
                t[i].start();
            }
            for ( int i = 0; i < t.length; i++ ) {
                t[i].join();
            }
            assertTrue( "Errors during execution: " + errorList.toString(),
                        errorList.isEmpty() );
        } catch ( Exception e ) {
            e.printStackTrace();
            fail( "No exception should have been raised: "+e.getMessage());
        }
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    private          SegmentMemory   segmentMemory;
    private          Queue           queue;

    public PathMemory(NetworkNode networkNode) {
        this.networkNode = networkNode;
        this.queue = new ConcurrentLinkedQueue();
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    {
        Collection[] list = new ConcurrentLinkedQueue[maxSize];

        for (int i = 0; i < list.length; i++)
        {
            list[i] = new ConcurrentLinkedQueue();
        }

        return list;
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    /**
     * PERF:
     * Init the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects.
     */
    public static Queue initCalendarCache() {
        Queue calendarCache = new ConcurrentLinkedQueue();
        for (int index = 0; index < 10; index++) {
            calendarCache.add(Calendar.getInstance());
        }
        return calendarCache;
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    /**
     * PERF:
     * Init the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects.
     */
    public static Queue initCalendarCache() {
        Queue calendarCache = new ConcurrentLinkedQueue();
        for (int index = 0; index < 10; index++) {
            calendarCache.add(Calendar.getInstance());
        }
        return calendarCache;
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    private          SegmentMemory     segmentMemory;
    private          Queue             queue;

    public PathMemory(NetworkNode networkNode) {
        this.networkNode = networkNode;
        this.queue = new ConcurrentLinkedQueue();
        this.linkedSegmentMask = new AtomicBitwiseLong();
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    /**
     * PERF:
     * Init the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects.
     */
    public static Queue initCalendarCache() {
        Queue calendarCache = new ConcurrentLinkedQueue();
        for (int index = 0; index < 10; index++) {
            calendarCache.add(Calendar.getInstance());
        }
        return calendarCache;
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

      this.map = paramMapMakerInternalMap;
      this.maxSegmentSize = paramInt2;
      initTable(newEntryArray(paramInt1));
      this.keyReferenceQueue = (paramMapMakerInternalMap.usesKeyReferences() ? new ReferenceQueue() : null);
      this.valueReferenceQueue = (paramMapMakerInternalMap.usesValueReferences() ? new ReferenceQueue() : null);
      this.recencyQueue = ((paramMapMakerInternalMap.evictsBySize()) || (paramMapMakerInternalMap.expiresAfterAccess()) ? new ConcurrentLinkedQueue() : MapMakerInternalMap.discardingQueue());
      this.evictionQueue = (paramMapMakerInternalMap.evictsBySize() ? new MapMakerInternalMap.EvictionQueue() : MapMakerInternalMap.discardingQueue());
      this.expirationQueue = (paramMapMakerInternalMap.expires() ? new MapMakerInternalMap.ExpirationQueue() : MapMakerInternalMap.discardingQueue());
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    this.expireAfterAccessNanos = paramMapMaker.getExpireAfterAccessNanos();
    this.expireAfterWriteNanos = paramMapMaker.getExpireAfterWriteNanos();
    this.entryFactory = EntryFactory.getFactory(this.keyStrength, expires(), evictsBySize());
    this.ticker = paramMapMaker.getTicker();
    this.removalListener = paramMapMaker.getRemovalListener();
    this.removalNotificationQueue = (this.removalListener == GenericMapMaker.NullListener.INSTANCE ? discardingQueue() : new ConcurrentLinkedQueue());
    int i = Math.min(paramMapMaker.getInitialCapacity(), 1073741824);
    if (evictsBySize())
      i = Math.min(i, this.maximumSize);
    int j = 0;
    int k = 1;
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.