File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
examples/com/splunk/examples/get_job Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -36,5 +36,21 @@ public static void main(String[] args) {
3636
3737 // Now job is done
3838 System .out .println (job .getEventCount ());
39+
40+
41+ // Using service.getJob();
42+
43+ Job job2 = service .getJob (sid );
44+
45+ while (!job2 .isDone ()) {
46+ job2 .refresh ();
47+ try {
48+ Thread .sleep (1000 );
49+ } catch (Exception e ) {
50+ System .out .println (e .getMessage ());
51+ }
52+ }
53+
54+ System .out .println (job2 .getEventCount ());
3955 }
4056}
Original file line number Diff line number Diff line change @@ -629,6 +629,16 @@ public JobCollection getJobs(Args args) {
629629 return new JobCollection (this , args );
630630 }
631631
632+ /**
633+ * Returns a Job by the provided sid.
634+ *
635+ * @param sid The sid for a job.
636+ * @return A Job.
637+ */
638+ public Job getJob (String sid ) {
639+ return new Job (this , "search/jobs/" + sid );
640+ }
641+
632642 /**
633643 * Returns a collection of license group configurations.
634644 *
You can’t perform that action at this time.
0 commit comments