Lightweight Bartering Grid

lbg.resource
Class Resource

java.lang.Object
  extended by lbg.resource.Resource
Direct Known Subclasses:
LiveResource, SimulatedResource

public abstract class Resource
extends java.lang.Object

Author:
Cyril Briquet

Method Summary
 int cacheCapacity()
           
 void cancelTask()
           
 void completeTask(GridData data, byte[] logs)
          Completes the execution of a Task by: flagging the Task as complete (thus, creating a TaskOutput) updating the Resource state
 void connect()
          Connects the Resource to its owner Peer.
 long expectedTaskRuntime()
           
 java.lang.String id()
           
 boolean idle()
           
abstract  java.util.logging.Logger logger()
           
 ResourceNetworkConfiguration netConfig()
           
 InternalPeerHandle owner()
           
 int power()
           
 Task runningTask()
           
 void runTask(Task t)
           
 ResourceService service()
           
abstract  boolean setWorkingSet(GridData[][] working_set)
           
 long taskStartTime()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

id

public java.lang.String id()

netConfig

public ResourceNetworkConfiguration netConfig()

owner

public InternalPeerHandle owner()

power

public int power()

service

public ResourceService service()

logger

public abstract java.util.logging.Logger logger()

connect

public void connect()
             throws GridException
Connects the Resource to its owner Peer.

This cannot be done at creation-time because we maybe need another infrastructure (e.g. Sockets) before telling the Peer we're ready to process Tasks.

Throws:
GridException

cacheCapacity

public int cacheCapacity()

setWorkingSet

public abstract boolean setWorkingSet(GridData[][] working_set)
                               throws GridException
Throws:
GridException

idle

public boolean idle()

runningTask

public Task runningTask()

runTask

public void runTask(Task t)
             throws GridException
Throws:
GridException

completeTask

public void completeTask(GridData data,
                         byte[] logs)
                  throws GridException
Completes the execution of a Task by:

Throws:
GridException

cancelTask

public void cancelTask()
                throws GridException
Throws:
GridException

taskStartTime

public long taskStartTime()

expectedTaskRuntime

public long expectedTaskRuntime()
                         throws GridException
Throws:
GridException

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.