com.sun.jini.norm
Class NormServerBaseImpl

java.lang.Object
  extended by com.sun.jini.norm.NormServerBaseImpl
All Implemented Interfaces:
DestroyAdmin, Landlord, LocalLandlord, NormServer, ServiceProxyAccessor, Remote, Administrable, JoinAdmin, ProxyAccessor, LeaseRenewalService, ServerProxyTrust
Direct Known Subclasses:
ActivatableNormServerImpl, PersistentNormServerImpl, TransientNormServerImpl

abstract class NormServerBaseImpl
extends Object
implements NormServer, LocalLandlord, ServerProxyTrust, ProxyAccessor

Base class for implementations of NormServer. Provides a complete non-activatable (but still logging) implementation.

Author:
Sun Microsystems, Inc.

Nested Class Summary
private static class NormServerBaseImpl.CountLeases
          Keeps track of the number of leases.
private  class NormServerBaseImpl.DestroyThread
          Termination thread code.
(package private)  class NormServerBaseImpl.InitException
          Simple container for an alternative return a value so we can provide more detailed diagnostics.
private  class NormServerBaseImpl.OurLogHandler
          Implementation of LogHandler used by NormServerBaseImpl
private static class NormServerBaseImpl.ReadyState
          Prevents access to the service before it is ready or after it starts to shutdown.
private  class NormServerBaseImpl.RenewLogThread
           
private  class NormServerBaseImpl.SendMonitorImpl
          The implementation of SendMonitor we use to track event delivery threads.
private  class NormServerBaseImpl.SnapshotThread
          Thread that performs the actual snapshots, done in a separate thread so it will not hang up in-progress remote calls
 
Nested classes/interfaces inherited from interface com.sun.jini.landlord.Landlord
Landlord.RenewResults
 
Field Summary
private  AdminProxy adminProxy
          Admin proxy
private  NormServerBaseImpl.CountLeases countLeases
          Keep track of the number of leases.
private static int CURRENT_LOG_VERSION
          Current version of log format
private  LeaseExpirationMgr expMgr
          Object that expires sets and generates expiration warning events
(package private)  Exporter exporter
          The exporter for exporting and unexporting
private  EventTypeGenerator generator
          Object used to generate new event types
private  UIDGenerator idGen
          Factory we use to create ClientLeaseWrapper IDs
private  boolean isolateSets
          Whether to isolate leases in their own renewal sets as opposed to batching leases across sets.
private  JoinState joinState
          Our JoinManager
private  LeaseFactory leaseFactory
          Factory for creating leases
private  ProxyPreparer leasePreparer
          Proxy preparer for leases supplied through the API
private  LifeCycle lifeCycle
          Object to notify when this service is destroyed, or null
private  ProxyPreparer listenerPreparer
          Proxy preparer for listeners supplied through the API
private  ProxyPreparer locatorPreparer
          Proxy preparer for lookup locators supplied through the API, and not including initial lookup locators.
(package private) static Logger logger
          Logger for logging information about this instance
(package private)  LoginContext loginContext
          The login context, for logging out
private  int logToSnapshotThresh
          Log file must contain this many records before snapshot allowed
private  LeaseRenewalManager lrm
          Lease renewal manager that actually renews the leases
private  LRMEventListener lrmEventListener
          Object that transfers events from the renewal manager to us so we can remove dead leases and send events
(package private) static String NORM
          Logger and configuration component name for Norm
(package private)  LeaseRenewalService normProxy
          Outer service proxy
(package private)  String persistenceDirectory
          The location of our persistent storage, or null if not persistent.
(package private)  boolean persistent
          Whether this server is persistent.
private  NormServerBaseImpl.ReadyState ready
          Lock protecting startup and shutdown
private  ProxyPreparer recoveredLeasePreparer
          Proxy preparer for leases recovered from persistent storage, or null if not persistent.
private  ProxyPreparer recoveredListenerPreparer
          Proxy preparer for listeners recovered from persistent storage, or null if not persistent.
