Lightweight Bartering Grid

lbg.peer.service
Class SimulatedPeerService

java.lang.Object
  extended by lbg.peer.service.SimulatedPeerService
All Implemented Interfaces:
AbstractExternalPeerHandle, AbstractInternalPeerHandle, AbstractUserPeerHandle, PeerService
Direct Known Subclasses:
SimulatedWithCloningPeerService

public class SimulatedPeerService
extends java.lang.Object
implements PeerService

Author:
Cyril Briquet

Constructor Summary
protected SimulatedPeerService(Peer owner_peer)
           
 
Method Summary
 void addResource(ResourceHandle rh, int power)
           
 void cancelJob(int job_id)
           
 void cancelLocalTaskOnSupplyingResource(java.lang.String supplier_id, Task t)
           
 void cancelSupplyingTaskOnLocalResource(java.lang.String consumer_id, Task t)
           
 ConsumptionTaskID computeSupplyingTask(java.lang.String consumer_id, Task t)
           
 PeerHandle createHandle()
           
 void grantConsumption(java.lang.String supplier_id, int granted_count)
           
 java.lang.String hostname()
           
 java.lang.String id()
           
 boolean isAlive()
           
 int peerPort()
           
 void preemptLocalTaskOnLocalResource(Task t, byte[] logs)
           
 void preemptSupplyingTaskOnLocalResource(java.lang.String consumer_id, Task t, byte[] logs)
           
 int queryJobStatus(int job_id)
           
 void removeResource(ResourceHandle rh)
           
 void requestSupplying(java.lang.String consumer_id, int tasks_count)
           
 int resourcePort()
           
 int submitJob(UserHandle uh, JobDescriptor jd)
           
 java.lang.String toString()
           
 void uploadBySupplyingCompletedTask(java.lang.String supplier_id, Task t)
           
 void uploadLocallyCompletedTask(Task t)
           
 int userPort()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimulatedPeerService

protected SimulatedPeerService(Peer owner_peer)
                        throws GridException
Throws:
GridException
Method Detail

toString

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

createHandle

public PeerHandle createHandle()
                        throws GridException
Specified by:
createHandle in interface PeerService
Throws:
GridException

id

public java.lang.String id()

hostname

public java.lang.String hostname()

peerPort

public int peerPort()
Specified by:
peerPort in interface AbstractExternalPeerHandle

requestSupplying

public void requestSupplying(java.lang.String consumer_id,
                             int tasks_count)
                      throws GridException
Specified by:
requestSupplying in interface AbstractExternalPeerHandle
Throws:
GridException

grantConsumption

public void grantConsumption(java.lang.String supplier_id,
                             int granted_count)
                      throws GridException
Specified by:
grantConsumption in interface AbstractExternalPeerHandle
Throws:
GridException

computeSupplyingTask

public ConsumptionTaskID computeSupplyingTask(java.lang.String consumer_id,
                                              Task t)
                                       throws GridException
Specified by:
computeSupplyingTask in interface AbstractExternalPeerHandle
Throws:
GridException

cancelSupplyingTaskOnLocalResource

public void cancelSupplyingTaskOnLocalResource(java.lang.String consumer_id,
                                               Task t)
                                        throws GridException
Specified by:
cancelSupplyingTaskOnLocalResource in interface AbstractExternalPeerHandle
Throws:
GridException

cancelLocalTaskOnSupplyingResource

public void cancelLocalTaskOnSupplyingResource(java.lang.String supplier_id,
                                               Task t)
                                        throws GridException
Specified by:
cancelLocalTaskOnSupplyingResource in interface AbstractExternalPeerHandle
Throws:
GridException

uploadBySupplyingCompletedTask

public void uploadBySupplyingCompletedTask(java.lang.String supplier_id,
                                           Task t)
                                    throws GridException
Specified by:
uploadBySupplyingCompletedTask in interface AbstractExternalPeerHandle
Throws:
GridException

resourcePort

public int resourcePort()
Specified by:
resourcePort in interface AbstractInternalPeerHandle

addResource

public void addResource(ResourceHandle rh,
                        int power)
                 throws GridException
Specified by:
addResource in interface AbstractInternalPeerHandle
Throws:
GridException

removeResource

public void removeResource(ResourceHandle rh)
                    throws GridException
Specified by:
removeResource in interface AbstractInternalPeerHandle
Throws:
GridException

preemptLocalTaskOnLocalResource

public void preemptLocalTaskOnLocalResource(Task t,
                                            byte[] logs)
                                     throws GridException
Specified by:
preemptLocalTaskOnLocalResource in interface AbstractInternalPeerHandle
Throws:
GridException

preemptSupplyingTaskOnLocalResource

public void preemptSupplyingTaskOnLocalResource(java.lang.String consumer_id,
                                                Task t,
                                                byte[] logs)
                                         throws GridException
Specified by:
preemptSupplyingTaskOnLocalResource in interface AbstractInternalPeerHandle
Throws:
GridException

uploadLocallyCompletedTask

public void uploadLocallyCompletedTask(Task t)
                                throws GridException
Specified by:
uploadLocallyCompletedTask in interface AbstractInternalPeerHandle
Throws:
GridException

isAlive

public boolean isAlive()
Specified by:
isAlive in interface AbstractExternalPeerHandle

userPort

public int userPort()
Specified by:
userPort in interface AbstractUserPeerHandle

submitJob

public int submitJob(UserHandle uh,
                     JobDescriptor jd)
              throws GridException
Specified by:
submitJob in interface AbstractUserPeerHandle
Throws:
GridException

cancelJob

public void cancelJob(int job_id)
               throws GridException
Specified by:
cancelJob in interface AbstractUserPeerHandle
Throws:
GridException

queryJobStatus

public int queryJobStatus(int job_id)
                   throws GridException
Specified by:
queryJobStatus in interface AbstractUserPeerHandle
Throws:
GridException

Lightweight Bartering Grid

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