Examples of ConcurrentLinkedQueue


Examples of java.util.concurrent.ConcurrentLinkedQueue

     */
    private void runTasks(Thread currentRunninghread) {
        do {
            try {
                Runnable task;
                ConcurrentLinkedQueue tasks = m_tasks;

                while ((task = (Runnable) tasks.poll()) != null) {
                    runTask(task);
                }
            }
            finally {
                m_runningThread.set(null);
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();
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

                     "end";
        int N = 1100;

        KnowledgeBase kb = loadKnowledgeBaseFromString( drl );
        final StatefulKnowledgeSession ks = kb.newStatefulKnowledgeSession();
        ConcurrentLinkedQueue list = new ConcurrentLinkedQueue<Integer>();
        AtomicInteger counter = new AtomicInteger(0);
        ks.setGlobal( "list", list );
        //ks.setGlobal( "counter", counter );

        new Thread () {
            public void run () {
                ks.fireUntilHalt();
            }
        }.start ();

        for ( int j = 0; j < N; j++ ) {
            ks.getEntryPoint( "x" ).insert( new Integer( j ) );
        }

        int count = 0;
        while ( list.size() != N && count++ != 1000) {
            Thread.sleep( 200 );
        }

        ks.halt();
        if ( list.size() != N ) {
            for ( int j = 0; j < N; j++ ) {
                if ( !list.contains( new Integer( j ) ) ) {
                    System.out.println( "missed: " + j );
                }
            }
        }

        assertEquals( N, list.size() );
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

    private ConcurrentLinkedQueue<HUDEvent> eventQueue;
    private boolean notifying = false;
    private int id;

    public HUDObject2D() {
        listeners = new ConcurrentLinkedQueue();
        eventQueue = new ConcurrentLinkedQueue();
        bounds = new Rectangle2D.Double();
        id = new Random().nextInt(10000);
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

        = new ReplicationResponseRepository();   
   
    /** Creates a new instance of ReplicationResponseRepository */
    public ReplicationResponseRepository() {
        _repository = new ConcurrentHashMap();
        _queueForQueues = new ConcurrentLinkedQueue();
        _federatedQueryRepository = new ConcurrentHashMap();
    }  
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

            element = cache.get(QUEUE_KEY);
        } catch (CacheException e) {
            throw new AsynchronousCommandException("Unable to retrieve queue.", e);
        }
        if (element == null) {
            queue = new ConcurrentLinkedQueue();
            Element queueElement = new Element(QUEUE_KEY, queue);
            cache.put(queueElement);
        } else {
            queue = (Queue) element.getValue();
        }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

        //  Filling up processor_imagefetcher_queue
    }
   
    public void saveImages() throws IOException
    {
       ConcurrentLinkedQueue results = thread_pool.getResult();
       ImageNode image ;
      
        if(results.isEmpty())             // If there is no image then return
            return ;
       int max_x=0;
       int max_y=0;
       BufferedImage image_iterate;
       for(Iterator i=results.iterator(); i.hasNext();)
       {
           image = (ImageNode) i.next();
           image_iterate= image.actual_image;
           max_x+=image_iterate.getWidth();
           if(max_y<image_iterate.getHeight())
               max_y=image_iterate.getHeight();
       }
       BufferedImage new_image = new BufferedImage(max_x,max_y,BufferedImage.TYPE_3BYTE_BGR);
       Graphics g = new_image.getGraphics();
       int temp_x=0;
       for(Iterator i=results.iterator(); i.hasNext();)
       {
           image = (ImageNode) i.next();
           image_iterate= image.actual_image;
           g.drawImage(image_iterate, temp_x, 0, null);
           temp_x += image_iterate.getWidth();
       }
       results.clear();   // Cleaning and sanitizing queue
       File outputfile = new File("image_cache\\"+item.hashCode()+".png");
       ImageIO.write(new_image, "png", outputfile);
       
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentLinkedQueue

  }

  public TcpConnection(ILogAgent par1ILogAgent, Socket par2Socket, String par3Str, NetHandler par4NetHandler, PrivateKey par5PrivateKey) throws IOException {
    this.sendQueueLock = new Object();
    this.isRunning = true;
    this.readPackets = new ConcurrentLinkedQueue();   
    this.dataPackets = Collections.synchronizedList(new ArrayList());
    this.chunkDataPackets = Collections.synchronizedList(new ArrayList());   
    this.terminationReason = "";   
    this.chunkDataPacketsDelay = 50;
    this.field_74463_A = par5PrivateKey;
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
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.