See: Description
Interface | Description |
---|---|
LeaseExpirationMgr.Expirer |
Interface that allows LeaseExpirationMgr to expire resources.
|
LeaseManager |
LeaseManager provides an interface for tracking lease status. |
TxnManager |
Encapsulates the interface of an implementation of a
TransactionManager . |
TxnSettler |
Class | Description |
---|---|
AbortJob |
An implementation of a
com.sun.jini.mahalo.Job which interacts with a set of
net.jini.core.transaction.server.TransactionParticipant s to inform them to roll back
changes associated with a given net.jini.core.transaction.Transaction . |
CommitJob |
An implementation of a
Job which interacts with a set of
TransactionParticipant s to inform them to roll forward changes associated with a
given Transaction . |
ExtendedPrepareResult |
prepare result returned when clusterd proxy is needed
|
Job |
A
Job manages the division of work for a problem whose solution is obtained by
assembling partial results to original problem. |
LeaseExpirationMgr |
Lease Mgr implementation that aggressively expires leases as they expiration times occur.
|
MahaloPermission |
Represents permissions that can be used to express the access control policy for the Mahalo
server exported with a
net.jini.jeri.BasicJeriExporter . |
MahaloTxnBasicLease |
TODO add Javadoc
|
ParticipantTask |
A
ParticipantTask is a general task which interacts with a participant. |
PrepareAndCommitJob |
An implementation of a
Job which interacts with a set of
TransactionParticipant s to inform them to vote and roll forward/back changes
associated with a given Transaction . |
PrepareJob |
An implementation of a
com.sun.jini.mahalo.Job which interacts with a set of
net.jini.core.transaction.server.TransactionParticipant s to inform them to vote. |
SettlerTask |
A
SettlerTask is scheduled task, which causes an unsettled transaction to settle. |
StorableObject |
This class holds a
MarshalledObject that can be stored persistently. |
TransientMahaloImpl |
Convenience class intended for use with the
ServiceStarter framework
to start a transient (non-activatable, non-persistent) implementation of Mahalo. |
TxnManagerImpl |
An implementation of the Jini(TM) Transaction Specification.
|
TxnManagerImpl.IdGenT | |
TxnMgrProxy |
A
TxnMgrProxy is a proxy for the transaction manager service. |
Exception | Description |
---|---|
JobException | |
JobNotStartedException | |
PartialResultException | |
ResultNotReadyException | |
UnknownTaskException |
com.sun.jini.start
package:
com.sun.jini.mahalo.ActivatableMahaloImpl
- an
activatable, persistent implementation, suitable for use with
SharedActivatableServiceDescriptor
com.sun.jini.mahalo.NonActivatableMahaloImpl
- a
non-activatable, persistent implementation, suitable for use with
NonActivatableServiceDescriptor
com.sun.jini.mahalo.TransientMahaloImpl
- a
transient implementation, also suitable for use with
NonActivatableServiceDescriptor
The JAR file mahalo.jar
, included in the lib
subdirectory of the Jini(TM) Technology Starter Kit (starter kit)
installation, contains the classes for the three Mahalo service
implementations. The mahalo-dl.jar
and jsk-dl.jar
files in the lib-dl
subdirectory
contain
the classes needed in the codebase for its downloaded proxies. None of the
JAR files include classes from jsk-platform.jar
, which are
included by the service starter's start.jar
JAR file, and
need to be included in the codebase of clients.
The object returned by the Administrable.getAdmin
method on a Mahalo service proxy implements JoinAdmin
and DestroyAdmin
.
This document provides the following information about Mahalo:
Configuring Mahalo
The Mahalo service implementation obtains its configuration by calling
ConfigurationProvider.getInstance
with the specified
configOptions and the class loader for the implementation
class.
The implementation supports the following configuration entries, with
component com.sun.jini.mahalo
:
• |
activationIdPreparer
| |
---|---|---|
  | Type: | ProxyPreparer
|
  | Default: |
new
|
  | Description: | The proxy preparer for the service's activation
ID. The value should not be null . This entry is
obtained at service start and restart. This entry is only used by
the activatable implementation.
Clients call the |
• |
activationSystemPreparer
| |
---|---|---|
  | Type: | ProxyPreparer
|
  | Default: |
new
|
  | Description: | The proxy preparer for the proxy for the
activation system. The value should not be null . This
entry is obtained at service start and restart. This entry is only
used by the activatable implementation.
The service calls the |
• |
discoveryManager
| |
---|---|---|
  | Type: | DiscoveryManagement
|
  | Default: |
new |
  | Description: | Supplies an object used to discover the lookup
services with which this service should register. The value should
not be null . The object returned must also implement
DiscoveryGroupManagement and DiscoveryLocatorManagement , and should be
configured initially to discover no groups or specific lookup
services. This entry is obtained at service start and restart.
|
• |
initialLookupAttributes
| |
---|---|---|
  | Type: |
|
  | Default: | new Entry[0]
|
  | Description: | Entries to include in the set of attributes the
service supplies when registering with lookup services, in
addition to ServiceInfo and BasicServiceType instances provided by
the service. An empty array or null specifies that
only the service-provided attributes should be added. The array
must not contain null elements. This entry is
obtained and used when the service is first started. Following
initial startup, the set of attributes is controlled though the
service's JoinAdmin administrable
interface.
|
• |
initialLookupGroups
| |
---|---|---|
  | Type: | String[]
|
  | Default: | new String[] { "" } /* public group */
|
  | Description: | The names of the lookup groups that the service
should discover and join. An empty array specifies that no groups
should be joined. A null value specifies that all
groups should be joined. Otherwise, the value specifies the names
of the groups to join. The array must not contain
null elements. This entry is obtained and used when
the service is first started. Following initial startup, the set
of lookup groups is controlled through the service's JoinAdmin administrable interface.
|
• |
initialLookupLocators
| |
---|---|---|
  | Type: |
|
  | Default: | new LookupLocator[0]
|
  | Description: | The locations of specific lookup services that
the service should discover and join. An empty array or
null specifies that no specific lookup services
should be joined. The array must not contain null
elements. This entry is obtained and used when the service is
first started. Following initial startup, the set of specific
lookup services is controlled through the service's JoinAdmin administrable interface.
The |
• |
leasePeriodPolicy
| |
---|---|---|
  | Type: | LeasePeriodPolicy
|
  | Default: |
new
|
  | Description: | The policy for calculating lease grants and
renewals. The value should not be null . The default
grants leases with a maximum duration of 3 hours and a default
duration of 1 hour. This entry is obtained at service start and
restart.
|
• |
loginContext
| |
---|---|---|
  | Type: | LoginContext
|
  | Default: | null
|
  | Description: | If not null , specifies the JAAS
login context to use for performing a JAAS login and supplying the
Subject to use when running the
service. If null , no JAAS login is performed. This
entry is obtained at service start and restart.
|
• |
lookupLocatorPreparer
| |
---|---|---|
  | Type: | ProxyPreparer
|
  | Default: |
new
|
  | Description: | Prepares LookupLocator instances
passed to the JoinAdmin methods. The value
should not be null . When registering with lookup
services, this service may call or use the constraints assigned to
the getRegistrar methods of LookupLocator instances
returned from this preparer. This entry is obtained at service
start and restart. This preparer needs to perform all operations needed to use a newly received lookup locator, typically including verifying trust in the lookup locator and setting constraints. The prepared lookup locator will be retained by the service in its persistent store.
The |
• |
participantPreparer
| |
---|---|---|
  | Type: | ProxyPreparer
|
  | Default: | new
|
  | Description: | Preparer for
TransactionParticipant
proxies that have joined transactions from this service
via the join
method.
This preparer is
used to prepare proxies only when they initially
join with this service.
The value should not
be null . The preparer must return a listener
which is equal to the original listener as determined by
Object.equals .
This entry is obtained at service start and restart. This preparer needs to perform all operations needed to use a newly received participant, typically including verifying trust in the participant proxy, granting permissions, and setting constraints. The prepared participant will be retained by the service in its persistent store.
The service (potentially) calls the
|
• |
persistenceDirectory
| |
---|---|---|
  | Type: | String
|
  | Default: | Required for persistent implementations: no default |
  | Description: | The directory where the service's persistent
