xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdSsiServReal.hh
Go to the documentation of this file.
1 #ifndef __XRDSSISERVREAL_HH__
2 #define __XRDSSISERVREAL_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d S s i S e r v R e a l . h h */
6 /* */
7 /* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Department of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 #include <map>
33 #include <string>
34 
35 #include "XrdSsi/XrdSsiService.hh"
36 #include "XrdSys/XrdSysPthread.hh"
37 
38 class XrdSsiResource;
39 class XrdSsiSessReal;
40 
42 {
43 public:
44 
45 void ProcessRequest(XrdSsiRequest &reqRef, XrdSsiResource &resRef);
46 
47 void Recycle(XrdSsiSessReal *sObj, bool reuse);
48 
49 bool Stop(bool immed=false);
50 
51 void StopReuse(const char *resKey);
52 
53  XrdSsiServReal(const char *contact, int hObj)
54  : manNode(strdup(contact)), freeSes(0),
55  freeCnt(0), freeMax(hObj), actvSes(0),
56  doStop(false) {}
57 
59 private:
60 
61 XrdSsiSessReal *Alloc(const char *sName, int uent, bool hold);
62 bool GenURL(XrdSsiResource *rP, char *buff, int blen, int uEnt);
63 bool ResReuse(XrdSsiRequest &reqRef, XrdSsiResource &resRef,
64  std::string &resKey);
65 
66 std::map<std::string, XrdSsiSessReal *> resCache;
68 
69 char *manNode;
72 int freeCnt;
73 int freeMax;
74 int actvSes;
75 bool doStop;
76 };
77 #endif
char * manNode
Definition: XrdSsiServReal.hh:69
int freeCnt
Definition: XrdSsiServReal.hh:72
XrdSsiSessReal * freeSes
Definition: XrdSsiServReal.hh:71
void ProcessRequest(XrdSsiRequest &reqRef, XrdSsiResource &resRef)
Process a request; client-side or server-side.
XrdSysMutex rcMutex
Definition: XrdSsiServReal.hh:67
Definition: XrdSsiSessReal.hh:44
int freeMax
Definition: XrdSsiServReal.hh:73
Definition: XrdSsiResource.hh:42
Definition: XrdSsiServReal.hh:41
XrdSsiServReal(const char *contact, int hObj)
Definition: XrdSsiServReal.hh:53
Definition: XrdSsiService.hh:54
Definition: XrdSysPthread.hh:164
XrdSysMutex myMutex
Definition: XrdSsiServReal.hh:70
bool ResReuse(XrdSsiRequest &reqRef, XrdSsiResource &resRef, std::string &resKey)
XrdSsiSessReal * Alloc(const char *sName, int uent, bool hold)
void StopReuse(const char *resKey)
void Recycle(XrdSsiSessReal *sObj, bool reuse)
Definition: XrdSsiRequest.hh:70
bool Stop(bool immed=false)
Stop the client-side service. This is never called server-side.
std::map< std::string, XrdSsiSessReal * > resCache
Definition: XrdSsiServReal.hh:66
int actvSes
Definition: XrdSsiServReal.hh:74
bool doStop
Definition: XrdSsiServReal.hh:75
bool GenURL(XrdSsiResource *rP, char *buff, int blen, int uEnt)