Moving the HWT stuff from org.jboss.netty.akka.util to akka.util.internal

This commit is contained in:
Viktor Klang 2012-05-20 15:56:52 +02:00
parent ae8a65c8e0
commit 5cbcb612b2
9 changed files with 18 additions and 20 deletions

View file

@ -18,7 +18,7 @@
* Expert Group and released to the public domain, as explained at * Expert Group and released to the public domain, as explained at
* http://creativecommons.org/licenses/publicdomain * http://creativecommons.org/licenses/publicdomain
*/ */
package org.jboss.netty.akka.util.internal; package akka.util.internal;
import java.util.AbstractCollection; import java.util.AbstractCollection;
import java.util.AbstractMap; import java.util.AbstractMap;

View file

@ -13,12 +13,10 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.akka.util; package akka.util.internal;
import akka.event.LoggingAdapter; import akka.event.LoggingAdapter;
import akka.util.Duration; import akka.util.Duration;
import org.jboss.netty.akka.util.internal.ConcurrentIdentityHashMap;
import org.jboss.netty.akka.util.internal.ReusableIterator;
import java.util.*; import java.util.*;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
@ -34,7 +32,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* <h3>Tick Duration</h3> * <h3>Tick Duration</h3>
* *
* As described with 'approximated', this timer does not execute the scheduled * As described with 'approximated', this timer does not execute the scheduled
* {@link TimerTask} on time. {@link org.jboss.netty.akka.util.HashedWheelTimer}, on every tick, will * {@link TimerTask} on time. {@link HashedWheelTimer}, on every tick, will
* check if there are any {@link TimerTask}s behind the schedule and execute * check if there are any {@link TimerTask}s behind the schedule and execute
* them. * them.
* <p> * <p>
@ -46,7 +44,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* *
* <h3>Ticks per Wheel (Wheel Size)</h3> * <h3>Ticks per Wheel (Wheel Size)</h3>
* *
* {@link org.jboss.netty.akka.util.HashedWheelTimer} maintains a data structure called 'wheel'. * {@link HashedWheelTimer} maintains a data structure called 'wheel'.
* To put simply, a wheel is a hash table of {@link TimerTask}s whose hash * To put simply, a wheel is a hash table of {@link TimerTask}s whose hash
* function is 'dead line of the task'. The default number of ticks per wheel * function is 'dead line of the task'. The default number of ticks per wheel
* (i.e. the size of the wheel) is 512. You could specify a larger value * (i.e. the size of the wheel) is 512. You could specify a larger value
@ -54,7 +52,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* *
* <h3>Do not create many instances.</h3> * <h3>Do not create many instances.</h3>
* *
* {@link org.jboss.netty.akka.util.HashedWheelTimer} creates a new thread whenever it is instantiated and * {@link HashedWheelTimer} creates a new thread whenever it is instantiated and
* started. Therefore, you should make sure to create only one instance and * started. Therefore, you should make sure to create only one instance and
* share it across your application. One of the common mistakes, that makes * share it across your application. One of the common mistakes, that makes
* your application unresponsive, is to create a new instance in * your application unresponsive, is to create a new instance in
@ -63,7 +61,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* *
* <h3>Implementation Details</h3> * <h3>Implementation Details</h3>
* *
* {@link org.jboss.netty.akka.util.HashedWheelTimer} is based on * {@link HashedWheelTimer} is based on
* <a href="http://cseweb.ucsd.edu/users/varghese/">George Varghese</a> and * <a href="http://cseweb.ucsd.edu/users/varghese/">George Varghese</a> and
* Tony Lauck's paper, * Tony Lauck's paper,
* <a href="http://cseweb.ucsd.edu/users/varghese/PAPERS/twheel.ps.Z">'Hashed * <a href="http://cseweb.ucsd.edu/users/varghese/PAPERS/twheel.ps.Z">'Hashed

View file

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.akka.util.internal; package akka.util.internal;
import java.util.Iterator; import java.util.Iterator;

