KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > thread > impl > ExecutableRunnable


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.thread.impl;
9
10 import org.apache.avalon.framework.activity.Executable;
11
12 /**
13  * Class to adapt a <code>Runnable</code> object in an <code>Executable</code> object.
14  *
15  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
16  */

17 final class ExecutableRunnable
18     implements Executable
19 {
20     ///The runnable instance being wrapped
21
private Runnable JavaDoc m_runnable;
22
23     /**
24      * Create adapter using specified runnable.
25      *
26      * @param runnable the runnable to adapt to
27      */

28     protected ExecutableRunnable( final Runnable JavaDoc runnable )
29     {
30         m_runnable = runnable;
31
32         ///Verify runnable is not null
33
if( null == runnable )
34         {
35             throw new NullPointerException JavaDoc( "runnable property is null" );
36         }
37     }
38
39     /**
40      * Execute the underlying <code>Runnable</code> object.
41      *
42      * @exception Exception if an error occurs
43      */

44     public void execute()
45         throws Exception JavaDoc
46     {
47         m_runnable.run();
48     }
49 }
50
Popular Tags