Download What is Jini? - Codemesh, Inc.

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Welcome
New York City
April 14, 2004
Jini and JavaSpaces
in an SOA World
by
Alexander Krapf
1
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Speaker
 Co-founder & President of Codemesh, Inc.
 16 years of C++ development experience
 7 years of Java development experience
 2 years of .NET experience
 4 years of involvement with Jini/JavaSpaces
2
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Agenda
 What is Jini?
 What is JavaSpaces?
 How does it compare with Web Services?
 Q & A (and maybe a Jini Demo)
3
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
And the question is…
What is Jini?
4
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Common Misconceptions…
I dream of Jeannie !
5
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Common Misconceptions…
 Jini is designed for devices
 Jini is Java-only
 Jini is not ready for primetime
 Jini is not supported by Sun
6
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
So what is Jini?
 Jini is the original SOA
 Jini is Java-centric
 Jini is more than ready for primetime
(just ask Orbitz)
 Jini is not very supported by Sun
Not part of J2SE platform, different license,
small (yet fiercely dedicated) team, small
marketing budget, half-hearted relaunch
7
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
If Jini is one, then what is an SOA?
A system for linking resources on demand. In an SOA, resources are made
available to other participants in the network as independent services that
are accessed in a standardized way. This provides for more flexible loose
coupling of resources than in traditional systems architectures.
whatis.com
An application architecture in which all functions, or services, are defined using a
description language and have invokable interfaces that are called to perform business
processes. Each interaction is independent of each and every other interaction and the
interconnect protocols of the communicating devices (i.e., the infrastructure
components that determine the communication system do not affect the interfaces).
Because interfaces are platform-independent, a client from any device using any
operating system in any language can use the service.
Though built on similar principles, SOA is not the same as Web services, which
indicates a collection of technologies, such as SOAP and XML. SOA is more than a
set of technologies and runs independent of any specific technologies.
Webopedia
8
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Common SOA characteristics…
Distributed
Stateless
Interface-based
Loosely coupled
Scalable
Resilient
Reliable
Secure
Easy***** to use
OS Independent
Dynamic
Protocol
Independent*
9
Language
Independent
Device
Independent
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
…and how Jini stacks up
Characteristic
10
Jini
OS Independence
via Java
Language Independence
via Codemesh tools, Judy project, …
Device Independence
via Java, Surrogates, Psinaptics, …
Protocol Independence
RMI is default, protocols easily pluggable
Statelessness
yes, by design
Distributed
yes, by design
Interface-based
yes, by design
Scalable
yes, more than anything free I’m aware of!
Resilient
yes, more than any other architecture I’m aware of!
Reliable
yes, more than any other architecture I’m aware of!
Secure
yes, configurable security models (SSL, Kerberos, …)
Dynamic
extremely, via Java, RMI, RIO project, …
Easy to use
at least for a distributed object technology!
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
So, really, what is Jini?
 the embodied consequence of Jim Waldo
et als “A Note on Distributed Computing”
 based on the acknowledgement that failure is a
normal mode of operation!
 comes packaged in a starter kit, not a reference
implementation!
 a specification of several core Services
providing discovery, transactions, and persistence
11
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Jini key concepts
 Discovery/Join protocol for bootstrapping
 the Service as a discoverable entity
 the LookupService as the gateway to
every other Service
 the Lease as a mechanism for resilient
Service life-cycle management
12
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
A Typical Jini Example
The Hello Service
public interface Hello
{
public String
sayHello()
throws RemoteException;
}
There is no Service interface that needs
to be extended!
13
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
A Typical Jini Example
Client
HelloImpl
Proxy
Lookup Service
Proxy to Impl protocol could be anything
or even nothing! Proxy could just be a
dynamically loaded interface implementation!
HelloImpl
Proxy
“Server”
HelloImpl
Lookup Service
14
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Jini Example Key Features
 Scalability via multiple Service instances
 Resilience via multiple Service instances
and Lease mechanism
 Client only requires service interface,
everything else is downloaded dynamically
 there can but does not have to be a channel
between the client and the service
 any code downloads or communications can
be protected by standard security
15
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
What’s missing?
 higher-level features related to dynamic
deployment, QoS/SLA of Services
(RIO project, ServiceContainer project, IncaX, Valaran Inc., etc.)
 Inter-Service communications
 Distributed data persistence
 Workflow/scheduling

16
JavaSpaces
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
And the question is…
What is
JavaSpaces?
17
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Common Misconceptions…
What do we
have on the
screen there
lieutenant?
It must be a
JSpace, captain!
j
18
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Common Misconceptions…
 JavaSpaces is a database
 JavaSpaces is slow
 JavaSpaces is a research project
19
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
So what is JavaSpaces?
 JavaSpaces is not a database
but it may optionally use one
 JavaSpaces is a Jini Service
