From: <sc...@hy...> - 2009-03-30 22:29:11
|
Author: scottmf Date: 2009-03-30 15:28:58 -0700 (Mon, 30 Mar 2009) New Revision: 12899 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=12899 Modified: trunk/src/org/hyperic/hq/application/Scheduler.java trunk/src/org/hyperic/hq/transport/util/AsynchronousInvoker.java trunk/src/org/hyperic/hq/zevents/BufferedListener.java trunk/src/org/hyperic/hq/zevents/QueueProcessor.java trunk/src/org/hyperic/hq/zevents/ZeventManager.java trunk/src/org/hyperic/util/thread/ThreadGroupFactory.java trunk/src/org/hyperic/util/thread/ThreadWatchdog.java Log: cutover concurrent backport libs to java-1.5 libs Modified: trunk/src/org/hyperic/hq/application/Scheduler.java =================================================================== --- trunk/src/org/hyperic/hq/application/Scheduler.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/hq/application/Scheduler.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -25,14 +25,14 @@ package org.hyperic.hq.application; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + import org.hyperic.util.thread.LoggingThreadGroup; import org.hyperic.util.thread.ThreadGroupFactory; -import edu.emory.mathcs.backport.java.util.concurrent.ScheduledFuture; -import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor; -import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; -import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; - /** * A scheduler that internally uses a thread pool to permit concurrent execution * of scheduled tasks. This scheduler is preferable to a {@link java.util.Timer} @@ -66,10 +66,8 @@ new ThreadGroupFactory(threadGroup, "Scheduler-"); tFactory.createDaemonThreads(true); - _executor = - new ScheduledThreadPoolExecutor(poolSize, - tFactory, - new ThreadPoolExecutor.DiscardPolicy()); + _executor = new ScheduledThreadPoolExecutor( + poolSize, tFactory, new ThreadPoolExecutor.DiscardPolicy()); // delayed tasks should not execute after shutdown _executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); @@ -94,8 +92,10 @@ * @param period The period (in msec) between successive executions. * @return A ScheduledFuture that may be used to cancel task execution. */ - public ScheduledFuture scheduleAtFixedRate(Runnable task, long initialDelay, long period) { - return _executor.scheduleAtFixedRate(task, initialDelay, period, TimeUnit.MILLISECONDS); + public ScheduledFuture scheduleAtFixedRate(Runnable task, long initialDelay, + long period) { + return _executor.scheduleAtFixedRate( + task, initialDelay, period, TimeUnit.MILLISECONDS); } /** @@ -112,8 +112,11 @@ * and commencement of the next. * @return A ScheduledFuture that may be used to cancel task execution. */ - public ScheduledFuture scheduleWithFixedDelay(Runnable task, long initialDelay, long delay) { - return _executor.scheduleWithFixedDelay(task, initialDelay, delay, TimeUnit.MILLISECONDS); + public ScheduledFuture scheduleWithFixedDelay(Runnable task, + long initialDelay, + long delay) { + return _executor.scheduleWithFixedDelay( + task, initialDelay, delay, TimeUnit.MILLISECONDS); } /** Modified: trunk/src/org/hyperic/hq/transport/util/AsynchronousInvoker.java =================================================================== --- trunk/src/org/hyperic/hq/transport/util/AsynchronousInvoker.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/hq/transport/util/AsynchronousInvoker.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -25,15 +25,14 @@ package org.hyperic.hq.transport.util; -import org.hyperic.hq.transport.util.AsynchronousInvocationHandler; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + import org.hyperic.util.thread.LoggingThreadGroup; import org.hyperic.util.thread.ThreadGroupFactory; -import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; -import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; -import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; -import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; - /** * A helper class for performing asynchronous invocations within the HQ transport * layer. Asynchronous invocations are performed using a thread pool executor. Modified: trunk/src/org/hyperic/hq/zevents/BufferedListener.java =================================================================== --- trunk/src/org/hyperic/hq/zevents/BufferedListener.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/hq/zevents/BufferedListener.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -26,15 +26,14 @@ package org.hyperic.hq.zevents; import java.util.List; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hyperic.util.thread.ThreadGroupFactory; -import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; -import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; -import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; - class BufferedListener extends ThreadPoolExecutor implements ZeventListener @@ -44,7 +43,7 @@ private final ZeventListener _target; BufferedListener(ZeventListener target, ThreadGroupFactory fact) { - super(1, 1, 0, TimeUnit.DAYS, new LinkedBlockingQueue(), fact); + super(1, 1, 0, TimeUnit.SECONDS, new LinkedBlockingQueue(), fact); ZeventManager.getInstance().registerBuffer(getQueue(), target); _target = target; } Modified: trunk/src/org/hyperic/hq/zevents/QueueProcessor.java =================================================================== --- trunk/src/org/hyperic/hq/zevents/QueueProcessor.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/hq/zevents/QueueProcessor.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. + * Copyright (C) [2004-2009], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -28,12 +28,11 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.concurrent.BlockingQueue; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue; - /** * This class acts as the thread pulling data off the event queue and * dispatching it to listeners. Modified: trunk/src/org/hyperic/hq/zevents/ZeventManager.java =================================================================== --- trunk/src/org/hyperic/hq/zevents/ZeventManager.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/hq/zevents/ZeventManager.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -34,8 +34,12 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Queue; import java.util.Set; import java.util.WeakHashMap; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -49,11 +53,6 @@ import org.hyperic.util.thread.ThreadWatchdog; import org.hyperic.util.thread.ThreadWatchdog.InterruptToken; -import edu.emory.mathcs.backport.java.util.Queue; -import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue; -import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; -import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; - /** * The Zevent subsystem is an event system for fast, non-reliable transmission * of events. Important data should not be transmitted on this bus, since Modified: trunk/src/org/hyperic/util/thread/ThreadGroupFactory.java =================================================================== --- trunk/src/org/hyperic/util/thread/ThreadGroupFactory.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/util/thread/ThreadGroupFactory.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004-2008], Hyperic, Inc. + * Copyright (C) [2004-2009], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ package org.hyperic.util.thread; -import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadFactory; public class ThreadGroupFactory implements ThreadFactory Modified: trunk/src/org/hyperic/util/thread/ThreadWatchdog.java =================================================================== --- trunk/src/org/hyperic/util/thread/ThreadWatchdog.java 2009-03-30 22:05:33 UTC (rev 12898) +++ trunk/src/org/hyperic/util/thread/ThreadWatchdog.java 2009-03-30 22:28:58 UTC (rev 12899) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. + * Copyright (C) [2004-2009], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -25,14 +25,14 @@ package org.hyperic.util.thread; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.emory.mathcs.backport.java.util.concurrent.Future; -import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor; -import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; -import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; - /** * This class is able to interrupt threads after a certain interval -- useful * when threads need to have a bounded runtime. |