private  ProxyPreparer recoveredLocatorPreparer
          Proxy preparer for lookup locators recovered from persistent storage, or null if not persistent.
private  List renewedList
          List of leases that have been renewed but not persisted
private  NormServerBaseImpl.RenewLogThread renewLogger
          Thread that pulls wrapped client leases off the renewedList and logs them to disk
(package private)  NormServer serverProxy
          Inner server proxy
private  Uuid serverUuid
          The unique ID for this server.
private  LeasePeriodPolicy setLeasePolicy
          Policy we use for granting and renewing renewal set leases
private  Map setTable
          Map of Uuids to LeaseSets
private  NormServerBaseImpl.SnapshotThread snapshotter
          Thread that performs snapshots when signaled
private  float snapshotWt
          Weight factor applied to snapshotSize when deciding to take snapshot
private  PersistentStore store
          Our persistant store
 
Fields inherited from interface com.sun.jini.norm.NormServer
NO_LISTENER
 
Constructor Summary
NormServerBaseImpl(boolean persistent)
          Creates an instance of this class.
 
Method Summary
private  void add(LeaseSet set, Lease leaseToRenew, long membershipDuration, long renewDuration)
          Add the lease to the set.
 void addLookupAttributes(Entry[] attrSets)
          Add attribute sets for the service.
 void addLookupGroups(String[] groups)
          Add new groups to the set to join.
 void addLookupLocators(LookupLocator[] locators)
          Add locators for specific new lookup services to join.
 void cancel(Uuid cookie)
          Called by the lease when its cancel method is called.
 Map cancelAll(Uuid[] cookies)
          Called by the lease map when its cancelAll method is called.
 LeaseRenewalSet createLeaseRenewalSet(long leaseDuration)
          Create a new LeaseRenewalSet that the client can populate with leases to be renewed.
(package private)  void desiredExpirationReached(ClientLeaseWrapper clw)
          Remove a lease that has reached its desired expiration.
 void destroy()
          Destroy the service, if possible, including its persistent storage.
private static void ensureCurrent(LeaseSet set)
          Throw a NoSuchObjectException, wrapped in a ThrowThis, if the passed set has expired.
(package private)  void expireIfTime(LeaseSet set)
          Remote a set if its expiration time has been reached.
 Object getAdmin()
          Returns an object that implements whatever administration interfaces are appropriate for the particular service.
(package private)  Exporter getExporter(Configuration config)
          Returns the exporter to use to export this server.
 GetLeasesResult getLeases(Uuid id)
          Return all the leases in the set.
 Entry[] getLookupAttributes()
          Get the current attribute sets for the service.
 String[] getLookupGroups()
          Get the list of groups to join.
 LookupLocator[] getLookupLocators()
          Get the list of locators of specific lookup services to join.
 Object getProxy()
          Returns a proxy object for this remote object.
 TrustVerifier getProxyVerifier()
          Returns a TrustVerifier that can be used to verify that a proxy can be trusted as a proxy for the service; that is, the isTrustedObject method of the returned verifier can be called with a candidate proxy.
 Object getServiceProxy()
          Returns a proxy object for this object.
private  LeaseSet getSet(Uuid id)
          Return the set with the specified id, or throw a NoSuchObjectException, wrapped in a ThrowThis if the set can't be found
(package private)  void init(String[] configOptions, LifeCycle lifeCycle)
          Portion of construction that is common between the activatable and not activatable cases.
(package private)  void initAsSubject(Configuration config)
          Common construction for activatable and non-activatable cases, run under the proper Subject.
(package private) static void initFailed(Throwable e)
          Log information about failing to initialize the service and rethrow the appropriate exception.
private  String inventory()
          Return a string summarizing the inventory of the server
private static boolean isCurrent(LeaseSet set)
          Returns true if the lease on the lease set is still current, else false.
(package private)  boolean isolateSets()
          Returns whether to isolate renewal sets or batch lease across sets.
