public class FutureThread extends Object implements ThreadLike
Modifier and Type | Field and Description |
---|---|
RubyThread |
rubyThread |
Constructor and Description |
---|
FutureThread(RubyThread rubyThread,
ThreadedRunnable runnable) |
Modifier and Type | Method and Description |
---|---|
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.
|
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, ThreadedRunnable runnable)
public 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 InterruptedException, ExecutionException
join
in interface ThreadLike
InterruptedException
ExecutionException
public void join(long millis) throws InterruptedException, ExecutionException
join
in interface ThreadLike
millis
- The number of millis to wait; 0 waits forever.InterruptedException
- If the blocking join is interrupted
by another thread.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 Thread nativeThread()
nativeThread
in interface ThreadLike
Copyright © 2001-2016 JRuby. All Rights Reserved.