thereby inheriting all Jini advantages
 JavaSpaces is … JavaSpaces
 a distributed object store/cache
 a work orchestration/distribution
mechanism
 best defined through its use
20
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
The usual illustration…
there can be multiple space instances
read, write, take are the most common operations
no modification of entries in space (take out – modify - put back)
21
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
JavaSpaces key concepts
 Space contains implementations of Entry
 Entries are mobile Java objects, not just data!
 Entries are leased from the space
 Entry operations can be transacted
 Entries are queried by example
22
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
A Computation Server Example
The interface for all computations
public class Task implements Entry {
public
public
public
public
String
String
String
Boolean
priority = null;
jobid = null;
owner = null;
done = null;
public void
execute() {};
}
A concrete tasks
public class ModelingTask extends Task {
public int[]
public int[]
inputs = null;
outputs = null;
public void
…
}
execute() {
}
23
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
A Computation Server Example
Client-side: Posting the problem
JavaSpace
space = getSpace();
ModelingTask
mt1 = new ModelingTask( “NORMAL”, “job1”, “alex” );
mt1.inputs = new int[] { 10, 20, 30 };
ModelingTask
mt2 = new ModelingTask( “NORMAL”, “job1”, “alex” );
mt2.inputs = new int[] { 20, 40, 60, 80 };
space.write( mt1, null, Lease.FOREVER );
space.write( mt2, null, Lease.FOREVER );
24
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
A Computation Server Example
Client-side: Retrieving the solution
JavaSpace
space = getSpace();
ModelingTask
template = new ModelingTask( null, “job1”, null );
template.done = Boolean.TRUE;
ArrayList
long
results = new ArrayList();
waitUntil = System.currentTimeMillis() + 60 * 1000;
while ( true ) {
long
maxWait = waitUntil – System.currentTimeMillis();
if( maxWait < 0 )
break;
Entry e = space.take( template, null, maxWait );
results.add( e );
}
25
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
A Computation Server Example
Server-side: Processing the problem
JavaSpace
space = getSpace();
Task
template = new Task( null, null, null );
template.done = Boolean.FALSE;
while ( true ) {
Transaction txn = createTransaction( 10 * 60 * 1000 );
try {
Task t = null;
t = (Task)space.take( template, txn, Long.MAX_VALUE );
if( t != null ) {
t.execute();
space.write( t, txn, Lease.FOREVER );
txn.commit();
}
}
catch( Exception e ) {
txn.abort();
}
}
26
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
And Web Services?
 Are not nearly as dynamic
 Have the “industry standard” advantage
 Are becoming less transparent/easy as
they get closer to being an SOA
 Have one big advantage: language independence!
(as long as a full protocol stack is available)

27
Codemesh JunC++ion and JuggerNET
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
JunC++ion and JuggerNET
 Tools that generate C++ or .NET/COM bindings
for arbitrary Java types
 Combine advantages of mobile Java code with
easy usability from C++ and .NET
 Plug Jini/JavaSpaces into Excel or Word via
generated .NET/COM bindings
 Write computationally expensive clients in C++
28
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
JunC++ion and JuggerNET
 Use JNI (P/Invoke) to launch an in-process
JVM in the native process
 Developer writes native code, under the hood
Java is executed
 Codebase downloads, interface invocations
are transparent
 Performance overhead between negligible and
200%, typically < 25%
29
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
What we really want
Write C# code like this:
[STAThread]
static void Main(string[] args)
{
…
Task
Entry
Task
template = new Task();
e = space.take( template, null, LeaseImpl.FORVER );
task = (Task)e;
task.execute( null );
…
}
30
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Proxy-Based Solution
What does this look like at runtime?
Proxy’
Proxy
Service
Proxy’
Proxy
Service
Runtime
Library
JVM
.NET Client
Client Process
31
Java Server
Server Process
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Proxy-Based Solution
Architectural Diagram
JVM
C
JNI
32
C#
PInvoke
DLL
Generated
Proxy
Classes
(C#)
.NET
User
API
assembly
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Literature/References
The Java Native Interface, Programmer’s Guide and Specification
by Sheng Liang, Addison-Wesley, ISBN 0-201-32577-2
Essential JNI
by Rob Gordon,
Prentice Hall, ISBN 0-136-79895-0
.NET and COM, The Complete Interoperability Guide
by Adam Nathan, SAMS, ISBN 0-672-32170-X
JNI Documentation
http://java.sun.com/products/jdk/1.2/docs/guide/jni/
JGuru
http://www.jguru.com
Stu Halloway’s Java Interop site
http://staff.develop.com/halloway
33
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Thank you!
I’ll be around
for more questions!
Codemesh, Inc.
P.O.Box 620
Carlisle, MA 01741
http://www.codemesh.com
[email protected]
34
Copyright 2004 by Codemesh, Inc.
All Rights Reserved
Related documents