private static void logThrow(Level level, String method, String msg, Object[] msgParams, Throwable t)
          Logs a throw
 void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets)
          Modify the current attribute sets, using the same semantics as ServiceRegistration.modifyAttributes.
(package private)  SendMonitor newSendMonitor(LeaseSet set)
          Create a new SendMonitorImpl
(package private)  SetProxy newSetProxy(LeaseSet set)
          Method used by LeaseSet when it needs to cons up a SetProxy with an up-to-date Lease.
(package private)  void postDestroy()
          Method subclasses can override to perform any necessary post log destruction cleanup.
 Lease remove(Uuid id, Lease leaseToRemove)
          Remove a lease from a set.
private  void removeClientLeases(Iterator deadLeases)
          Method used to remove membership expired leases from the server.
 void removeLookupGroups(String[] groups)
          Remove groups from the set to join.
 void removeLookupLocators(LookupLocator[] locators)
          Remove locators for specific lookup services from the set to join.
private  void removeSet(LeaseSet set)
          Do the heavy lifting on removing a set, assumes the locks on the set and store have been acquired.
 long renew(Uuid cookie, long extension)
          Called by the lease when its renew method is called.
(package private)  void renewalFailure(ClientLeaseWrapper clw)
          Handle failures to renew a lease by removing the lease from its set and if needed schedule sending an event.
 Landlord.RenewResults renewAll(Uuid[] cookies, long[] extensions)
          Called by the lease map when its renewAll method is called.
 void renewFor(Uuid id, Lease leaseToRenew, long membershipDuration, long renewDuration)
          Add a lease to a set.
(package private)  void restoreTransientState()
          Perform the 3rd stage of log recovery, restoring the various pieces of transient state (populating the LRM, restoring various transient fields).
(package private)  void sendWarningEvent(LeaseSet set)
          Schedule the sending of an expiration warning event.
 EventRegistration setExpirationWarningListener(Uuid id, RemoteEventListener listener, long minWarning, MarshalledObject handback)
          Set the expiration warning listener for a set.
 void setLookupGroups(String[] groups)
          Replace the list of groups to join with a new list.
 void setLookupLocators(LookupLocator[] locators)
          Replace the list of locators of specific lookup services to join with a new list.
 EventRegistration setRenewalFailureListener(Uuid id, RemoteEventListener listener, MarshalledObject handback)
          Set the renewal failure listener for a set.
 String toString()
          Returns a string representation of this object.
private static String toString(Object[] array)
          Returns the contents of an array as a string.
(package private)  boolean unexport(boolean force)
          Unexport our stub appropriately.
(package private)  void updateLeaseCount(int change)
          Update the number of leases being managed by this server.
(package private)  void updatePerformed(int updateCount)
          Called by PersistentStore after every update to give server a chance to trigger a snapshot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CURRENT_LOG_VERSION

private static final int CURRENT_LOG_VERSION
Current version of log format

See Also:
Constant Field Values

NORM

static final String NORM
Logger and configuration component name for Norm

See Also:
Constant Field Values

logger

static final Logger logger
Logger for logging information about this instance


persistent

final boolean persistent
Whether this server is persistent.


loginContext

LoginContext loginContext
The login context, for logging out


persistenceDirectory

String persistenceDirectory
The location of our persistent storage, or null if not persistent.


leasePreparer

private ProxyPreparer leasePreparer
Proxy preparer for leases supplied through the API


recoveredLeasePreparer

private ProxyPreparer recoveredLeasePreparer
Proxy preparer for leases recovered from persistent storage, or null if not persistent.


listenerPreparer

private ProxyPreparer listenerPreparer
Proxy preparer for listeners supplied through the API


recoveredListenerPreparer

private ProxyPreparer recoveredListenerPreparer
Proxy preparer for listeners recovered from persistent storage, or null if not persistent.


locatorPreparer

