All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.randelshofer.quaqua.util.SequentialDispatcher Maven / Gradle / Ivy

Go to download

A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library) Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer. Mavenisation by Matt Gumbley, DevZendo.org - for problems with Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page. For full license details, see http://randelshofer.ch/quaqua/license.html

The newest version!
/*
 * @(#)SequentialDispatcher.java  1.0  2002-05-18
 *
 * Copyright (c) 2001-2010 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of 
 * Werner Randelshofer. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Werner Randelshofer.
 */
//package ch.randelshofer.util;
package ch.randelshofer.quaqua.util;

/**
 * Processes Runnable objects sequentially on a processor thread.
 * The order in which the runnable objects are processed is 
 * the same in which they were added to the dispatcher.
 * 

* Design pattern used: Acceptor * Role in design pattern: EventCollector and EventProcessor * * @author Werner Randelshofef * @version 1.0 2002-05-18 Created */ public class SequentialDispatcher extends EventLoop { /** * Creates new SequentialDispatcher which processes Runnable objects * at java.lang.Thread.NORM_PRIORITY. */ public SequentialDispatcher() { } /** * Creates a new SequentialDispatcher which processes Runnable Objects * at the desired thread priority. * * @param priority The Thread priority of the event processor. */ public SequentialDispatcher(int priority) { super(priority); } /** * This method processes an event on the event processor thread. * * @param event An event from the queue. */ protected void processEvent(Object event) { Runnable r = (Runnable) event; r.run(); } /** * Queues the Runnable object for later execution on the * processor thread. */ public void dispatch(Runnable r) { collectEvent(r); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy