如何在特定用户创建的marklogic中停止任务服务器

时间:2016-07-05 05:37:16

标签: marklogic

以下是我用来停止任务服务器的查询:

include stdio.h

include windows.h

int main ()

{

int i=0;

char * p = (char *)0x400000;

for(int i = 0; i < 20; i++)

{

    printf("%p %02x \n",p+i, (unsigned int)(unsigned char)*(p+i));
}

}

有人可以帮助只获取由特定用户名创建的任务服务器吗?

1 个答案:

答案 0 :(得分:2)

XML输出xdmp:server-status包含您要查找的用户信息,因此您可以对其进行过滤:

xquery version "1.0-ml";

declare namespace ss = "http://marklogic.com/xdmp/status/server";

let $user := xdmp:user("gjosten")
let $host := xdmp:host()
let $taskServer := xdmp:server('TaskServer')

for $i in (1 to 5400)
for $request in xdmp:server-status($host, $taskServer)
  //ss:request-status[ss:user = $user]/ss:request-id
return (
  try {
    xdmp:request-cancel($host, $taskServer, $request)
  } catch ($e) {
    xdmp:log("Failed to cancel requests, retrying...")
  },
  xdmp:sleep(100)
)

HTH!