• 沒有找到結果。

A Java-based, General-purpose Component Framework for Dynamic

1. Introduction

1.2. A Java-based, General-purpose Component Framework for Dynamic

Component Framework for Dynamic Reconfiguration

In the previous section, we have introduced a dynamically reconfigurable environment for protocol stacks, which is a specialized application. In this section, the component framework is extended so that it can be used by general-purpose applications.

Many general-purpose, dynamic-reconfigurable systems are developed as a programming language feature (Costanza 2001; Dmitriev 2001; Hicks et al. 2001; Hjalmtysson and Gray.

1998; Malabarba et al. 2000; Orso et al. 2002). A programming language with its runtime system is dynamically reconfigurable if the types used in a program can be redefined during runtime. Dynamic reconfiguration has been implemented on several programming languages, including C++ (Hjalmtysson and Gray. 1998), Java (Costanza 2001; Dmitriev 2001;

Malabarba et al. 2000; Orso et al. 2002), and an assembly language with types (Hicks et al.

2001).

A dynamically reconfigurable programming environment should be able to perform several kinds of dynamic changes. For Java, The most fundamental kind of change is method reimplementation, in which a method is reimplemented but its arguments and return type are not changed. A more advanced one is method redefinition, which changes not only the method implementation but also the arguments and the return type of a method. Method

redefinitions can be further classified as external or internal. An external method redefinition changes the methods that are invoked by other classes. In contrast, an internal method redefinition changes only the methods that are invoked inside the class. Another one is field redefinition, such as to add a field, to remove a field, or to modify the type of a field. In addition, several classes can be changed simultaneously, which results in a multiple update.

A multiple update is not equivalent to a series of single updates. A single update cannot handle external method redefinition because both the changed class and the classes that invoke the changed one must be updated at the same time. Currently dynamically reconfigurable systems do not handle all of them very well. For example, the HotSpot Java virtual machine (Dmitriev 2001) does not permit method redefinition and field redefinition.

Although method redefinition is permitted in the work by Orso (Orso et al. 2002), the object states cannot be transferred correctly.

In addition to various kinds of change, dynamic reconfiguration can also be implemented for high-level programming languages in several ways: syntax-based, runtime-dependent, and runtime-independent. The syntax-based approach modifies both the language syntax and the corresponding runtime system (Costanza 2001). The dynamic reconfiguration interface is provided as special language syntax. The runtime system-dependent approach does not alternate the language syntax but modifies the language runtime system, and the reconfiguration interface is provided as a library (Dmitriev 2001; Malabarba et al. 2000). The runtime system-independent approach neither modifies the language syntax nor modifies the language runtime system (Hjalmtysson and Gray. 1998; Orso et al. 2002), and there are two kinds of such systems. The first (Hjalmtysson and Gray. 1998) provides a dynamic reconfiguration library written in the same language and specifies a set of programming rules for programmers to develop software modules. The second (Orso et al. 2002) uses a proxy mechanism to transform the code into a format that enables dynamic reconfiguration.

Each approach described above has both advantages and disadvantages. When using the syntax-based approach, the users have to install a language development environment that is capable of dynamic reconfiguration. Although the runtime system-dependent approach does not need a new language development environment, the users still have to install a modified language runtime system if the runtime system and applications are separated. For example, Java language users have to install a modified Java virtual machine. These two approaches are not suitable for multi-user environments because the users may not be able to install language development environments or language runtime systems. The runtime system-independent approach also has some drawbacks. For systems that specify special programming rules, these rules may make software development more difficult. For systems that use proxy and code transformation, it has been reported that some language features may not operate correctly after transformation (Orso et al. 2002).

Our goal is to provide a dynamic reconfiguration system for Java. The system has the following design goals. First, we exploit the features of the Java language and the virtual machine instead of modifying them. Second, dynamic reconfiguration should be transparent to the software modules as much as possible. Next, the system should support all kinds of dynamic changes that usually take place. Finally, the implementation technique should minimize both the runtime and reconfiguration overheads.

Therefore, the proposed system adopts the component-based solution. We provide a component framework to programmers. Following programming rules specified by the component framework, the programmer can write reusable components and use them to compose applications. Most importantly, the components can be changed at runtime by several reconfiguration operations as described earlier. This component-based solution has several advantages. First, the component framework can be used with most of the Java virtual machines, and it is compatible with most virtual machine dependent features, including Java

reflection and Java native interface (JNI) (Liang 1999). Second, when designing components, the programmer does not have to write code to transfer component state or to preserve a safe reconfiguration point. Next, most of the usually encountered changes are supported by the component framework, these includes method reimplementation, external and internal method redefinition, field redefinition, and multiple update. Finally, the normal execution and reconfiguration overheads are effectively reduced by utilizing the Java Native Interface and Java Virtual Machine Debugging Interface (JVMDI) (Sun Microsystems 2002).

The component framework has two implementations. The first focuses on portability and the second focuses on performance. Although both implementations do not modify the Java virtual machine, that is, they are runtime-system independent, the second implementation is not platform-independent because part of it is written in C. This part is compiled into a library that can be loaded by the Java virtual machine.

相關文件