/
IoScheduler.java
85 lines (69 loc) · 2.06 KB
/
IoScheduler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package org.dcache.pool.classic;
import java.util.List;
import java.util.NoSuchElementException;
import diskCacheV111.vehicles.JobInfo;
import org.dcache.util.IoPriority;
/**
* @since 1.9.11
*/
public interface IoScheduler {
/**
* Add a new request to schedule.
*
* @param request to run.
* @param priority of the request.
* @return a sort hand identifier of the request
*/
public int add(PoolIORequest request, IoPriority priority);
/**
* Cancel the request. Any IO in progress will be interrupted.
* @param id
* @throws NoSuchElementException
*/
public void cancel(int id) throws NoSuchElementException;
/**
* Get the maximal number of concurrently running jobs by this scheduler.
*
* @return maximal number of jobs.
*/
public int getMaxActiveJobs();
/**
* Get current number of concurrently running jobs.
* @return number of running jobs.
*/
public int getActiveJobs();
/**
* Get number of requests waiting for execution.
* @return number of pending requests.
*/
public int getQueueSize();
/**
* Get the number of write requests running or waiting to run.
*/
public int getCountByPriority(IoPriority priority);
/**
* Set maximal number of concurrently running jobs by this scheduler. All pending
* jobs will be executed.
* @param max
*/
public void setMaxActiveJobs(int max);
/**
* Get the name of this scheduler.
* @return name of the scheduler
*/
public String getName();
/**
* Shutdown the scheduler. All subsequent execution request will be rejected.
*/
public void shutdown() throws InterruptedException;
// legacy crap
public List<JobInfo> getJobInfos();
/**
* Get job information
* @param id
* @return
* @throws NoSuchElementException if job with specified <code>id</code> does not exist
*/
public JobInfo getJobInfo(int id) throws NoSuchElementException;
public StringBuffer printJobQueue(StringBuffer sb);
}