public class FutureThread extends java.lang.Object implements ThreadLike
Modifier and Type | Field and Description |
---|---|
RubyThread |
rubyThread |
Constructor and Description |
---|
FutureThread(RubyThread rubyThread,
RubyRunnable runnable) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future |
getFuture() |
int |
getPriority()
The current priority of the thread associated with this future.
|
void |
interrupt()
In order to do a thread interrupt, we need to get the actual thread, stored
in the RubyRunnable instance and tell it to interrupt.
|
boolean |
isAlive()
If the future has not yet run and or is running and not yet complete.
|
boolean |
isCurrent() |
boolean |
isInterrupted() |
void |
join() |
void |
join(long millis)
We check for zero millis here because Future appears to wait for zero if
you pass it zero, where Thread behavior is to wait forever.
|
java.lang.Thread |
nativeThread() |
void |
setPriority(int priority)
Set the priority of the thread associated with this future.
|
void |
start()
Starting a new thread in terms of a thread pool is just submitting it as
a job to the pool.
|
public RubyThread rubyThread
public FutureThread(RubyThread rubyThread, RubyRunnable runnable)
public java.util.concurrent.Future getFuture()
public void start()
start
in interface ThreadLike
public void interrupt()
interrupt
in interface ThreadLike
public boolean isAlive()
isAlive
in interface ThreadLike
public void join() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
join
in interface ThreadLike
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public void join(long millis) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
join
in interface ThreadLike
millis
- The number of millis to wait; 0 waits forever.java.lang.InterruptedException
- If the blocking join is interrupted
by another thread.java.util.concurrent.ExecutionException
- If an execution error is
raised by the underlying Future.public int getPriority()
getPriority
in interface ThreadLike
public void setPriority(int priority)
setPriority
in interface ThreadLike
priority
- the new prioritypublic boolean isCurrent()
isCurrent
in interface ThreadLike
public boolean isInterrupted()
isInterrupted
in interface ThreadLike
public java.lang.Thread nativeThread()
nativeThread
in interface ThreadLike
Copyright © 2002-2009 JRuby Team. All Rights Reserved.