frysk.event
Class Request

java.lang.Object
  extended by frysk.event.Request
All Implemented Interfaces:
Event
Direct Known Subclasses:
AddressSpaceByteBuffer.PeekRequest, AddressSpaceByteBuffer.PokeRequest, AddressSpaceByteBuffer.TransferRequest, EventLoop.ExecuteRequest, EventLoopTestBed.EventRequest, QuitCommand.KillRequest, RegisterSetByteBuffer.TransferRequest

public abstract class Request
extends Object
implements Event

Framework for implementing remote-procedure-call requests executed by the event-loop thread.


Nested Class Summary
private  class Request.Handler
          Class that does the request dispatch and execute.
 
Field Summary
private  EventLoop eventLoop
           
private  Request.Handler handler
           
 
Constructor Summary
protected Request(EventLoop eventLoop)
          Create an event-loop RPC framework.
 
Method Summary
protected  boolean isEventLoopThread()
          Is this the event-loop thread? If it is the caller should just execute the request directly.
protected  void request()
          Make a request to run execute() on the eventLoop thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface frysk.event.Event
execute
 

Field Detail

eventLoop

private final EventLoop eventLoop

handler

private final Request.Handler handler
Constructor Detail

Request

protected Request(EventLoop eventLoop)
Create an event-loop RPC framework.

Method Detail

isEventLoopThread

protected final boolean isEventLoopThread()
Is this the event-loop thread? If it is the caller should just execute the request directly.


request

protected void request()
Make a request to run execute() on the eventLoop thread. The sub-class will look something like:
if (isEventLoopThread())
  execute(with, args)
else {
  synchronized(this) {
    super.request();
  }
}