state is recorded. The value should not be null . This
entry is obtained at service start and restart. This entry is
required for persistent implementations and is otherwise not used.
|
• |
recoveredLookupLocatorPreparer
| |
---|---|---|
  | Type: | ProxyPreparer
|
  | Default: |
new
|
  | Description: | Prepares LookupLocator instances for use when they
are recovered from persistent storage. The value should not be
null . When registering with lookup services, this
service may call or use the constraints assigned to the getRegistrar
methods of LookupLocator instances returned from this
preparer. This entry is obtained at service start and
restart. This entry is only used by persistent
implementations. This preparer needs to perform only those operations whose results are not retained in the lookup locator itself, but need to be performed in the environment in which the lookup locator is unmarshalled. Typically no operations are needed.
The |
• |
recoveredParticipantPreparer
| |
---|---|---|
  | Type: | ProxyPreparer
|
  | Default: | new
|
  | Description: | Preparer for recovered
TransactionParticipant
proxies that have been previously registered and prepared
with this service (via the TransactionManager.join method). This preparer needs to perform only those operations whose results are not retained in the participant itself, but need to be performed in the environment in which the participant is unmarshalled, typically just granting permissions.
The service (potentially) calls the
|
• |
serverExporter
| |
---|---|---|
  | Type: | Exporter
|
  | Default: |
// Activatable implementation new |
  | Description: | The object to use for exporting the service. The
value should not be null . In the activatable case,
the call to getEntry will supply the activation ID in
the data argument. This entry is obtained at service
start and restart.
|
• |
settlerPool
| |
---|---|---|
  | Type: | TaskManager
|
  | Default: | new TaskManager(
150 /* maxThreads */,
15000 /* timeout */,
1.0 /* loadFactor */
)
|
  | Description: | The pool of threads used to settle outstanding
transactions. Outstanding transactions occur when
TimeoutExpiredException
is thrown from versions of
abort
and
commit
that take a timeout parameter.
The terminate
method of this object will be called when the service is
destroyed. Obtained at service start and restart.
|
• |
taskPool
| |
---|---|---|
  | Type: | TaskManager
|
  | Default: | new TaskManager(
50 /* maxThreads */,
15000 /* timeout */,
3.0 /* loadFactor */
)
|
  | Description: | The pool of threads used to settle