private ProxyPreparer locatorPreparer
Proxy preparer for lookup locators supplied through the API, and not including initial lookup locators.


recoveredLocatorPreparer

private ProxyPreparer recoveredLocatorPreparer
Proxy preparer for lookup locators recovered from persistent storage, or null if not persistent.


exporter

Exporter exporter
The exporter for exporting and unexporting


lifeCycle

private LifeCycle lifeCycle
Object to notify when this service is destroyed, or null


serverUuid

private Uuid serverUuid
The unique ID for this server.


joinState

private JoinState joinState
Our JoinManager


setTable

private Map setTable
Map of Uuids to LeaseSets


lrm

private LeaseRenewalManager lrm
Lease renewal manager that actually renews the leases


expMgr

private LeaseExpirationMgr expMgr
Object that expires sets and generates expiration warning events


leaseFactory

private LeaseFactory leaseFactory
Factory for creating leases


setLeasePolicy

private LeasePeriodPolicy setLeasePolicy
Policy we use for granting and renewing renewal set leases


isolateSets

private boolean isolateSets
Whether to isolate leases in their own renewal sets as opposed to batching leases across sets.


store

private PersistentStore store
Our persistant store


idGen

private UIDGenerator idGen
Factory we use to create ClientLeaseWrapper IDs


renewedList

private List renewedList
List of leases that have been renewed but not persisted


renewLogger

private NormServerBaseImpl.RenewLogThread renewLogger
Thread that pulls wrapped client leases off the renewedList and logs them to disk


generator

private EventTypeGenerator generator
Object used to generate new event types


lrmEventListener

private LRMEventListener lrmEventListener
Object that transfers events from the renewal manager to us so we can remove dead leases and send events


logToSnapshotThresh

private int logToSnapshotThresh
Log file must contain this many records before snapshot allowed


snapshotWt

private float snapshotWt
Weight factor applied to snapshotSize when deciding to take snapshot


serverProxy

NormServer serverProxy
Inner server proxy


normProxy

LeaseRenewalService normProxy
Outer service proxy


adminProxy

private AdminProxy adminProxy
Admin proxy


snapshotter

private NormServerBaseImpl.SnapshotThread snapshotter
Thread that performs snapshots when signaled


ready

private final NormServerBaseImpl.ReadyState ready
Lock protecting startup and shutdown


countLeases

private final NormServerBaseImpl.CountLeases countLeases
Keep track of the number of leases.

Constructor Detail

NormServerBaseImpl

NormServerBaseImpl(boolean persistent)
Creates an instance of this class.

Parameters:
persistent - whether this server is persistent
Method Detail

renewFor

public void renewFor(Uuid id,
                     Lease leaseToRenew,
                     long membershipDuration,
                     long renewDuration)
              throws RemoteException,
                     ThrowThis
Description copied from interface: NormServer
Add a lease to a set.

Specified by:
renewFor in interface NormServer
Parameters:
id - what set the lease should be added to
leaseToRenew - the lease to be added to the set
membershipDuration - how long the lease should be in the set
renewDuration - how long the lease should be renewed for each time it is renewed
Throws:
RemoteException - if a communication-related exception occurs
ThrowThis - when another exception has to be thrown by the proxy

updateLeaseCount

void updateLeaseCount(int change)
Update the number of leases being managed by this server.


add

private void add(LeaseSet set,
                 Lease leaseToRenew,
                 long membershipDuration,
                 long renewDuration)
          throws ThrowThis
Add the lease to the set.

Parameters:
set - the LeaseSet to add the leaseToRenew to
leaseToRenew - the lease the client wants managed
membershipDuration - the length of time the client wants the lease managed for
renewDuration - the length of time the client want the lease renewed for each time it is renewed
Throws:
ThrowThis - if the set no longer exists

remove

public Lease remove(Uuid id,
                    Lease leaseToRemove)
             throws RemoteException,
                    ThrowThis
Description copied from interface: NormServer
Remove a lease from a set.

