You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2007/11/11 23:21:53 UTC

svn commit: r593978 - /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java

Author: jdonnerstag
Date: Sun Nov 11 14:21:52 2007
New Revision: 593978

URL: http://svn.apache.org/viewvc?rev=593978&view=rev
Log:
Allow to change the prio of a Thread

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java?rev=593978&r1=593977&r2=593978&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java Sun Nov 11 14:21:52 2007
@@ -159,7 +159,7 @@
 		if (isStarted)
 		{
 			throw new IllegalStateException(
-					"Attempt to set daemon state of a task that has already been started");
+				"Attempt to set daemon state of a task that has already been started");
 		}
 
 		isDaemon = daemon;
@@ -190,7 +190,7 @@
 		if (isStarted)
 		{
 			throw new IllegalStateException(
-					"Attempt to set start time of task that has already been started");
+				"Attempt to set start time of task that has already been started");
 		}
 
 		this.startTime = startTime;
@@ -202,7 +202,7 @@
 	public String toString()
 	{
 		return "[name=" + name + ", startTime=" + startTime + ", isDaemon=" + isDaemon +
-				", isStarted=" + isStarted + ", codeListener=" + log + "]";
+			", isStarted=" + isStarted + ", codeListener=" + log + "]";
 	}
 
 	/**
@@ -237,5 +237,33 @@
 		{
 			thread.interrupt();
 		}
+	}
+
+	/**
+	 * Sets the priority of the thread
+	 * 
+	 * @param prio
+	 */
+	public void setPriority(int prio)
+	{
+		if (prio < Thread.MIN_PRIORITY)
+		{
+			prio = Thread.MIN_PRIORITY;
+		}
+		else if (prio > Thread.MAX_PRIORITY)
+		{
+			prio = Thread.MAX_PRIORITY;
+		}
+		thread.setPriority(prio);
+	}
+
+	/**
+	 * Gets the thread priority
+	 * 
+	 * @return
+	 */
+	public int getPriority()
+	{
+		return thread.getPriority();
 	}
 }