transactions.
The terminate
method of this object will be called when the service is
destroyed. Obtained at service start and restart.
|
LookupDiscoveryManager
, used to discover
lookup services, as specified by the
discoveryManager
configuration entry
JoinManager
, used to manage lookup service
registrations
Access Control Permission Targets
The following table lists the remote methods on Mahalo's proxy objects and
the associated target names for enforcing access control using MahaloPermission
:
Proxy Method | Target Name |
---|---|
TransactionManager.create
| create |
TransactionManager.join
| join |
TransactionManager.getState
| getState |
TransactionManager.commit
| commit |
TransactionManager.abort
| abort |
Lease.renew
| renew |
Lease.cancel
| cancel |
LeaseMap.renewAll
| renewAll |
LeaseMap.cancelAll
| cancelAll |
Administrable.getAdmin
| getAdmin |
JoinAdmin.getLookupAttributes
| getLookupAttributes |
JoinAdmin.addLookupAttributes
| addLookupAttributes |
JoinAdmin.modifyLookupAttributes
| modifyLookupAttributes |
JoinAdmin.getLookupGroups
| getLookupGroups |
JoinAdmin.addLookupGroups
| addLookupGroups |
JoinAdmin.removeLookupGroups
| removeLookupGroups |
JoinAdmin.setLookupGroups
| setLookupGroups |
JoinAdmin.getLookupLocators
| getLookupLocators |
JoinAdmin.addLookupLocators
| addLookupLocators |
JoinAdmin.removeLookupLocators
| removeLookupLocators |
JoinAdmin.setLookupLocators
| setLookupLocators |
DestroyAdmin.destroy
| destroy |
ProxyTrust.getProxyVerifier
| getProxyVerifier |
ServiceProxyAccessor.getServiceProxy
| getServiceProxy |
Loggers and Logging Levels
The Mahalo service implementation uses separate Logger
s, prefixed by com.sun.jini.mahalo
,
for each type of information it logs. The following tables describe the
type of information logged as well as the levels of information logged.
Level | Description |
---|---|
HANDLED | for exceptions handled during failed service destruction |
FINEST | for low level operation tracing during service destruction |
Level | Description |
---|---|
SEVERE | for problems that prevent service startup |
CONFIG | for configuration access during service initialization |
HANDLED | for exceptions handled during service initialization |
FINEST | for low level operation tracing during service initialization |
Level | Description |
---|---|
FINER | for method level tracing during service operation |
Level | Description |
---|---|
FINEST | for low level participant processing tracing (join, commit, abort, etc.) |
Level | Description |
---|---|
SEVERE | for problems that prevent service operation |
WARNING | for problems making modifications to persistent storage, unexpected internal errors |
HANDLED | for exceptions handled when persisting service state |
FINEST | for low level persistence tracing |
Level | Description |
---|---|
INFO | for successful service creation message. |
Level | Description |
---|---|
WARNING | for internal errors managing transactions |
HANDLED | for indefinite exceptions managing transactions |
FINEST | for low level transaction operation tracing (creation, commit, abort, etc.) |
See the LogManager
class for one way to use
the HANDLED
logging level in standard logging configuration
files.
Examples for Running Mahalo
This section provides examples of running Mahalo in various configurations.
Assumptions for Running the Examples
The examples below make the following assumptions:
com.sun.jini.tool.ClassServer
class for this purpose.
com.sun.jini.phoenix
implementation for this purpose.
Throughout the example, items in bold need to be
customized for your local environment.
Starting Transient Mahalo using JRMP
To run a transient Mahalo, which does not store any information
persistently or use the activation system to restart itself, using JRMP
for remote communication, run the following command.
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/start.jar \ config_dir/start-transient-jrmp-mahalo.config
This configuration uses the following files.
File config_dir/jsk-all.policy
Use this security policy file for starting and running all Mahalo
configurations. This file grants all permissions to local code included
in the lib
subdirectory of the starter kit installation.
grant codebase "file:install_dir/lib/*" { permission java.security.AllPermission; };
import com.sun.jini.start.NonActivatableServiceDescriptor; import com.sun.jini.start.ServiceDescriptor; com.sun.jini.start { private static codebase = "http://your_host:http_port/mahalo-dl.jar" + " http://your_host:http_port/jsk-dl.jar"; private static policy = "config_dir/jsk-all.policy"; private static classpath = "install_dir/lib/mahalo.jar"; private static config = "config_dir/transient-jrmp-mahalo.config"; static serviceDescriptors = new ServiceDescriptor[] { new NonActivatableServiceDescriptor( codebase, policy, classpath, "com.sun.jini.mahalo.TransientMahaloImpl", new String[] { config }) }; }
import net.jini.jrmp.JrmpExporter; com.sun.jini.mahalo { initialLookupGroups = new String[] { "your.group" }; serverExporter = new JrmpExporter(); }
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/start.jar \ config_dir/start-persistent-jrmp-mahalo.config
Note: Because JRMP does not provide a convenient way to specify the same object ID each time a given object is exported, this configuration is only useful for debugging -- an existing service proxy cannot be used after the service is restarted.
This configuration uses the following additional files.
File config_dir/start-persistent-jrmp-mahalo.config
Use this configuration source file to start persistent Mahalo using
JRMP.
import com.sun.jini.start.NonActivatableServiceDescriptor; import com.sun.jini.start.ServiceDescriptor; com.sun.jini.start { private static codebase = "http://your_host:http_port/mahalo-dl.jar" + " http://your_host:http_port/jsk-dl.jar"; private static policy = "config_dir/jsk-all.policy"; private static classpath = "install_dir/lib/mahalo.jar"; private static config = "config_dir/persistent-jrmp-mahalo.config"; static serviceDescriptors = new ServiceDescriptor[] { new NonActivatableServiceDescriptor( codebase, policy, classpath, "com.sun.jini.mahalo.NonActivatableMahaloImpl", new String[] { config }) }; }
import net.jini.jrmp.JrmpExporter; com.sun.jini.mahalo { initialLookupGroups = new String[] { "your.group" }; persistenceDirectory = "config_dir/mahalo.log"; serverExporter = new JrmpExporter(); }
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/start.jar \ config_dir/start-activatable-jrmp-mahalo.config
You should remove the config_dir/group.log directory before running this command. Note that the activation system will restart the activatable Mahalo service as needed until Mahalo is shutdown.
Remember to remove the config_dir/mahalo.log directory before running this command if you want Mahalo to forget registrations and settings made in previous invocations.
This configuration uses the following additional files.
File config_dir/start-activatable-jrmp-mahalo.config
Use this configuration source file to start activatable Mahalo using
JRMP.
import com.sun.jini.start.ServiceDescriptor; import com.sun.jini.start.SharedActivatableServiceDescriptor; import com.sun.jini.start.SharedActivationGroupDescriptor; com.sun.jini.start { private static mahaloCodebase = "http://your_host:http_port/mahalo-dl.jar" + " http://your_host:http_port/jsk-dl.jar"; private static mahaloPolicy = "config_dir/jsk-all.policy"; private static mahaloClasspath = "install_dir/lib/mahalo.jar"; private static mahaloConfig = "config_dir/activatable-jrmp-mahalo.config"; private static groupPolicy = "config_dir/jsk-all.policy"; private static groupClasspath = "install_dir/lib/sharedvm.jar"; private static groupPersistenceDirectory = "config_dir/group.log"; static serviceDescriptors = new ServiceDescriptor[] { new SharedActivationGroupDescriptor( groupPolicy, groupClasspath, groupPersistenceDirectory, null /* serverCommand */, null /* serverOptions */, null /* serverProperties */), new SharedActivatableServiceDescriptor( mahaloCodebase, mahaloPolicy, mahaloClasspath, "com.sun.jini.mahalo.ActivatableMahaloImpl", groupPersistenceDirectory, new String[] { mahaloConfig }, true /* restart */) }; }
import java.rmi.activation.ActivationID; import net.jini.jrmp.JrmpExporter; com.sun.jini.mahalo { initialLookupGroups = new String[] { "your.group" }; persistenceDirectory = "config_dir/mahalo.log"; serverExporter = new JrmpExporter((ActivationID) $data, 0); }
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/destroy.jar \ config_dir/stop-activatable-mahalo.config
Running this command will remove the config_dir/group.log directory.
Note that this command does not actually destroy the service itself, but just destroys the activation group the service is running in. You may want to first destroy the service using Mahalo's administrable interface, or to remove the config_dir/mahalo.log directory after destroying the activation group.
This command uses the following additional file.
File config_dir/stop-activatable-mahalo.config
Use this configuration source file to destroy the activation group for
an activatable Mahalo.
import com.sun.jini.start.ServiceDescriptor; import com.sun.jini.start.SharedActivatableServiceDescriptor; com.sun.jini.start { private static codebase = "http://your_host:http_port/group-dl.jar"; private static policy = "config_dir/jsk-all.policy"; private static classpath = "install_dir/lib/group.jar"; private static persistenceDirectory = "config_dir/group.log"; static serviceDestructors = new ServiceDescriptor[] { new SharedActivatableServiceDescriptor( codebase, policy, classpath, "com.sun.jini.start.SharedGroupImpl", persistenceDirectory, null /* config */, false /* restart */) }; }
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/start.jar \ config_dir/start-transient-mahalo.config
This configuration uses the following additional files.
File config_dir/start-transient-mahalo.config
Use this configuration source file to start transient Mahalo using
Jini ERI.
import com.sun.jini.start.NonActivatableServiceDescriptor; import com.sun.jini.start.ServiceDescriptor; com.sun.jini.start { private static codebase = "http://your_host:http_port/mahalo-dl.jar" + " http://your_host:http_port/jsk-dl.jar"; private static policy = "config_dir/jsk-all.policy"; private static classpath = "install_dir/lib/mahalo.jar"; private static config = "config_dir/transient-mahalo.config"; static serviceDescriptors = new ServiceDescriptor[] { new NonActivatableServiceDescriptor( codebase, policy, classpath, "com.sun.jini.mahalo.TransientMahaloImpl", new String[] { config }) }; }
com.sun.jini.mahalo { initialLookupGroups = new String[] { "your.group" }; }
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/start.jar \ config_dir/start-persistent-mahalo.config
This configuration uses the following additional files.
File config_dir/start-persistent-mahalo.config
Use this configuration source file to start persistent Mahalo using Jini
ERI.
import com.sun.jini.start.NonActivatableServiceDescriptor; import com.sun.jini.start.ServiceDescriptor; com.sun.jini.start { private static codebase = "http://your_host:http_port/mahalo-dl.jar" + " http://your_host:http_port/jsk-dl.jar"; private static policy = "config_dir/jsk-all.policy"; private static classpath = "install_dir/lib/mahalo.jar"; private static config = "config_dir/persistent-mahalo.config"; static serviceDescriptors = new ServiceDescriptor[] { new NonActivatableServiceDescriptor( codebase, policy, classpath, "com.sun.jini.mahalo.NonActivatableMahaloImpl", new String[] { config }) }; }
The obj_port is the fixed TCP port to use for listening for requests for this object. The obj_UUID_string is the universally unique ID for the exported object. These IDs have the formimport net.jini.id.UuidFactory; import net.jini.jeri.BasicILFactory; import net.jini.jeri.BasicJeriExporter; import net.jini.jeri.tcp.TcpServerEndpoint; com.sun.jini.mahalo { initialLookupGroups = new String[] { "your.group" }; persistenceDirectory = "config_dir/mahalo.log"; serverExporter = new BasicJeriExporter( TcpServerEndpoint.getInstance(obj_port), new BasicILFactory(), false, true, UuidFactory.create("obj_UUID_string")); }
"01234567-89ab-cdef-0123-456789abcdef"
.
Remember to remove the config_dir/mahalo.log directory
before restarting persistent Mahalo if you want it to forget registrations
and settings made in previous invocations.
Starting Activatable Mahalo using Jini ERI
To run an activatable Mahalo, which stores information persistently and
uses the activation system to restart itself, using Jini ERI for remote
communication, run the following command.
java -Djava.security.policy=config_dir/jsk-all.policy \ -jar install_dir/lib/start.jar \ config_dir/start-activatable-mahalo.config
You should remove the config_dir/group.log directory before running this command. Note that the activation system will restart the activatable Mahalo service as needed until Mahalo is shutdown.
Remember to remove the config_dir/mahalo.log directory before running this command if you want Mahalo to forget registrations and settings made in previous invocations.
This configuration uses the following additional files.
File config_dir/start-activatable-mahalo.config
Use this configuration source file to start activatable Mahalo using Jini
ERI.
import com.sun.jini.start.ServiceDescriptor; import com.sun.jini.start.SharedActivatableServiceDescriptor; import com.sun.jini.start.SharedActivationGroupDescriptor; com.sun.jini.start { private static mahaloCodebase = "http://your_host:http_port/mahalo-dl.jar" + " http://your_host:http_port/jsk-dl.jar"; private static mahaloPolicy = "config_dir/jsk-all.policy"; private static mahaloClasspath = "install_dir/lib/mahalo.jar"; private static mahaloConfig = "config_dir/activatable-mahalo.config"; private static groupPolicy = "config_dir/jsk-all.policy"; private static groupClasspath = "install_dir/lib/sharedvm.jar"; private static groupPersistenceDirectory = "config_dir/group.log"; static serviceDescriptors = new ServiceDescriptor[] { new SharedActivationGroupDescriptor( groupPolicy, groupClasspath, groupPersistenceDirectory, null /* serverCommand */, null /* serverOptions */, null /* serverProperties */), new SharedActivatableServiceDescriptor( mahaloCodebase, mahaloPolicy, mahaloClasspath, "com.sun.jini.mahalo.ActivatableMahaloImpl", groupPersistenceDirectory, new String[] { mahaloConfig }, true /* restart */) }; }
com.sun.jini.mahalo { initialLookupGroups = new String[] { "your.group" }; persistenceDirectory = "config_dir/mahalo.log"; }
TransactionManager
Copyright © GigaSpaces.