XRootD
XrdCmsJob Class Reference

#include <XrdCmsJob.hh>

+ Inheritance diagram for XrdCmsJob:
+ Collaboration diagram for XrdCmsJob:

Public Member Functions

 XrdCmsJob ()
 
 ~XrdCmsJob ()
 
void DoIt ()
 
void Recycle ()
 
- Public Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 

Static Public Member Functions

static XrdCmsJobAlloc (XrdCmsProtocol *, XrdCmsRRData *)
 

Additional Inherited Members

- Public Attributes inherited from XrdJob
const char * Comment
 
XrdJobNextJob
 

Detailed Description

Definition at line 42 of file XrdCmsJob.hh.

Constructor & Destructor Documentation

◆ XrdCmsJob()

XrdCmsJob::XrdCmsJob ( )
inline

Definition at line 52 of file XrdCmsJob.hh.

52 : XrdJob("cms request job"), JobLink(0) {}
XrdJob(const char *desc="")
Definition: XrdJob.hh:51

◆ ~XrdCmsJob()

XrdCmsJob::~XrdCmsJob ( )
inline

Definition at line 53 of file XrdCmsJob.hh.

53 {}

Member Function Documentation

◆ Alloc()

XrdCmsJob * XrdCmsJob::Alloc ( XrdCmsProtocol Proto,
XrdCmsRRData Data 
)
static

Definition at line 64 of file XrdCmsJob.cc.

65 {
66  XrdCmsJob *jp;
67 
68 // Grab a protocol object and, if none, return a new one
69 //
70  JobMutex.Lock();
71  if ((jp = JobStack)) JobStack = jp->JobLink;
72  else jp = new XrdCmsJob();
73  JobMutex.UnLock();
74 
75 // Copy relevant sections to the newly allocated protocol object
76 //
77  if (jp)
78  {jp->theProto = Proto;
79  jp->theData = Data;
80  jp->Comment = Proto->myRole;
81  Proto->Link->setRef(1);
82  } else Say.Emsg("Job","No more job objects to serve",Proto->Link->Name());
83 
84 // All done
85 //
86  return jp;
87 }
const char * Comment
Definition: XrdJob.hh:47
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysError Say

References XrdJob::Comment, XrdSysError::Emsg(), XrdLink::Name(), XrdCms::Say, and XrdLink::setRef().

+ Here is the call graph for this function:

◆ DoIt()

void XrdCmsJob::DoIt ( )
virtual

Implements XrdJob.

Definition at line 93 of file XrdCmsJob.cc.

94 {
95  int rc;
96 
97 // Simply execute the method on the data. If operation started and we have to
98 // wait foir it, simply reschedule ourselves for a later time.
99 //
100  if ((rc = theProto->Execute(*theData)))
101  if (rc == -EINPROGRESS)
102  {Sched->Schedule((XrdJob *)this, theData->waitVal+time(0)); return;}
103  theProto->Ref(-1);
104  Recycle();
105 }
void Recycle()
Definition: XrdCmsJob.cc:111
void Ref(int rcnt)
int Execute(XrdCmsRRData &Data)
Definition: XrdJob.hh:43
void Schedule(XrdJob *jp)
XrdScheduler Sched
Definition: XrdLinkCtl.cc:54

References XrdCms::Sched, and XrdScheduler::Schedule().

+ Here is the call graph for this function:

◆ Recycle()

void XrdCmsJob::Recycle ( )

Definition at line 111 of file XrdCmsJob.cc.

112 {
113 
114 // Dereference the link at this point
115 //
116  theProto->Link->setRef(-1);
117 
118 // Release the data buffer
119 //
120  if (theData) {XrdCmsRRData::Objectify(theData); theData = 0;}
121 
122 // Push ourselves on the stack
123 //
124  JobMutex.Lock();
125  JobLink = JobStack;
126  JobStack = this;
127  JobMutex.UnLock();
128 }
static XrdCmsRRData * Objectify(XrdCmsRRData *op=0)
Definition: XrdCmsRRData.cc:68

References XrdCmsRRData::Objectify().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: