Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lbg.resource
Class LiveResource

    java.lang.Object
      lbg.resource.Resource
          lbg.resource.LiveResource

    public class LiveResource

extends Resource

Implementation of a Live Resource.
Related logger: lbg.resource

Author:
  Xavier Dalem

Field Summary
`protected boolean` | `is_removed`

Constructor Summary
`LiveResource(ResourceBasicConfiguration rbc, ResourceNetworkConfiguration rnc, ResourceDataConfiguration rdc, InternalPeerHandle owner_peer)` Creates a Live resource Resource is not yet connected to peer.

Method Summary
`void` | `cancelTask()` Cancel the currently running task
`void` | `completeTask(GridData data, byte[] logs)` Make final operations to register the running task as completed
`void` | `connect()` Connects the Resource to its owner Peer.
`long` | `expectedTaskRuntime()` How much time should running this task take ?
`protected void` | `flagAsRemoved()`
`GridDataManager` | `gdm()`
`ResourceDataConfiguration` | `getDataConfig()`
`boolean` | `getRemovalState()`
`boolean` | `isAlive()`
`java.util.logging.Logger` | `logger()`
`void` | `runTask(Task t)` Runs a given Task by getting and loading all required information, then running the methods as specified by GridApplication. The method returns immediately, starting the Task in another Thread.
`boolean` | `setWorkingSet(GridData[][] working_set)`
`void` | `startService()`
`java.lang.String` | `toString()`

Methods inherited from class lbg.resource.Resource
`cacheCapacity, id, idle, netConfig, owner, power, runningTask, service, taskStartTime`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### is_removed

    protected boolean is_removed

Constructor Detail

### LiveResource

    public LiveResource(ResourceBasicConfiguration rbc,
                        ResourceNetworkConfiguration rnc,
                        ResourceDataConfiguration rdc,
                        InternalPeerHandle owner_peer)
                 throws GridException

  Creates a Live resource Resource is not yet connected to peer.

  Parameters:
    `rbc` - The basic configuration for the resource
    `rnc` - The network configuration for the resource
    `rdc` - The data configuration for the resource
    `owner_peer` - A handle to the peer that manages this resource
  Throws:
    `GridException`
  See Also:
    `connect()`

Method Detail

### getRemovalState

    public boolean getRemovalState()

### flagAsRemoved

    protected void flagAsRemoved()

### 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.

  Overrides:
    `connect` in class `Resource`
  Throws:
    `GridException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `Resource`

### getDataConfig

    public ResourceDataConfiguration getDataConfig()

### gdm

    public GridDataManager gdm()

### setWorkingSet

    public boolean setWorkingSet(GridData[][] working_set)
                          throws GridException

  Specified by:
    `setWorkingSet` in class `Resource`
  Throws:
    `GridException`

### runTask

    public void runTask(Task t)
                 throws GridException

  Runs a given Task by getting and loading all required information, then running the methods as specified by GridApplication.
  The method returns immediately, starting the Task in another Thread.

  Overrides:
    `runTask` in class `Resource`
  Parameters:
    `t` - The task to run
  Throws:
    `GridException`
  See Also:
    `GridApplication`

### completeTask

    public void completeTask(GridData data,
                             byte[] logs)
                      throws GridException

  Make final operations to register the running task as completed

  Overrides:
    `completeTask` in class `Resource`
  Parameters:
    `data` - The output data of the completed task
  Throws:
    `GridException`

### cancelTask

    public void cancelTask()
                    throws GridException

  Cancel the currently running task

  Overrides:
    `cancelTask` in class `Resource`
  Throws:
    `GridException`

### expectedTaskRuntime

    public long expectedTaskRuntime()
                             throws GridException

  How much time should running this task take ?

  Overrides:
    `expectedTaskRuntime` in class `Resource`
  Throws:
    `GridException`
  To do:
    Yet to be implemented

### startService

    public void startService()
                      throws GridException

  Throws:
    `GridException`

### isAlive

    public boolean isAlive()

### logger

    public java.util.logging.Logger logger()

  Specified by:
    `logger` in class `Resource`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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