@POPClass public class POPJavaJobManager extends POPJobService
| Modifier and Type | Field and Description |
|---|---|
protected Resource |
available
Currently used resources of a node
|
protected java.io.File |
configurationFile
The configuration file location
|
protected java.lang.String |
defaultNetwork
Default network UUID
|
protected Resource |
jobLimit
Total resources a job can have
|
protected java.util.Map<java.lang.Integer,AppResource> |
jobs
Number of job alive, mapped by
AppResource.id |
protected int |
maxJobs
Max number of jobs
|
protected java.util.concurrent.locks.ReentrantLock |
mutex
Mutex for some operations
|
protected java.util.Map<java.lang.String,POPNetwork> |
networks
Networks saved in this JobManager
|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
nodeExtra
Node extra information, value as List if multiple are supplied
|
protected java.lang.String |
nodeId
JobManager unique ID
|
protected java.util.concurrent.atomic.AtomicInteger |
requestCounter
Total number of requests received
|
protected Resource |
total
Max available resources of the node
|
definedMethodId, generateClassId, od, refCount| Constructor and Description |
|---|
POPJavaJobManager()
Do not call this directly, way too many methods to this so no init was added.
|
POPJavaJobManager(java.lang.String url) |
POPJavaJobManager(java.lang.String url,
java.lang.String conf) |
POPJavaJobManager(java.lang.String url,
java.lang.String[] protocols) |
POPJavaJobManager(java.lang.String url,
java.lang.String[] protocols,
java.lang.String conf) |
POPJavaJobManager(java.lang.String url,
java.lang.String[] protocols,
java.lang.String conf,
boolean localJVM,
boolean upnp) |
| Modifier and Type | Method and Description |
|---|---|
void |
applicationEnd(int popAppId,
boolean initiator)
Propagate application end at the end of an application NOTE May not the
necessary or useful, POP-Java already kill unused objects
|
void |
askResourcesDiscovery(SNRequest request,
POPAccessPoint sender)
Recursive part of the Search Node, propagate request and answer if possible
|
void |
callbackResult(SNResponse response)
Add a node to the response list
|
void |
cancelReservation(int[] req,
int howmany)
NOTE: same as POPC signature
|
void |
changeAvailableBandwidth(float limit) |
void |
changeAvailableMemory(float limit) |
void |
changeAvailablePower(float limit) |
void |
changeMaxJobBandwidth(float limit) |
void |
changeMaxJobLimit(int limit) |
void |
changeMaxJobMemory(float limit) |
void |
changeMaxJobPower(float limit) |
protected void |
cleanup()
Dead AppResources are handled here, cleaning them up.
|
POPJavaJobManager |
connectToJobmanager(POPAccessPoint ap,
java.lang.String network) |
POPNetworkDetails |
createNetwork(java.lang.String friendlyName)
Create a new network and write the Job Manager configuration file anew
|
POPNetworkDetails |
createNetwork(java.lang.String networkUUID,
java.lang.String friendlyName)
Create a new network and write the Job Manager configuration file anew.
|
int |
createObject(POPAccessPoint localservice,
java.lang.String objname,
ObjectDescription od,
int howmany,
POPAccessPoint[] objcontacts,
int howmany2,
POPAccessPoint[] remotejobcontacts)
Local request to create an object
|
void |
dump()
Dump of JobManager information
|
int |
execObj(POPString objname,
int howmany,
int[] reserveIDs,
java.lang.String localservice,
POPAccessPoint[] objcontacts)
Execute an object locally
|
protected void |
finalize()
Release waiting processes
|
POPNetworkDetails[] |
getAvailableNetworks()
The available networks in the current Job Manager
|
Resource |
getAvailableResources()
A copy of the current available resources
|
Resource |
getInitialAvailableResources()
The initial capacity of the node
|
Resource |
getJobResourcesLimit()
The upper limit for each job
|
int |
getMaxJobs()
The maximum number of simultaneous object available on the JM machine
|
java.lang.String[][] |
getNetworkNodes(java.lang.String networkUUID)
All the nodes in a network
|
java.lang.String |
getNodeId()
Unique ID for this node execution
|
SNNodesInfo |
launchDiscovery(SNRequest request,
int timeout)
Start a discovery in a POP Network
|
POPAccessPoint[] |
localTFCSearch(java.lang.String networkUUID,
java.lang.String objectName)
Looks for live TFC objects in a POP Network on this node.
|
POPAccessPoint[] |
newTFCSearchOn(POPAccessPoint ap,
java.lang.String network,
java.lang.String objectName) |
boolean |
query(java.lang.String type,
POPString value)
Query something and return a formatted string
|
void |
registerNeighbourJobmanager(POPAccessPoint ap,
java.lang.String network,
POPJavaJobManager jm) |
void |
registerNode(java.lang.String... params)
Register a node in the default POP network
|
void |
registerNode(java.lang.String networkUUID,
java.lang.String... params)
Register node to a network by supplying an array of string matching the
format in the configuration file
|
void |
registerPermanentNode(java.lang.String networkUUID,
byte[] certificate,
java.lang.String... params)
Register a new node and add its certificate to the Key Store
|
void |
registerPermanentNode(java.lang.String networkUUID,
java.lang.String... params)
Register a node and write it in the configuration file
|
boolean |
registerTFCObject(java.lang.String networkUUID,
java.lang.String objectName,
POPAccessPoint accessPoint,
java.lang.String secret)
Register a new object that will be available for connection over TFC
|
void |
removeNetwork(java.lang.String networkUUID)
Remove a network and write the Job Manager configuration file anew
|
void |
rerouteResponse(SNResponse response,
SNWayback wayback)
If we aren't the original node we transport the request back the way it came
from
|
int |
reserve(ObjectDescription od,
POPMutableFloat iofitness,
java.lang.String popAppId,
java.lang.String reqID)
NOTE: not in parent class, same signature as POPC w/ POPFloat for float
transfer Add a resource reservation Reserve a resource and return a
corresponding ID to send in
execObj(ch.icosys.popjava.core.dataswaper.POPString, int, int[], java.lang.String, ch.icosys.popjava.core.baseobject.POPAccessPoint[]) |
protected void |
selfRegister()
Contact neighbors and tell them we are alive
|
protected void |
selfUnregister()
Contact neighbors and tell them we are shutting down
|
void |
setConfigurationFile(java.lang.String configurationFile)
Change configuration file location.
|
void |
start()
Start object and parallel thread check for resources death and other timed
tasks.
|
void |
stayAlive()
Blocking method until death of this object.
|
void |
unlockDiscovery(java.lang.String requid)
Release the dispatching thread if necessary
|
void |
unregisterNode(java.lang.String... params)
Unregister a node from the default POP network
|
void |
unregisterNode(java.lang.String networkUUID,
java.lang.String... params)
Remove a node from a network
|
void |
unregisterPermanentNode(java.lang.String networkUUID,
java.lang.String... params)
Unregister a node and write it in the configuration file
|
void |
unregisterTFCObject(java.lang.String networkUUID,
java.lang.String objectName,
POPAccessPoint accessPoint,
java.lang.String secret)
Register a new object that will be available for connection over TFC
|
void |
update()
Check and remove finished or timed out resources.
|
start, stopaddSemantic, addSemantic, canKill, defineConstructor, defineMethod, deserialize, deserialize, exit, getAccessPoint, getBroker, getClassId, getClassName, getConstructorByInfo, getMethodByInfo, getMethodInfo, getMethodInfo, getOd, getPOPCReference, getSemantic, getSemantic, getThis, getThis, getTracked, getTracked, getTrackedUsers, hasDestructor, hasDestructor, initializeConstructorInfo, initializeMethodInfo, initializePOPObject, isDaemon, isTemporary, isTracking, loadPOPAnnotations, makePermanent, makeTemporary, PopRegisterFutureConnectorCertificate, printMethodInfo, serialize, setBroker, setClassId, setClassName, setOdprotected java.io.File configurationFile
protected final Resource available
protected final Resource total
protected final Resource jobLimit
protected final java.util.concurrent.atomic.AtomicInteger requestCounter
protected final java.util.Map<java.lang.Integer,AppResource> jobs
AppResource.idprotected final java.util.Map<java.lang.String,POPNetwork> networks
protected java.lang.String defaultNetwork
protected int maxJobs
protected final java.util.Map<java.lang.String,java.util.List<java.lang.String>> nodeExtra
protected final java.util.concurrent.locks.ReentrantLock mutex
protected final java.lang.String nodeId
public POPJavaJobManager()
public POPJavaJobManager(java.lang.String url)
public POPJavaJobManager(java.lang.String url,
java.lang.String[] protocols)
public POPJavaJobManager(java.lang.String url,
java.lang.String[] protocols,
java.lang.String conf)
public POPJavaJobManager(java.lang.String url,
java.lang.String[] protocols,
java.lang.String conf,
boolean localJVM,
boolean upnp)
public POPJavaJobManager(java.lang.String url,
java.lang.String conf)
public int createObject(POPAccessPoint localservice, java.lang.String objname, ObjectDescription od, int howmany, POPAccessPoint[] objcontacts, int howmany2, POPAccessPoint[] remotejobcontacts)
createObject in class POPJobServicelocalservice - The AppService of the applicationobjname - Which object we have to createod - The OD of the requesthowmany - The size of objcontactsobjcontacts - How many instances we seekhowmany2 - number of remote access points (we think)remotejobcontacts - actual access points (we think)public int execObj(POPString objname, int howmany, int[] reserveIDs, java.lang.String localservice, POPAccessPoint[] objcontacts)
objname - The object to executehowmany - How many object will be executedreserveIDs - IDs received from reserve(ch.icosys.popjava.core.baseobject.ObjectDescription, ch.icosys.popjava.core.dataswaper.POPMutableFloat, java.lang.String, java.lang.String)localservice - Application AppServiceobjcontacts - Where to answer when the object is createdpublic int reserve(ObjectDescription od, POPMutableFloat iofitness, java.lang.String popAppId, java.lang.String reqID)
execObj(ch.icosys.popjava.core.dataswaper.POPString, int, int[], java.lang.String, ch.icosys.popjava.core.baseobject.POPAccessPoint[])od - The request ODiofitness - [output] The fitness, compatibility of the request with this nodepopAppId - the application idreqID - the request idpublic void cancelReservation(int[] req,
int howmany)
req - An array of AppResource.idhowmany - Redundant for Java, number of element in arraypublic void dump()
public void start()
start in class POPServiceBasepublic boolean query(java.lang.String type,
POPString value)
type - What to queryvalue - A formatted String with some data in itpublic void changeAvailablePower(float limit)
public void changeAvailableMemory(float limit)
public void changeAvailableBandwidth(float limit)
public void changeMaxJobLimit(int limit)
public void changeMaxJobPower(float limit)
public void changeMaxJobMemory(float limit)
public void changeMaxJobBandwidth(float limit)
protected void selfRegister()
protected void selfUnregister()
public POPNetworkDetails createNetwork(java.lang.String friendlyName)
friendlyName - A name for this networkpublic POPNetworkDetails createNetwork(java.lang.String networkUUID, java.lang.String friendlyName)
networkUUID - A machine unique identifier for this networkfriendlyName - A name for this networkpublic void removeNetwork(java.lang.String networkUUID)
networkUUID - The unique name of the networkpublic void registerNode(java.lang.String networkUUID,
java.lang.String... params)
networkUUID - The name of an existing network in this JMparams - An array of String that will be processed by
POPNetworkDescriptor.createNode(java.util.List<java.lang.String>)public void unregisterNode(java.lang.String networkUUID,
java.lang.String... params)
networkUUID - The name of an existing network in this JMparams - An array of String that will be processed to
POPNetworkDescriptor.createNode(java.util.List<java.lang.String>)public void registerNode(java.lang.String... params)
params - the parameters needed to create a new node, via
POPNode.getCreationParams()public void unregisterNode(java.lang.String... params)
params - the parameters needed to create a new node, via
POPNode.getCreationParams()public void registerPermanentNode(java.lang.String networkUUID,
java.lang.String... params)
networkUUID - the network idparams - the parameters needed to create a new node, via
POPNode.getCreationParams()public void registerPermanentNode(java.lang.String networkUUID,
byte[] certificate,
java.lang.String... params)
networkUUID - the network idcertificate - the certificate associated with the nodeparams - the parameters needed to create a new node, via
POPNode.getCreationParams()public void unregisterPermanentNode(java.lang.String networkUUID,
java.lang.String... params)
networkUUID - the network idparams - the parameters needed to create a new node, via
POPNode.getCreationParams()public void update()
public Resource getAvailableResources()
public Resource getInitialAvailableResources()
public Resource getJobResourcesLimit()
public int getMaxJobs()
public java.lang.String getNodeId()
public void applicationEnd(int popAppId,
boolean initiator)
popAppId - the application idinitiator - who started the application end requestprotected void cleanup()
public void setConfigurationFile(java.lang.String configurationFile)
configurationFile - the job manager configuration filepublic POPNetworkDetails[] getAvailableNetworks()
public java.lang.String[][] getNetworkNodes(java.lang.String networkUUID)
networkUUID - the network idPOPNode.getCreationParams()public void stayAlive()
protected void finalize()
throws java.lang.Throwable
public boolean registerTFCObject(java.lang.String networkUUID,
java.lang.String objectName,
POPAccessPoint accessPoint,
java.lang.String secret)
networkUUID - The network that will contain the objectobjectName - The class of the objectaccessPoint - Where to find the object on the machinesecret - A secret to remove the objectpublic void unregisterTFCObject(java.lang.String networkUUID,
java.lang.String objectName,
POPAccessPoint accessPoint,
java.lang.String secret)
networkUUID - The network that will contain the objectobjectName - The class of the objectaccessPoint - Where to find the object on the machinesecret - A secret to remove the objectpublic POPAccessPoint[] localTFCSearch(java.lang.String networkUUID, java.lang.String objectName)
networkUUID - the network idobjectName - the kind of object we are looking forpublic SNNodesInfo launchDiscovery(SNRequest request, int timeout)
request - The request generated by POPConnector.createObject(ch.icosys.popjava.core.baseobject.POPAccessPoint, java.lang.String, ch.icosys.popjava.core.baseobject.ObjectDescription, int, ch.icosys.popjava.core.baseobject.POPAccessPoint[], int, ch.icosys.popjava.core.baseobject.POPAccessPoint[])timeout - How much time do we wait before proceeding, in case of 0 the first
answer is the one we usepublic void askResourcesDiscovery(SNRequest request, POPAccessPoint sender)
request - The propagating requestsender - Unused, send empty POPAccessPointpublic void callbackResult(SNResponse response)
response - the response from the remote nodepublic void rerouteResponse(SNResponse response, SNWayback wayback)
response - Answer to the requestwayback - The route to go back to the originpublic void unlockDiscovery(java.lang.String requid)
requid - the request id to unlock a potential semaphorepublic POPJavaJobManager connectToJobmanager(POPAccessPoint ap, java.lang.String network)
public POPAccessPoint[] newTFCSearchOn(POPAccessPoint ap, java.lang.String network, java.lang.String objectName)
public void registerNeighbourJobmanager(POPAccessPoint ap, java.lang.String network, POPJavaJobManager jm)