00001 #ifndef __FRMXFRQUEUE_H__
00002 #define __FRMXFRQUEUE_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "XrdFrm/XrdFrmRequest.hh"
00016 #include "XrdOuc/XrdOucHash.hh"
00017 #include "XrdSys/XrdSysPthread.hh"
00018
00019 class XrdFrmReqFile;
00020 class XrdFrmRequest;
00021 class XrdFrmXfrJob;
00022
00023 class XrdFrmXfrQueue
00024 {
00025 public:
00026
00027 static int Add(XrdFrmRequest *rP, XrdFrmReqFile *reqF, int theQ);
00028
00029 static void Done(XrdFrmXfrJob *xP, const char *Msg);
00030
00031 static XrdFrmXfrJob *Get();
00032
00033 static int Init();
00034
00035 static void StopMon(void *parg);
00036
00037 XrdFrmXfrQueue() {}
00038 ~XrdFrmXfrQueue() {}
00039
00040 private:
00041
00042 static XrdFrmXfrJob *Pull();
00043 static int Notify(XrdFrmRequest *rP,int qN,int rc,const char *msg=0);
00044 static void Send2File(char *Dest, char *Msg, int Mln);
00045 static void Send2UDP(char *Dest, char *Msg, int Mln);
00046 static int Stopped(int qNum);
00047 static const char *xfrName(XrdFrmRequest &reqData, int isOut);
00048
00049 static XrdSysMutex hMutex;
00050 static XrdOucHash<XrdFrmXfrJob> hTab;
00051
00052 static XrdSysMutex qMutex;
00053 static XrdSysSemaphore qReady;
00054
00055 struct theQueue
00056 {XrdSysSemaphore Avail;
00057 XrdFrmXfrJob *Free;
00058 XrdFrmXfrJob *First;
00059 XrdFrmXfrJob *Last;
00060 XrdSysSemaphore Alert;
00061 const char *File;
00062 const char *Name;
00063 int Stop;
00064 int qNum;
00065 theQueue() : Avail(0),Free(0),First(0),Last(0),Alert(0),Stop(0) {}
00066 ~theQueue() {}
00067 };
00068 static theQueue xfrQ[XrdFrmRequest::numQ];
00069 };
00070 #endif