Class Executing

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Executing
Direct Known Subclasses:
CENTRAL_EXECUTOR

public abstract class Executing extends Protocol
This is the base protocol used for executions.
Author:
wburns
See Also:
  • Field Details

    • bypass_bundling

      protected boolean bypass_bundling
    • local_addr

      protected Address local_addr
    • view

      protected View view
    • _awaitingConsumer

      protected final Queue<Runnable> _awaitingConsumer
      This is a queue on the client side that holds all of the tasks that are awaiting a consumer to pick them up
    • notifiers

      protected final ConcurrentMap<Future<?>,ExecutorNotification> notifiers
    • _running

      protected final Map<Runnable,Executing.Owner> _running
      This is a map on the server side that shows which owner is currently tied to the runnable so we can return to them the results
    • _awaitingReturn

      protected final Map<Executing.Owner,Runnable> _awaitingReturn
      This is a map on the client side that shows for which owner(consumer, request) the runnable they are currently using. This also allows us to set the values on a future when finished.
    • _tasks

      protected BlockingQueue<Runnable> _tasks
      This is a server side queue of all the tasks to pass off. Currently there will never be tasks waiting to put in. If a task is put in and doesn't have a respective take at the same time that task is rejected.
    • _runnableThreads

      protected final ConcurrentMap<Runnable,Thread> _runnableThreads
      This is a server side map to show which threads are running for a given runnable. This is used to interrupt those threads if needed.
    • _consumerLock

      protected Lock _consumerLock
      This lock is to protect the incoming run requests and the incoming consumer queues
    • _runRequests

      protected Queue<Address> _runRequests
      This is stored on the coordinator side. This queue holds all of the addresses that currently want to run something. If this queue has elements the consumer queue must be empty.
    • _consumersAvailable

      protected Queue<Address> _consumersAvailable
      This is stored on the coordinator side. This queue holds all of the addresses that currently are able to run something. If this queue has elements the run request queue must be empty.
    • counter

      protected static final AtomicInteger counter
      This keeps track of all the requests we send. This is used so that the response doesn't have to send back the future but instead the counter We just let this roll over
  • Constructor Details

    • Executing

      public Executing()
  • Method Details

    • getBypassBundling

      public boolean getBypassBundling()
    • setBypassBundling

      public void setBypassBundling(boolean bypass_bundling)
    • addExecutorListener

      public void addExecutorListener(Future<?> future, ExecutorNotification listener)
    • getAddress

      public String getAddress()
    • getView

      public String getView()
    • down

      public Object down(Event evt)
      Description copied from class: Protocol
      An event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down(). In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack using up_prot.up().
      Overrides:
      down in class Protocol
    • up

      public Object up(Event evt)
      Description copied from class: Protocol
      An event was received from the layer below. Usually the current layer will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally the event is either a) discarded, or b) an event is sent down the stack using down_prot.down() or c) the event (or another event) is sent up the stack using up_prot.up().
      Overrides:
      up in class Protocol
    • handleView

      protected void handleView(View view)
    • sendToCoordinator

      protected abstract void sendToCoordinator(Executing.Type type, Object obj)
    • sendNewRunRequest

      protected abstract void sendNewRunRequest(Address source)
    • sendRemoveRunRequest

      protected abstract void sendRemoveRunRequest(Address source)
    • sendNewConsumerRequest

      protected abstract void sendNewConsumerRequest(Address source)
    • sendRemoveConsumerRequest

      protected abstract void sendRemoveConsumerRequest(Address source)
    • handleTaskRequest

      protected void handleTaskRequest(Address source)
    • handleConsumerReadyRequest

      protected void handleConsumerReadyRequest(Address source)
    • handleConsumerFoundResponse

      protected void handleConsumerFoundResponse(Address consumer)
    • handleTaskSubmittedRequest

      protected void handleTaskSubmittedRequest(Runnable runnable, Address source, short requestId)
    • handleTaskRejectedResponse

      protected void handleTaskRejectedResponse(Address source, short requestId)
    • handleValueResponse

      protected void handleValueResponse(Address source, Executing.Request req)
    • handleExceptionResponse

      protected void handleExceptionResponse(Address source, Executing.Request req)
    • handleInterruptRequest

      protected void handleInterruptRequest(Address source, short requestId)
    • handleNewRunRequest

      protected void handleNewRunRequest(Address sender)
    • handleRemoveRunRequest

      protected void handleRemoveRunRequest(Address sender)
    • handleNewConsumer

      protected void handleNewConsumer(Address sender)
    • handleRemoveConsumer

      protected void handleRemoveConsumer(Address sender)
    • sendRequest

      protected void sendRequest(Address dest, Executing.Type type, short requestId, Object object)