Specified by:
remove in interface NormServer
Parameters:
id - of set being operated on
leaseToRemove - the lease to be removed from the set
Throws:
RemoteException - if a communication-related exception occurs
ThrowThis - when another exception has to be thrown by the proxy

getLeases

public GetLeasesResult getLeases(Uuid id)
                          throws ThrowThis
Description copied from interface: NormServer
Return all the leases in the set. Returns null or a zero-length array if there are no leases in the set.

Specified by:
getLeases in interface NormServer
Parameters:
id - of set being operated on
Returns:
an object containing an array of MarshalledInstances, one for each lease
Throws:
ThrowThis - when another exception has to be thrown by the proxy

setExpirationWarningListener

public EventRegistration setExpirationWarningListener(Uuid id,
                                                      RemoteEventListener listener,
                                                      long minWarning,
                                                      MarshalledObject handback)
                                               throws RemoteException,
                                                      ThrowThis
Description copied from interface: NormServer
Set the expiration warning listener for a set. Also used to cancel a registration.

Specified by:
setExpirationWarningListener in interface NormServer
Parameters:
id - of set being operated on
listener - listener to be notified when this event occurs. Pass null to clear the registration.
minWarning - how long be for the lease on the set expires should the event be sent. Ignored if listener is null.
handback - an object to be handed back to the listener when the warning event occurs. Ignored if listener is null.
Returns:
an EventRegistration object for the new registration if listener is non-null and null otherwise
Throws:
RemoteException - if a communication-related exception occurs
ThrowThis - when another exception has to be thrown by the proxy

expireIfTime

void expireIfTime(LeaseSet set)
Remote a set if its expiration time has been reached.


sendWarningEvent

void sendWarningEvent(LeaseSet set)
Schedule the sending of an expiration warning event. This could be a method on the set itself but this keeps all of the high level synchronization logic in one file.


setRenewalFailureListener

public EventRegistration setRenewalFailureListener(Uuid id,
                                                   RemoteEventListener listener,
                                                   MarshalledObject handback)
                                            throws RemoteException,
                                                   ThrowThis
Description copied from interface: NormServer
Set the renewal failure listener for a set. Also used to cancel a registration.

Specified by:
setRenewalFailureListener in interface NormServer
Parameters:
id - of set being operated on
listener - listener to be notified when this event occurs. Pass null to clear the registration.
handback - an object to be handed back to the listener when the failure event occurs. Ignored if listener is null.
Returns:
an EventRegistration object for the new registration if listener is non-null and null otherwise.
Throws:
RemoteException - if a communication-related exception occurs
ThrowThis - when another exception has to be thrown by the proxy

renewalFailure

void renewalFailure(ClientLeaseWrapper clw)
Handle failures to renew a lease by removing the lease from its set and if needed schedule sending an event.

Parameters:
clw - the wrapped client lease for the lease that could not be renewed. clw.isDeformed must be false.

desiredExpirationReached

void desiredExpirationReached(ClientLeaseWrapper clw)
Remove a lease that has reached its desired expiration.

Parameters:
clw - the wrapped client lease for the lease that we are done with

removeClientLeases

private void removeClientLeases(Iterator deadLeases)
Method used to remove membership expired leases from the server. Assumes that they have already been removed from the set.

Parameters:
deadLeases - an iterator with the leases that have to be removed

ensureCurrent

private static void ensureCurrent(LeaseSet set)
                           throws ThrowThis
Throw a NoSuchObjectException, wrapped in a ThrowThis, if the passed set has expired. Assumes set is locked.

Throws:
ThrowThis

isCurrent

private static boolean isCurrent(LeaseSet set)
Returns true if the lease on the lease set is still current, else false.


getSet

private LeaseSet getSet(Uuid id)
                 throws ThrowThis
Return the set with the specified id, or throw a NoSuchObjectException, wrapped in a ThrowThis if the set can't be found

Throws:
ThrowThis

createLeaseRenewalSet