View file

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.akka.util.internal; package akka.util.internal;
import java.util.regex.Pattern; import java.util.regex.Pattern;

View file

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.akka.util; package akka.util.internal;
/** /**
* A handle associated with a {@link TimerTask} that is returned by a * A handle associated with a {@link TimerTask} that is returned by a

View file

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.akka.util; package akka.util.internal;
import akka.util.Duration; import akka.util.Duration;
import java.util.Set; import java.util.Set;
@ -45,7 +45,7 @@ public interface Timer {
Timeout newTimeout(TimerTask task, Duration delay); Timeout newTimeout(TimerTask task, Duration delay);
/** /**
* Releases all resources acquired by this {@link org.jboss.netty.akka.util.Timer} and cancels all * Releases all resources acquired by this {@link Timer} and cancels all
* tasks which were scheduled but not executed yet. * tasks which were scheduled but not executed yet.
* *
* @return the handles associated with the tasks which were canceled by * @return the handles associated with the tasks which were canceled by

View file

@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.akka.util; package akka.util.internal;
/** /**
* A task which is executed after the delay specified with * A task which is executed after the delay specified with
* {@link Timer#newTimeout(org.jboss.netty.akka.util.TimerTask, long, java.util.concurrent.TimeUnit)} * {@link Timer#newTimeout(TimerTask, long, java.util.concurrent.TimeUnit)}
* . * .
* *
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a> * @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
@ -28,7 +28,7 @@ public interface TimerTask {
/** /**
* Executed after the delay specified with * Executed after the delay specified with
* {@link Timer#newTimeout(org.jboss.netty.akka.util.TimerTask, long, java.util.concurrent.TimeUnit)} * {@link Timer#newTimeout(TimerTask, long, java.util.concurrent.TimeUnit)}
* . * .
* *
* @param timeout * @param timeout

View file

@ -7,16 +7,15 @@ package akka.actor
import akka.event._ import akka.event._
import akka.dispatch._ import akka.dispatch._
import akka.pattern.ask import akka.pattern.ask
import org.jboss.netty.akka.util.HashedWheelTimer
import java.util.concurrent.TimeUnit.MILLISECONDS
import com.typesafe.config.{ Config, ConfigFactory } import com.typesafe.config.{ Config, ConfigFactory }
import scala.annotation.tailrec import scala.annotation.tailrec
import org.jboss.netty.akka.util.internal.ConcurrentIdentityHashMap
import java.io.Closeable import java.io.Closeable
import akka.dispatch.Await.{ Awaitable, CanAwait } import akka.dispatch.Await.{ Awaitable, CanAwait }
import akka.util._ import akka.util._
import akka.util.internal.{ HashedWheelTimer, ConcurrentIdentityHashMap }
import collection.immutable.Stack import collection.immutable.Stack
import java.util.concurrent.{ ThreadFactory, CountDownLatch, TimeoutException, RejectedExecutionException } import java.util.concurrent.{ ThreadFactory, CountDownLatch, TimeoutException, RejectedExecutionException }
import java.util.concurrent.TimeUnit.MILLISECONDS
object ActorSystem { object ActorSystem {

View file

@ -5,12 +5,13 @@
package akka.actor package akka.actor
import akka.util.Duration import akka.util.Duration
import org.jboss.netty.akka.util.{ TimerTask, HashedWheelTimer, Timeout HWTimeout, Timer } import akka.util.internal.{ TimerTask, HashedWheelTimer, Timeout HWTimeout, Timer }
import akka.event.LoggingAdapter import akka.event.LoggingAdapter
import akka.dispatch.MessageDispatcher import akka.dispatch.MessageDispatcher
import java.io.Closeable import java.io.Closeable
import java.util.concurrent.atomic.AtomicReference import java.util.concurrent.atomic.AtomicReference
import scala.annotation.tailrec import scala.annotation.tailrec
import akka.util.internal._
//#scheduler //#scheduler
/** /**