|
CS 696 Emerging Technologies: Java Distributed Computing
Spring Semester, 1999
Starting Jini Services
|
|
|
Previous   
Lecture Notes Index
   Next    
© 1999, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 16-Mar-99
|
|
Contents of Doc 17, Starting Jini Services
References
How
to Write Parallel Programs: A Guide to the Perplexed
,
Nicholas Carriero and David Gelernter, ACM Computing Surveys, Sept., 1989
JavaSpacesTM
Technology Kit (JSTK) 1.0 Eval Release Notes
- Local
Web Location:
http://www-rohan.sdsu.edu/doc/jini/doc/release-notes/jstk.html
- Local
Web Location:
http://www-rohan.sdsu.edu/doc/jini/doc/release-notes/jxp.html
Starting
Jini
TM
Technology Services from the Command Line
- Local
Web Location:
http://www-rohan.sdsu.edu/doc/jini/doc/example/StartingService.html
Using
the "Start Services" GUI
- Local
Web Location:
http://www-rohan.sdsu.edu/doc/jini/doc/example/StartingServiceGUI.html
Basics
of Jini Services
Jini
1.0 Service Application Names
Service
|
Application
Name
|
|
reggie
|
Transaction
|
mahalo
|
JavaSpaces
|
outrigger
|
Rohan
and Jini
Jini
is installed on rohan at /opt/jini1_0
The
Jini jar files are at /opt/jini1_0/lib
On-line
Jini documentation is at:
http://www-rohan.sdsu.edu/doc/jini
Files
distributed With Jini
Server
Side
|
Client
Side
|
Description
|
jini-core.jar
|
none
|
Core
Jini platform interfaces and classes
|
jini-ext.jar
|
none
|
Jini
platform extension interfaces and classes
|
reggie.jar
|
reggie-dl.jar
|
Jini
Lookup service implementation
|
mahalo.jar
|
mahalo-dl.jar
|
Jini
Transaction implementation
|
outrigger.jar, transient-outrigger.jar
|
outrigger-dl.jar
|
JavaSpaces
technology implementation
|
jini-examples.jar
|
jini-examples-dl.jar
|
Lookup
Browser and Service GUI examples
|
space-examples.jar
|
space-examples-dl.jar
|
JavaSpaces
technology examples
|
tools.jar
|
none
|
ClassServer,
DepencyChecker, SerializationChecker
|
sun-util.jar
|
none
|
Development
utilities
|
pro.zip
|
none
|
ODI
classes needed by Outrigger
|
Starting
Jini Services
Jini
services can be started via command line or via a GUI.
This
document will cover starting via command line.
Starting
an HTTP Server
The
*-dl.jar files for clients can be downloaded dynamically. These files need to
be accessed via http. Any HTTP server can be used for this. Jini comes with an
HTTP server. This allows you to run your own server on any port you wish and
log the activity of the server.
The
following will start the HTTP server on rohan running on port 8888. The default
port is 8080
java -jar /opt/jini1_0/lib/tools.jar -port 8888 -dir /opt/jini1_0/lib/
Option
flags
-trees
- Cause
the HTTP server to search all the jar files in its document root and download
the class it finds
-verbose
- log
downloading
For
examples in the rest of this document I will assume that the http server is
running on fargo.sdsu.edu on port 8888
rmid
The
Jini services use rmid.
Services
register with rmid.
The
standard services (reggie, mahalo outrigger) support activation.
Once
these services have been registered, one can restart all the services by
restarting rmid.
If
rmid is not using the standard port you will have to set the system property
java.rmi.activation.port when you start each service
Jini
Lookup Service
(reggie)
Jini
1.0 allows you to use the rmiregistry instead of reggie
This
is to allow existing rmi code to work with Jini. Don’t plan on using
rmiregistry instead of the lookup service forever.
LookupDiscovery
used by Reggie employs three protocols:
- The
multicast request protocol is used by objects that need to find nearby Jini
Lookup services in a LAN environment.
- multicast
announcement protocols
- The
multicast announcement protocol is used by Jini Lookup services to periodically
announce their presence to nearby listeners.
java -jar <lookup-server-jarfile> <lookup-client-codebase>
<lookup-policy-file> <output-log-dir> <lookup-service-group>
java -jar /opt/jini1_0/lib/reggie.jar
http://fargo.sdsu.edu:8888/reggie-dl.jar
/opt/jini1_0/example/lookup/policy
/tmp/reggie_log
public
Lookup
Service related Properties
net.jini.discovery.announce
- A
Jini Lookup service will send out multicast packets announcing its existence
every N milliseconds, where N is defined by this property. Currently, the
default value of this property is 120,000 milliseconds (2 minutes).
com.sun.jini.reggie.unicastTimeout
- When
an instance of the current implementation of the Jini Lookup service uses the
unicast request protocol to communicate with a client or service attempting to
discover that lookup service, the socket connection used by the protocol will
time out after N milliseconds, where N is defined by this property. Currently,
the default value of this property is 60,000 milliseconds (1 minute).
com.sun.jini.reggie.proxy.debug
- If
set to any value, this property indicates that debugging information related to
the execution of the lookup service's proxy should be printed to System.err.
Set this property on clients if calls to the lookup service are unexpectedly
returning null values for service objects, service types, attribute set
classes, attribute sets, or attribute values.
net.jini.discovery.debug
- If
set to any value, this property indicates that debugging information related to
the execution of the Jini Discovery and Join protocols should be printed to
System.err.
net.jini.discovery.mtu
- If
set, this property must be an integer between 512 and the maximum MTU allowed
by your system. The value of this property specifies the maximum permissible
size of multicast request and announcement packets. The default value is 512.
net.jini.discovery.ttl
- If
set, this property must be an integer between 1 and 255. This property
specifies the time-to-live parameter used by both the multicast announcement
and multicast request protocol implementations. The default value is 15.
net.jini.discovery.timeout
- When
a client or service uses the unicast request protocol to communicate with a
particular lookup service, the socket connection used by the protocol will time
out after N milliseconds, where N is defined by this property. The default
value is 60,000 milliseconds (1 minute).
Jini
Transaction Manager
(mahalo)
Mahalo
- does
not actually run until clients use references to it
- uses
a thread-pool model, so transactions are handled efficiently
- transactions
are leased resources
- begins
settling transactions aggressively and backs off after successive failed attempts
java -jar <policy-property>
<use-rmi-registry-property> [rmi-registry-port-property]
<txn-manager-name-property> <txn-manager-server-jarfile>
<txn-manager-client-codebase> <security-policy-file>
<absolute-path-to-txn-log-dir> [lookup-service-group]
java -jar -Djava.security.policy=/opt/jini1_0/example/txn/policy.all
-Dcom.sun.jini.mahalo.managerName=TransactionManager
/opt/jini1_0/lib/mahalo.jar
http://'hostname':8080/mahalo-dl.jar
/opt/jini1_0/example/txn/policy.all
/tmp/txn_log
public
Mahalo's
System Properties
com.sun.jini.use.registry
- If
the com.sun.jini.use.registry property is set to a non-null value, the service
will bind itself into the RMI registry. This property must be set on the VM
that is creating the service. It is only used when creating a service from the
command line. This property has no effect on how the service binds itself into
Jini Lookup servers.
com.sun.jini.rmiRegistryPort
- If
the RMI registry is being used, this property can be used to set the port on
which the service will look for the registry. This property must be set on the
VM that is creating the Mahalo service. It is only used when creating a service
from the command line.
com.sun.jini.mahalo.managerName
- The
com.sun.jini.mahalo.managerName property defines the name associated with the
transaction manager. If the transaction manager is bound to the RMI registry,
then the value of the managerName property is the name to which it is bound. If
the transaction manager is bound to the Jini Lookup service, this name is used
to create an attribute of type net.jini.lookup.entry.Name which is associated
with the transaction manager's ServiceItem. This property must be set on the VM
that is creating the service. It is only used when creating a Mahalo service
from the command line.
java.security.policy
- When
using Mahalo, the java.security.policy property defines the path to the
security policy file for the program that sets up the transaction manager. The
security policy for transaction manager's VM should be specified by the second
command-line argument to Mahalo.
java.rmi.server.codebase
- When
using Mahalo, the java.rmi.server.codebase property determines the URL that
clients will use to load the classes of objects they get from the transaction
manager. This URL is set by the first required command-line argument.
JavaSpaces
What
is a JavaSpace
JavaSpace
is based on Linda,
developed at Yale
Linda
is a communication model of distributed computing
JavaSpace
contains data
Programs
accessing a JavaSpace can be on different machines
Operations
programs can perform on a JavaSpace
- Write
an entry into a JavaSpace
- Read
an entry from a JavaSpace that matches a template
- Read
an entry from a JavaSpace that matches a template
- Removing
the entry from the space.
- Notify
a specified object when entries that match a template are written into the
JavaSpace
JavaSpace
API
public interface JavaSpace {
public final long NO_WAIT = 0; // don’t wait at all
Lease write(Entry e, Transaction txn, long lease)
throws RemoteException, TransactionException;
Entry read(Entry tmpl, Transaction txn, long timeout)
throws TransactionException, UnusableEntryException,
RemoteException, InterruptedException;
Entry readIfExists(Entry tmpl, Transaction txn, long timeout)
throws TransactionException, UnusableEntryException,
RemoteException, InterruptedException;
Entry take(Entry tmpl, Transaction txn, long timeout)
throws TransactionException, UnusableEntryException,
RemoteException, InterruptedException;
Entry takeIfExists(Entry tmpl, Transaction txn, long timeout)
throws TransactionException, UnusableEntryException,
RemoteException, InterruptedException;
EventRegistration notify(Entry tmpl, Transaction txn,
RemoteEventListener listener, long lease,
MarshalledObject handback)
throws RemoteException, TransactionException;
Entry snapshot(Entry e) throws RemoteException;
}
JavaSpace
Implementations (outrigger)
Outrigger
has two major variants:
- com.sun.jini.outrigger.TransientSpace
-
- Data
does not persist after TransientSpace ends
- Slightly
faster than FrontEndSpace
- com.sun.jini.outrigger.FrontEndSpace
- Data
persists after FrontEndSpace ends
TransientSpace
JavaSpaces service command-line usage is:
java -jar <security-policy-property> <use-rmi-registry-property>
[rmi-registry-port-property] <javaspace-client-codebase-property>
<javaspace-name-property> <javaspace-server-jarfile>
[lookup-service-group]
java -jar -Djava.security.policy=/opt/jini1_0/example/books/policy.all
-Djava.rmi.server.codebase=http://fargo.sdsu.edu:8888/outrigger-dl.jar
-Dcom.sun.jini.outrigger.spaceName=JavaSpaces
/opt/jini1_0/lib/transient-outrigger.jar
public
FrontEndSpace
JavaSpaces service command-line usage is:
java -jar <security-policy-property> <use-rmi-registry-property>
[rmi-registry-port-property] <javaspace-name-property>
<javaspace-server-jarfile> <javaspace-client-codebase>
<security-policy-file> <persistent-log-dir> [lookup-service-group]
java -jar -Djava.security.policy=/opt/jini1_0/example/books/policy.all
-Dcom.sun.jini.outrigger.spaceName=JavaSpaces /opt/jini1_0/lib/outrigger.jar
http://fargo.sdsu.edu:8888/outrigger-dl.jar
/opt/jini1_0/example/books/policy.all
/tmp/persistentlogdir
public
JavaSpaces
Properties
java.security.policy
- When
using a TransientSpace, the java.security.policy property defines the path to
the security policy file for the server. When using FrontEndSpace, the
java.security.policy property defines the path to the security policy file for
the program that sets up the server. In the case of FrontEndSpace, the security
policy file for the VM in which the service is actually running is specified by
the second required command-line argument.
java.rmi.server.codebase
- When
using TransientSpace, the java.rmi.server.codebase property determines the URL
that clients will use to load the classes of objects they get from the space.
When using FrontEndSpace, the codebase of the VM in which the service is
running is set by the first required command-line argument.
com.sun.jini.use.registry
- If
the com.sun.jini.use.registry property is set to a non-null value, the service
will bind itself to RMI registry. This property must be set on the VM that is
creating the service. It is used only when creating a service from the command
line, as opposed to creating the service programmatically. This property has no
effect on how the service binds itself to Jini Lookup services.
com.sun.jini.rmiRegistryPort
- If
the RMI registry is being used, this property can assign the port on which the
service will look for the registry (1099 is used if this property is not set).
It is used only when creating a service from the command line, as opposed to
creating the service programmatically.
com.sun.jini.outrigger.spaceName
- The
com.sun.jini.outrigger.spaceName property defines the name associated with the
space. If the space is bound to the RMI registry, then the value of the
spaceName property is the name to which it is bound. If the space is bound to
the Jini Lookup service, this name is used to create an attribute of type
net.jini.lookup.entry.Name that is associated with the space's ServiceItem. It
is used only when creating a service from the command line, as opposed to
creating the service programmatically.
com.sun.jini.outrigger.backend.vm.options
- This
property allows extra VM command line arguments to be passed to the back-end
process associated with a FrontEndSpace. It must be set on the VM in which the
FrontEndSpace is running. The value of this property should be a string that
can be passed as an argument to the VM in which the back-end is running.
com.sun.jini.outrigger.java
- This
property specifies which java executable is used to spawn the VM in which the
back-end process runs. The value of this property must be the name of a java
executable, including its full path. The named program must be able to accept
multiple -Dpropname=value options and the -Xbootclasspath: option. If this
property is not set, a default value of "java" is used.
com.sun.jini.outrigger.backend.gcInterval
- This
property controls how aggressive the FrontEndSpace will be when garbage
collecting the persistent store. The FrontEndSpace writes directives into logs
that are consumed by a back end. This property is set to an integer which
represents how many logs must be consumed before the persistent store is
garbage collected. Once set to an integer, N, the persistent store is garbage
collected by the back end every N logs. If not specified, a default value of 5
is used. This property must be set on the VM in which the back-end process is
running
Copyright ©, All rights reserved.
1999 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.
Previous   
visitors since 16-Mar-99
   Next