public LeaseRenewalSet createLeaseRenewalSet(long leaseDuration)
Description copied from interface: LeaseRenewalService
Create a new LeaseRenewalSet that the client can populate with leases to be renewed. The initial duration of the lease granted on this set will be less than or equal to leaseDuration.

Two calls to this method should never return objects that are equal.

Specified by:
createLeaseRenewalSet in interface LeaseRenewalService
Parameters:
leaseDuration - requested lease duration in milliseconds
Returns:
a new LeaseRenewalSet in the renewal service

newSetProxy

SetProxy newSetProxy(LeaseSet set)
Method used by LeaseSet when it needs to cons up a SetProxy with an up-to-date Lease. Assumes the appropriate locks have been obtained.


newSendMonitor

SendMonitor newSendMonitor(LeaseSet set)
Create a new SendMonitorImpl


getProxyVerifier

public TrustVerifier getProxyVerifier()
Description copied from interface: ServerProxyTrust
Returns a TrustVerifier that can be used to verify that a proxy can be trusted as a proxy for the service; that is, the isTrustedObject method of the returned verifier can be called with a candidate proxy. The verifier should be able to verify all proxies for the service, including proxies for resources (such as leases and registrations).

Specified by:
getProxyVerifier in interface ServerProxyTrust
Returns:
a TrustVerifier that can be used to verify that a proxy can be trusted as a proxy for the service
Throws:
UnsupportedOperationException - if the server proxy does not implement both RemoteMethodControl and TrustEquivalence

renew

public long renew(Uuid cookie,
                  long extension)
           throws UnknownLeaseException,
                  LeaseDeniedException
Description copied from interface: Landlord
Called by the lease when its renew method is called. Renews the lease that is associated with the given cookie.

Specified by:
renew in interface Landlord
Specified by:
renew in interface LocalLandlord
Parameters:
cookie - the Uuid associated with the lease who's renew method was called
extension - argument passed to the renew call
Returns:
The new duration the lease should have
Throws:
UnknownLeaseException - if landlord does not know about a lease with the specified cookie
LeaseDeniedException - if the landlord is unwilling to renew the lease

cancel

public void cancel(Uuid cookie)
            throws UnknownLeaseException
Description copied from interface: Landlord
Called by the lease when its cancel method is called. Cancels the lease that is associated with the given cookie.

Specified by:
cancel in interface Landlord
Specified by:
cancel in interface LocalLandlord
Parameters:
cookie - the Uuid associated with the lease who's renew method was called
Throws:
UnknownLeaseException - if landlord does not know about a lease with the specified cookie

removeSet

private void removeSet(LeaseSet set)
Do the heavy lifting on removing a set, assumes the locks on the set and store have been acquired.


renewAll

public Landlord.RenewResults renewAll(Uuid[] cookies,
                                      long[] extensions)
Description copied from interface: Landlord
Called by the lease map when its renewAll method is called. Should renew the lease that is associated with each element of cookies

Specified by:
renewAll in interface Landlord
Parameters:
cookies - an array of Uuids, each universally and uniquely identifying a lease granted by this Landlord
extensions - an array of longs, each representing an a duration in milliseconds that the client wants the lease associated with the Uuid from the corresponding element of cookies renewed for
Returns:
A RenewResults object that contains the new duration of each lease that was successfully renewed or the exception encountered for each lease that could not be renewed

cancelAll

public Map cancelAll(Uuid[] cookies)
Description copied from interface: Landlord
Called by the lease map when its cancelAll method is called. Should cancel the lease that is associated with each element of cookies

Specified by:
cancelAll in interface Landlord
Parameters:
cookies - an array of Uuids, each universally and uniquely identifying a lease granted by this Landlord
Returns:
If all the leases specified in the cookies could be cancelled return null. Otherwise, return a Map that for each failed cancel attempt maps the corresponding cookie object to an exception describing the failure.

updatePerformed

void updatePerformed(int updateCount)
Called by PersistentStore after every update to give server a chance to trigger a snapshot.

