243 |
|
*/ |
244 |
|
private static class ServiceThread extends Thread { |
245 |
|
|
246 |
< |
// The constructor takes the name of the method we're gonna run |
247 |
< |
// and the arguments we're gonna pass into it |
246 |
> |
/** |
247 |
> |
* The constructor takes the name of the method we're gonna run |
248 |
> |
* and the arguments we're gonna pass into it. |
249 |
> |
* |
250 |
> |
* @param mainMethod a method that we'll treat as main |
251 |
> |
* @param args an array of arguments for mainMethod |
252 |
> |
*/ |
253 |
|
ServiceThread(Method mainMethod, Object[] args) { |
254 |
|
_mainMethod = mainMethod; |
255 |
|
_args = args; |
256 |
|
} |
257 |
|
|
258 |
< |
// The main bit of the thread just starts the functionality of the given |
259 |
< |
// method running |
258 |
> |
/** |
259 |
> |
* Invokes our main method, with the arguments we |
260 |
> |
* have been given. |
261 |
> |
*/ |
262 |
|
public void run() { |
263 |
|
try { |
264 |
|
_mainMethod.invoke(null, _args); |
268 |
|
} |
269 |
|
} |
270 |
|
|
271 |
+ |
/** |
272 |
+ |
* The method we'll treat as main |
273 |
+ |
*/ |
274 |
|
Method _mainMethod = null; |
275 |
+ |
|
276 |
+ |
/** |
277 |
+ |
* The array of arguments |
278 |
+ |
*/ |
279 |
|
Object[] _args = null; |
280 |
|
} |
281 |
|
|