Design of Distributed Architecture Based on Java Remote Dessalew
Design of Distributed Architecture Based on Java Remote Dessalew
Abstract—Remote method invocation is a distributed object DNA transplant and the effectiveness of the J2EE
model for the Java programming language that making architecture, Windows DNA includes the COM+
distributed objects easy to implement and tousle. Remote components and can only be applied to the Windows
method invocation applications are often comprised of two operation systems, and J2EE may be don’t meet system
separate programs: a Server and a Client. A typical server requirements or economic conditions are not allowed.
application creates a number of remote objects, makes Therefore, in face of different application demands and
references to those remote objects accessible, and waits for application types, there is still a lot of research space in the
clients to invoke methods on those remote objects. In view of architecture design of the system. With respect of the
the needs of the organization’s business and cross-platform
current popular web-based distributed application system,
of the system, the distributed object technology and
component technology based on the java platform is an ideal
from the point of the software design, this article puts
choice of the large-scale distributed application system of the forward the distributed architecture based on the Java
development of the enterprise. With respect to the current remote method invocation (RMI) technology [2].
popular web-based distributed application system, from the
II. ADVANTAGES OF RMI TECHNOLOGY
point of the software design, this article puts forward the
distributed architecture based on the java remote method At present, there are three main popular computer
invocation technology, and in the actual design and industry standards of the distributed object technology:
development have got more satisfactory results. Microsoft’s DCOM (Distributed Component Object
Model), CORBA (Common Object Requests Broker
Keywords- java;remote method invocation; javabeans; Architecture) of OMG (Object Management Group), and
distributed architecture; enterprise java bean Java RMI (Remote Method Invocation) of Sun
Microsystems. Because of the platform limitations of
I. INTRODUCTION DCOM and the complexity of the realization of CORBA,
The development of the network technology promotes Java technology is widely used in the distributed system.
the information management and the application mode of For the distributed computing, Java provides a series of
the enterprise to develop towards two directions. On the easy and useful solutions. Through supporting the Java
one hand, from the traditional C/S architecture to the browser, the Java Applet technology can be used to
structure mode of the web system that is based on the construct the user interface or carry out simple operations
multi-layer; on the other hand, the network environment in the aspect of downloading the class files of the client;
transfers from the concentrated processing environment to Java Bean technology provides a kind of way that creates
the distributed processing environment [1]. reusable components; Java RMI provides remote method
The distributed object technology and component invocation; JDBC simplifies the operation between the
technology has been largely applied to the web-based internal objects and external databases [3].
multi-layered technology. The web-based multi-layered RMI applications are often comprised of two separate
application architecture not only can well solve the programs: a Server and a Client. A typical server
problem of maintenance of the client, but also can carried application creates a number of remote objects, makes
out a more detailed breakdown and allocation for the references to those remote objects accessible, and waits for
application of logic through the introduction of clients to invoke methods on those remote objects. A
middleware technology. The distributed object technology typical client application gets a remote reference to one or
makes all objects in the software system can present in any more remote objects in the server and then invokes method
place in the network and can be visited by other objects in son them [4]. Java RMI is a pure java distributed
the remote place, which provides strong support for the computing solution. RMI is allowed to prepare distributed
realization of the reusable components. Application of object in java and allows the object to communicate each
component technology, the design and development of other in memory, objects can communicate across the java
each functional module can be divided and ruled, and the virtual machine and can also across the physical devices.
software reusability can be improved. The RMI object is composed of remote interfaces and
These theories and technologies provide a good support its implementations, when the RMI client makes use of
for the distributed application based on web. On the whole, these methods to visit remote interfaces, these method calls
although the general methodology and technology about will be transmitted to the RMI server across the network.
the architecture and components generally matures, there The RMI server makes use of these methods to visit the
are still some questions, such as the problems of Windows objects that RMI realized and then puts the results back to
619
… //Get IP address and port of RMI server
} …
} public String rmiUrl = "//" + rmiServer + ":"
public void registerManager() throws + rmiPort;
RemoteException, MalformedURLException { try {
somDep = new someDepartmentImpl(); // Search remote object through its name, and
String url = "//" + rmiServer + ":" + rmiPort + "/"; return the remote interface reference
// Bind on the name of remote object at its reference somDep = (someDepartment)
Naming.rebind (url + "someDepartment",somDep); Naming.lookup ( rmiUrl+
… "someDepartment" );
// The same way to deal with other remote object //Search other remote objects
} …
public companyServer() { }
init(); catch ( Exception ex) {
try { // Exception handing
registerManager() ; …
} }
catch ( Exception ex) { }
// Exception handing public someMethod() throws RemoteException {
… return somDep.someMethod();
} }
public static void main ( String[ ] args) { //Calls all the remote methods of remote object
companyServer server = new companyServer(); …
java.lang.Object sync = new java.lang.Object() ; }
synchronized (sync) {
try{ IV. THE TRANSPLANT TOWARDS THE EJB
// Wait for the request of the client at The distributed applications by use the architecture
Services design and development of this article presents can be
sync.wait() ; required easy to transplant to the EJB at the time. In the
} following, this article introduces the conversion between
catch ( InterruptedException ie) { them [9].
// Exception handing This article assumes to express the defined remote
… interface with the interface function, realize the service
} method that the interface defined with the “interfaceImpl”,
} and express the client with the “RMIclient”. One EJB
} component needs two interfaces, one is used to get a
B. Design and implementation of the Client handle on the container (EJBHome), and another is used to
publish the provided services (EJBObject).
In the framework that this article proposed, JavaBeans According to the previous assumption, for EJB
don’t package the implementation of the business logic components, the conventionally way of naming is:
like the usual, in fact it doesn’t do any specific things, and interfaceBean, interface, interfaceHome 。 Under the
only carries out re-package of the client of the RMI, this environment of EJB, interface extend EJBobject, its
makes the system easier to do the expansion and defined method with the interface in the RMI system is the
maintenance, there is always only one JavaBeans in the same method, but this interface is no longer extend the
entire system, it almost doesn’t have an impact on the Remote interface, and it is extend EJBObject.
JavaBeans regardless of the increase or decrease of the InterfaceBean is an enterprise Bean, it realizes the
business, it can be looked as an another abstract of the sessionBean interface, and this interface has an ejbCreate
business logic in the JavaBeans and make use of method, regardless when to use the create method in the
JavaBeans ’ characteristics. The API of JavaBeans interfaceHome, ejbCreate method will be called.
provides a standard format for the java class, the user This article uses the ejbCreate method and the
needn’t direct the preparation of any code and can setsessionContext method to substitute the main function
manipulate these categories, as well as model Ⅰ (JSP+ of the RMI system in the interfaceBean. In addition,
JavaBeans) and model Ⅱ(JSP+ Servlets+ JavaBeans) [8]. SessionBean class includes some methods to manage Bean:
The design at that layer makes the developers call the ejbCreate method, ejbRemove method, ejbActivate
implementation of the business logic at that layer more method, ejbPassivate method, etc.
conveniently and more efficiently. Here, we make a brief
introduction about the implementation. TABLE I. RMI AND EJB CONVERSION TABLE
RMI EJB
public class companyBeans RMI Client EJBClient
{ interfaceImpl interfaceBean
public someDepartment somDep = null;
Interface interface
public void setRmi()
{ interfaceHome
620
V. CONCLUSIONS
This article puts forward a kind of distributed
architecture based on the java RMI technology. This
architecture of the system is definite and has reduced the
complexity of development, which has good scalability
and flexibility making the system easier to maintain.
Compared to the architecture Servlet/JSP and JavaBeans, it
can adapt to a more large-scale distributed applications.
Considered fully from the point of the economy, it has
reduced the development cost and it can quickly transplant
towards the application server of better performance and
more expensive when it can meet the system requirements
and the economic conditions is allowed. The architecture
design of the system is a very complicated job, involving a
lot of related technology and theory. This article only
discussed it from one aspect, and there are a lot of
questions worthy of further resolving and studying.
ACKNOWLEDGMENTS
The work was partly supported by the Foundation of
Hubei Provincial Department of Education (Grant No.
B20081705 , 2008d062).
REFERENCES
[1] Chung-Kai Chen, Cheng-Wei Chen, “Mobile Java RMI support
over heterogeneous wireless networks: A case study,” Journal of
Parallel and Distributed Computing, vol.68, pp.1425-1436,
Nov.2008.
[2] Martin Alt, Sergei Gorlatch, “Adapting Java RMI for grid
computing,” Future Generation Computer Systems, vol. 21,
pp.699-707, 2005.
[3] Juric, M.B, Rozman, I.G, “Performance comparison of CORBA
and RMI,” Information&Software Technology, vol. 42, pp.915-935,
2000.
[4] Sun Microsystems, Inc., “Java Remote Method Invocation
Specification,” Apr.2009, http://java.sun.com/j2se/1.5/pdf/rmi-
spec-1.5.0.pdf .
[5] Cs.columbia,“Remote Method Invocation, ” Apr. 2009,
http://www1.cs.columbia.edu/~lok/3101/lectures/06-rmi.pdf.
[6] Chih-Chieh Yang, Chung-Kai Chen, Yu-Hao Chang, ect.,
“Software architecture design for streaming Java RMI,” Science of
Computer Programming, vol. 70, pp. 168-184, 2008.
[7] Matjaz B. Juric, Ivan Rozman, Bostjan Brumen, etc., “Comparison
of performance of Web services,WS-Security, RMI, and RMI–
SSL,” Journal of Systems and Software, vol. 79, pp. 689-700,
2006.
[8] Alexander Ahern, Nobuko Yoshida, “Formalising Java RMI with
explicit code mobility,” Theoretical Computer Science, vol.389,
pp341-410, 2007.
[9] T. F. Lunney, A. J. McCaughey, “Component based distributed
systems – CORBA and EJB in context,” Computer Physics
Communications, vol. 127, pp.207-214, 2000.
621