Parameters:
updateCount - number of updates since last snapshot

restoreTransientState

void restoreTransientState()
Perform the 3rd stage of log recovery, restoring the various pieces of transient state (populating the LRM, restoring various transient fields).


inventory

private String inventory()
Return a string summarizing the inventory of the server


getAdmin

public Object getAdmin()
Description copied from interface: Administrable
Returns an object that implements whatever administration interfaces are appropriate for the particular service.

Specified by:
getAdmin in interface Administrable
Returns:
an object that implements whatever administration interfaces are appropriate for the particular service.
See Also:
JoinAdmin

getLookupAttributes

public Entry[] getLookupAttributes()
Description copied from interface: JoinAdmin
Get the current attribute sets for the service.

Specified by:
getLookupAttributes in interface JoinAdmin
Returns:
the current attribute sets for the service

addLookupAttributes

public void addLookupAttributes(Entry[] attrSets)
Description copied from interface: JoinAdmin
Add attribute sets for the service. The resulting set will be used for all future joins. The attribute sets are also added to all currently-joined lookup services.

Specified by:
addLookupAttributes in interface JoinAdmin
Parameters:
attrSets - the attribute sets to add

modifyLookupAttributes

public void modifyLookupAttributes(Entry[] attrSetTemplates,
                                   Entry[] attrSets)
Description copied from interface: JoinAdmin
Modify the current attribute sets, using the same semantics as ServiceRegistration.modifyAttributes. The resulting set will be used for all future joins. The same modifications are also made to all currently-joined lookup services.

Specified by:
modifyLookupAttributes in interface JoinAdmin
Parameters:
attrSetTemplates - the templates for matching attribute sets
attrSets - the modifications to make to matching sets
See Also:
ServiceRegistration.modifyAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])

getLookupGroups

public String[] getLookupGroups()
Description copied from interface: JoinAdmin
Get the list of groups to join. An empty array means the service joins no groups (as opposed to "all" groups).

Specified by:
getLookupGroups in interface JoinAdmin
Returns:
an array of groups to join. An empty array means the service joins no groups (as opposed to "all" groups).
See Also:
JoinAdmin.setLookupGroups(java.lang.String[])

addLookupGroups

public void addLookupGroups(String[] groups)
Description copied from interface: JoinAdmin
Add new groups to the set to join. Lookup services in the new groups will be discovered and joined.

Specified by:
addLookupGroups in interface JoinAdmin
Parameters:
groups - groups to join
See Also:
JoinAdmin.removeLookupGroups(java.lang.String[])

removeLookupGroups

public void removeLookupGroups(String[] groups)
Description copied from interface: JoinAdmin
Remove groups from the set to join. Leases are cancelled at lookup services that are not members of any of the remaining groups.

Specified by:
removeLookupGroups in interface JoinAdmin
Parameters:
groups - groups to leave
See Also:
JoinAdmin.addLookupGroups(java.lang.String[])

setLookupGroups

public void setLookupGroups(String[] groups)
Description copied from interface: JoinAdmin
Replace the list of groups to join with a new list. Leases are cancelled at lookup services that are not members of any of the new groups. Lookup services in the new groups will be discovered and joined.

Specified by:
setLookupGroups in interface JoinAdmin
Parameters:
groups - groups to join
See Also:
JoinAdmin.getLookupGroups()

getLookupLocators

public LookupLocator[] getLookupLocators()
Description copied from interface: JoinAdmin
Get the list of locators of specific lookup services to join.

Specified by:
getLookupLocators in interface JoinAdmin
Returns:
the list of locators of specific lookup services to join
See Also:
JoinAdmin.setLookupLocators(net.jini.core.discovery.LookupLocator[])

addLookupLocators

public void addLookupLocators(LookupLocator[] locators)
                       throws RemoteException
Description copied from interface: JoinAdmin
Add locators for specific new lookup services to join. The new lookup services will be discovered and joined.

