01: /*
02: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
03: *
04: * http://izpack.org/
05: * http://izpack.codehaus.org/
06: *
07: * Copyright 2002 Elmar Grom
08: *
09: * Licensed under the Apache License, Version 2.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.apache.org/licenses/LICENSE-2.0
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: */
21:
22: package com.izforge.izpack.util;
23:
24: /*---------------------------------------------------------------------------*/
25: /**
26: * This class implements a thred that can be used to free native libraries safely.
27: *
28: * @version 0.0.1 / 2/6/02
29: * @author Elmar Grom
30: */
31: /*---------------------------------------------------------------------------*/
32: public class FreeThread extends Thread {
33:
34: private String name = "";
35:
36: private NativeLibraryClient client = null;
37:
38: /*--------------------------------------------------------------------------*/
39: /**
40: * Standard constructor.
41: *
42: * @param name the name of the library to free. The exact form of the name may be operating
43: * system dependent. On Microsoft Windows this must be just the library name, without path but
44: * with extension.
45: * @param client reference of the client object that is linked with the library to be freed.
46: */
47: /*--------------------------------------------------------------------------*/
48: public FreeThread(String name, NativeLibraryClient client) {
49: this .name = name;
50: this .client = client;
51: }
52:
53: /*--------------------------------------------------------------------------*/
54: /**
55: * The run() method. Frees the library. Note that the thread is likely to get 'frozen' and the
56: * application can only be treminated through a call to <code>System.exit()</code>.
57: */
58: /*--------------------------------------------------------------------------*/
59: public void run() {
60: client.freeLibrary(name);
61: }
62: }
63: /*---------------------------------------------------------------------------*/
|