Rice Pastry API

rice.environment.processing.simple
Class SimpleProcessor

java.lang.Object
  extended by rice.environment.processing.simple.SimpleProcessor
All Implemented Interfaces:
Destructable, Processor
Direct Known Subclasses:
UnifiedProcessor

public class SimpleProcessor
extends java.lang.Object
implements Processor

Author:
Jeff Hoye

Field Summary
protected  BlockingIOThread bioThread
           
protected  java.util.concurrent.PriorityBlockingQueue<ProcessingRequest> QUEUE
           
protected  ProcessingThread THREAD
           
protected  WorkQueue workQueue
           
 
Constructor Summary
SimpleProcessor(java.lang.String name)
           
 
Method Summary
 void destroy()
          Shuts down the processing thread.
 WorkQueue getIOQueue()
           
 java.util.Queue<ProcessingRequest> getQueue()
           
static void main(java.lang.String[] args)
          This is a test to make sure the order is correct.
<R,E extends java.lang.Exception>
Cancellable
process(Executable<R,E> task, Continuation<R,E> command, int priority, SelectorManager selector, TimeSource ts, LogManager log)
          Schedules a job for processing on the dedicated processing thread.
<R,E extends java.lang.Exception>
Cancellable
process(Executable<R,E> task, Continuation<R,E> command, SelectorManager selector, TimeSource ts, LogManager log)
          Schedules a job for processing on the dedicated processing thread.
 Cancellable processBlockingIO(WorkRequest workRequest)
          Schedules a different type of task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUEUE

protected java.util.concurrent.PriorityBlockingQueue<ProcessingRequest> QUEUE

THREAD

protected ProcessingThread THREAD

workQueue

protected WorkQueue workQueue

bioThread

protected BlockingIOThread bioThread
Constructor Detail

SimpleProcessor

public SimpleProcessor(java.lang.String name)
Method Detail

process

public <R,E extends java.lang.Exception> Cancellable process(Executable<R,E> task,
                                                             Continuation<R,E> command,
                                                             SelectorManager selector,
                                                             TimeSource ts,
                                                             LogManager log)
Schedules a job for processing on the dedicated processing thread. CPU intensive jobs, such as encryption, erasure encoding, or bloom filter creation should never be done in the context of the underlying node's thread, and should only be done via this method.

Specified by:
process in interface Processor
Parameters:
task - The task to run on the processing thread
command - The command to return the result to once it's done

process

public <R,E extends java.lang.Exception> Cancellable process(Executable<R,E> task,
                                                             Continuation<R,E> command,
                                                             int priority,
                                                             SelectorManager selector,
                                                             TimeSource ts,
                                                             LogManager log)
Description copied from interface: Processor
Schedules a job for processing on the dedicated processing thread. CPU intensive jobs, such as encryption, erasure encoding, or bloom filter creation should never be done in the context of the underlying node's thread, and should only be done via this method. The continuation will be called on the Selector thread. Passes a priority that will be respected if possible.

Specified by:
process in interface Processor
Parameters:
task - The task to run on the processing thread
command - The command to return the result to once it's done
priority - lower number is higher priority, 0 is default priority, and negative numbers are high priority

processBlockingIO

public Cancellable processBlockingIO(WorkRequest workRequest)
Description copied from interface: Processor
Schedules a different type of task. This thread is for doing Disk IO that is required to be blocking.

Specified by:
processBlockingIO in interface Processor

getQueue

public java.util.Queue<ProcessingRequest> getQueue()

destroy

public void destroy()
Description copied from interface: Processor
Shuts down the processing thread.

Specified by:
destroy in interface Destructable
Specified by:
destroy in interface Processor

getIOQueue

public WorkQueue getIOQueue()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This is a test to make sure the order is correct.

Throws:
java.lang.Exception

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection