|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlbg.peer.service.LivePeerHandle
public class LivePeerHandle
A peer handle grouping everything needed by other peers, resources and user
Constructor Summary | |
---|---|
LivePeerHandle(java.lang.String id,
java.lang.String hostname,
int peer_port,
int resource_port,
int user_port)
Create a handle to a peer |
Method Summary | |
---|---|
void |
addResource(ResourceHandle rh,
int power)
Register a resource as part of this Peer |
void |
cancelJob(int job_id)
Cancels a Job from the Peer |
void |
cancelLocalTaskOnSupplyingResource(java.lang.String supplier_id,
Task t)
Cancel a task from this Peer running on another Peer |
void |
cancelSupplyingTaskOnLocalResource(java.lang.String consumer_id,
Task t)
Cancel a task from another Peer running on this Peer |
int |
compareTo(PeerHandle other)
|
ConsumptionTaskID |
computeSupplyingTask(java.lang.String consumer_id,
Task t)
Compute a task. |
boolean |
equals(java.lang.Object obj)
|
void |
grantConsumption(java.lang.String supplier_id,
int granted_count)
Grant a consumption for a number of tasks |
int |
hashCode()
|
java.lang.String |
hostname()
|
java.lang.String |
id()
|
boolean |
isAlive()
Checks if this peer is alive (i.e. |
int |
peerPort()
|
void |
preemptLocalTaskOnLocalResource(Task t,
byte[] logs)
Cancels a task from this Peer running on this Resource |
void |
preemptSupplyingTaskOnLocalResource(java.lang.String consumer_id,
Task t,
byte[] logs)
Preempts a task from another Peer running on this Peer |
int |
queryJobStatus(int job_id)
Queries Job status from the Peer |
void |
removeResource(ResourceHandle rh)
Remove a resource from this Peer |
void |
requestSupplying(java.lang.String consumer_id,
int tasks_count)
Request this peer to supply power for a number of tasks |
int |
resourcePort()
|
int |
submitJob(UserHandle uh,
JobDescriptor jd)
Submit a job to peer |
java.lang.String |
toString()
|
void |
uploadBySupplyingCompletedTask(java.lang.String supplier_id,
Task t)
|
void |
uploadLocallyCompletedTask(Task t)
Upload a task completed by a resource to this Peer |
int |
userPort()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LivePeerHandle(java.lang.String id, java.lang.String hostname, int peer_port, int resource_port, int user_port) throws GridException
id
- Peer IDhostname
- Peer hostnamepeer_port
- Peer-to-Peer communication portresource_port
- Resource-to-Peer communication portuser_port
- User-to-Peer communication port
GridException
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(PeerHandle other)
compareTo
in interface java.lang.Comparable<PeerHandle>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String id()
id
in interface PeerHandle
public java.lang.String hostname()
hostname
in interface PeerHandle
public int peerPort()
peerPort
in interface AbstractExternalPeerHandle
public void requestSupplying(java.lang.String consumer_id, int tasks_count) throws GridException
requestSupplying
in interface AbstractExternalPeerHandle
consumer_id
- The ID of the Peer that askstasks_count
- The number of tasks consumers wished the Peer to
handle
GridException
public void grantConsumption(java.lang.String supplier_id, int granted_count) throws GridException
grantConsumption
in interface AbstractExternalPeerHandle
supplier_id
- The ID of the Peer that providesgranted_count
- The number of tasks the provider agreed to run
GridException
public ConsumptionTaskID computeSupplyingTask(java.lang.String consumer_id, Task t) throws GridException
computeSupplyingTask
in interface AbstractExternalPeerHandle
consumer_id
- The task ownert
- The task to run
GridException
public void preemptSupplyingTaskOnLocalResource(java.lang.String consumer_id, Task t, byte[] logs) throws GridException
preemptSupplyingTaskOnLocalResource
in interface AbstractInternalPeerHandle
GridException
public void cancelSupplyingTaskOnLocalResource(java.lang.String consumer_id, Task t) throws GridException
cancelSupplyingTaskOnLocalResource
in interface AbstractExternalPeerHandle
GridException
public void cancelLocalTaskOnSupplyingResource(java.lang.String supplier_id, Task t) throws GridException
cancelLocalTaskOnSupplyingResource
in interface AbstractExternalPeerHandle
GridException
public void uploadBySupplyingCompletedTask(java.lang.String supplier_id, Task t) throws GridException
uploadBySupplyingCompletedTask
in interface AbstractExternalPeerHandle
GridException
public int resourcePort()
resourcePort
in interface AbstractInternalPeerHandle
public void addResource(ResourceHandle rh, int power) throws GridException
addResource
in interface AbstractInternalPeerHandle
rh
- A handle to the concerned resource
GridException
public void removeResource(ResourceHandle rh) throws GridException
removeResource
in interface AbstractInternalPeerHandle
rh
- A handle to the concerned resource
GridException
public void preemptLocalTaskOnLocalResource(Task t, byte[] logs) throws GridException
preemptLocalTaskOnLocalResource
in interface AbstractInternalPeerHandle
t
- The task to cancel
GridException
public void uploadLocallyCompletedTask(Task t) throws GridException
uploadLocallyCompletedTask
in interface AbstractInternalPeerHandle
t
- The completed task
GridException
public int userPort()
userPort
in interface AbstractUserPeerHandle
public int submitJob(UserHandle uh, JobDescriptor jd) throws GridException
submitJob
in interface AbstractUserPeerHandle
uh
- A handle to contact the userjd
- A description of the job to submit
GridException
- if the submitting failspublic void cancelJob(int job_id) throws GridException
cancelJob
in interface AbstractUserPeerHandle
job_id
- job id
GridException
- if the cancellation failspublic int queryJobStatus(int job_id) throws GridException
queryJobStatus
in interface AbstractUserPeerHandle
job_id
- job id
GridException
- if the status querypublic boolean isAlive()
isAlive
in interface AbstractExternalPeerHandle
|
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.