Specified by:
addLookupLocators in interface JoinAdmin
Parameters:
locators - locators of specific lookup services to join
Throws:
RemoteException
See Also:
JoinAdmin.removeLookupLocators(net.jini.core.discovery.LookupLocator[])

removeLookupLocators

public void removeLookupLocators(LookupLocator[] locators)
                          throws RemoteException
Description copied from interface: JoinAdmin
Remove locators for specific lookup services from the set to join. Any leases held at the lookup services are cancelled.

Specified by:
removeLookupLocators in interface JoinAdmin
Parameters:
locators - locators of specific lookup services to leave
Throws:
RemoteException
See Also:
JoinAdmin.addLookupLocators(net.jini.core.discovery.LookupLocator[])

setLookupLocators

public void setLookupLocators(LookupLocator[] locators)
                       throws RemoteException
Description copied from interface: JoinAdmin
Replace the list of locators of specific lookup services to join with a new list. Leases are cancelled at lookup services that were in the old list but are not in the new list. Any new lookup services will be discovered and joined.

Specified by:
setLookupLocators in interface JoinAdmin
Parameters:
locators - locators of specific lookup services to join
Throws:
RemoteException
See Also:
JoinAdmin.getLookupLocators()

toString

private static String toString(Object[] array)
Returns the contents of an array as a string.


destroy

public void destroy()
             throws RemoteException
Description copied from interface: DestroyAdmin
Destroy the service, if possible, including its persistent storage. This method should (in effect) spawn a separate thread to do the actual work asynchronously, and make a reasonable attempt to let this remote call return successfully. As such, a successful return from this method does not mean that the service has been destroyed. Although the service should make a reasonable attempt to let this remote call return successfully, the service must not wait indefinitely for other (in-progress and subsequent) remote calls to finish before proceeding to destroy itself. Once this method has been called, the service can, but need not, reject all other (in-progress and subsequent) remote calls to the service.

Specified by:
destroy in interface DestroyAdmin
Throws:
RemoteException

unexport

boolean unexport(boolean force)
           throws NoSuchObjectException
Unexport our stub appropriately.

Parameters:
force - terminate in progress calls if necessary
Returns:
true if unexport succeeds
Throws:
NoSuchObjectException

postDestroy

void postDestroy()
Method subclasses can override to perform any necessary post log destruction cleanup.


getServiceProxy

public Object getServiceProxy()
Returns a proxy object for this object. This value should not be null.

Specified by:
getServiceProxy in interface ServiceProxyAccessor
Returns:
a proxy object reference

getProxy

public Object getProxy()
Returns a proxy object for this remote object. If this remote object is not exported (and hence, no proxy is available), then null is returned.

Specified by:
getProxy in interface ProxyAccessor
Returns:
a proxy, or null

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object

init

void init(String[] configOptions,
          LifeCycle lifeCycle)
    throws Exception
Portion of construction that is common between the activatable and not activatable cases. This method performs the minimum number of operations before establishing the Subject, and logs errors.

Throws:
Exception

initFailed

static void initFailed(Throwable e)
                throws Exception
Log information about failing to initialize the service and rethrow the appropriate exception.

Parameters:
e - the exception produced by the failure
Throws:
Exception

logThrow

private static void logThrow(Level level,
                             String method,
                             String msg,
                             Object[] msgParams,
                             Throwable t)
Logs a throw


initAsSubject

void initAsSubject(Configuration config)
             throws Exception
Common construction for activatable and non-activatable cases, run under the proper Subject.

Throws:
Exception

isolateSets

boolean isolateSets()
Returns whether to isolate renewal sets or batch lease across sets.


getExporter

Exporter getExporter(Configuration config)
               throws ConfigurationException
Returns the exporter to use to export this server.

Parameters:
config - the configuration to use for supplying the exporter
Returns:
the exporter to use to export this server
Throws:
ConfigurationException - if a problem occurs retrieving entries from the configuration


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.