class MailboxImpl extends Object implements MailboxBackEnd, TimeConstants, ServerProxyTrust, ProxyAccessor
Client-side proxies make the appropriate transformation from client requests to the methods of this class.
Modifier and Type | Class and Description |
---|---|
private static class |
MailboxImpl.AttrsAddedLogObj
LogObj class whose instances are recorded to the log file whenever
the set of lookup attributes is augmented.
|
private static class |
MailboxImpl.AttrsModifiedLogObj
LogObj class whose instances are recorded to the log file whenever
the set of lookup attributes is modified.
|
private class |
MailboxImpl.DestroyThread
Termination thread code.
|
private class |
MailboxImpl.ExpirationThread
Registration expiration thread code
|
private class |
MailboxImpl.LocalLandlordAdaptor
Adaptor class implementation of LocalLandlord.
|
private class |
MailboxImpl.LocalLogHandler
Handler class for the persistent storage facility.
|
private static interface |
MailboxImpl.LogRecord
Interface defining the method(s) that must be implemented by each of
the concrete LogObj classes.
|
private static class |
MailboxImpl.LookupGroupsChangedLogObj
LogObj class whose instances are recorded to the log file whenever
the set of groups to join is changed.
|
private static class |
MailboxImpl.LookupLocatorsChangedLogObj
LogObj class whose instances are recorded to the log file whenever
the set of locators of lookup services to join is changed.
|
private class |
MailboxImpl.Notifier
The notifier thread.
|
(package private) class |
MailboxImpl.NotifyTask
A task that represents an event notification task for a particular
registration.
|
private static class |
MailboxImpl.RegistrationCancelledLogObj
LogObj class whose instances are recorded to the log file whenever
a registration is cancelled.
|
private static class |
MailboxImpl.RegistrationDisabledLogObj
LogObj class whose instances are recorded to the log file whenever
a registration is disabled.
|
private static class |
MailboxImpl.RegistrationEnabledLogObj
LogObj class whose instances are recorded to the log file whenever
a registration is enabled.
|
private static class |
MailboxImpl.RegistrationIteratorEnabledLogObj
LogObj class whose instances are recorded to the log file whenever
a registration iterator is enabled.
|
private static class |
MailboxImpl.RegistrationLogObj
LogObj class whose instances are recorded to the log file whenever
a new registration is created.
|
private static class |
MailboxImpl.RegistrationRenewedLogObj
LogObj class whose instances are recorded to the log file whenever
a registration is renewed.
|
private class |
MailboxImpl.SnapshotThread
Snapshot-taking thread.
|
private static class |
MailboxImpl.UnknownEventExceptionLogObj
LogObj class whose instances are recorded to the log file whenever
an UnknownEventException is received during event notification.
|
Landlord.RenewResults
Modifier and Type | Field and Description |
---|---|
private ActivationID |
activationID
Our activation ID
|
private boolean |
activationPrepared
Whether the activation ID has been prepared
|
private ActivationSystem |
activationSystem
The activation system, prepared
|
private Map |
activeReg
Map of ServiceRegistrations that have event
delivery enabled and have event delivery tasks currently
scheduled.
|
(package private) static Logger |
adminLogger
Logger for service administration related messages
|
private static String |
attrsAddedLogObjSourceClass |
private static String |
attrsModifiedLogObjSourceClass |
private Entry[] |
baseLookupAttrs
The attributes to use when joining lookup services
|
private ReadersWriter |
concurrentObj
Concurrent object (lock) to control read and write access
|
(package private) static Logger |
deliveryLogger
Logger for event delivery related messages
|
private Object |
destroyLock
Object for coordinating the destroy process
|
private boolean |
destroySucceeded
Flag that denotes whether or not destroy has already been called.
|
private static String |
destroyThreadSourceClass |
private EventLogFactory |
eventLogFactory
EventLogIterator generator |
private Object |
eventNotifier
Object for coordinating actions with the notification thread
|
(package private) static Logger |
expirationLogger
Logger for lease expiration related messages
|
private Object |
expirationNotifier
Object for coordinating actions with the expire thread
|
private static String |
expirationThreadSourceClass |
private MailboxImpl.ExpirationThread |
expirer
Registration expirer thread
|
protected Exporter |
exporter
The exporter for exporting and unexporting
|
(package private) static Logger |
initLogger
Logger for service initialization related messages
|
private boolean |
inRecovery
Flag indicating whether system is in a state of recovery
|
private JoinManager |
joiner
Manager for joining lookup services
|
private LeaseFactory |
leaseFactory
LandLordLeaseFactory we use to create leases |
(package private) static Logger |
leaseLogger
Logger for lease related messages
|
private LeasePeriodPolicy |
leasePolicy
LeasePeriodPolicy for this service |
private LifeCycle |
lifeCycle
LifeCycle object used to notify starter framework
that this object's implementation reference, if any, should not
be held onto any longer. |
private ProxyPreparer |
listenerPreparer
Proxy preparer for listeners
|
private MailboxImpl.LocalLandlordAdaptor |
localLandlord
LocalLandlord to use with LandlordUtil calls
|
private static ProxyPreparer |
locatorToJoinPreparer |
private ReliableLog |
log
Reliable log to hold registration state information
|
private static int |
LOG_VERSION
Log format version
|
private int |
logFileSize
Current number of records in the Log File since the last snapshot
|
protected LoginContext |
loginContext
The login context, for logging out
|
private int |
logToSnapshotThreshold
Log File must contain this many records before a snapshot is allowed
|
private Entry[] |
lookupAttrs |
private DiscoveryManagement |
lookupDiscMgr
DiscoveryManager for joining lookup services.
|
private String[] |
lookupGroups
The lookup groups we should join.
|
private static String |
lookupGroupsChangedLogObjSourceClass |
private LookupLocator[] |
lookupLocators
The lookup locators we should join
Default is to join with no locators.
|
private static String |
lookupLocatorsChangedLogObjSourceClass |
private MailboxAdminProxy |
mailboxAdminProxy
The admin proxy of this server
|
private MailboxProxy |
mailboxProxy
The outter proxy of this server
|
private static String |
mailboxSourceClass |
private static String |
MANUFACTURER
ServiceInfo manufacturer value
|
private static int |
MAX_ATTEMPTS
The maximum mnumber of times to retry event delivery
|
private static long |
MAX_TIME
The maximum time to maintain a notification task
|
private long |
maxUnexportDelay
When destroying the space, how long to wait for a clean
unexport (which allows the destroy call to return) before
giving up calling
unexport(true) |
(package private) static String |
MERCURY
Logger and configuration component name for Norm
|
private long |
minRegExpiration
Earliest expiration time of any registration
|
private MailboxImpl.Notifier |
notifier
Event delivery thread
|
private static String |
notifierSourceClass |
private static String |
notifyTaskSourceClass |
(package private) static Logger |
operationsLogger
Logger for service operation messages
|
private List |
pendingReg
List of ServiceRegistrations that have event
delivery enabled, but don't have any event delivery tasks
currently scheduled.
|
private String |
persistenceDirectory
Name of persistence directory
|
(package private) static Logger |
persistenceLogger
Logger for service persistence related messages
|
private boolean |
persistent
boolean flag used to determine persistence support. |
private static String |
PRODUCT
ServiceInfo product value
|
private ReadyState |
readyState
Object used to prevent access to this service during the service's
initialization or shutdown processing.
|
(package private) static Logger |
receiveLogger
Logger for event reception related messages
|
private static ProxyPreparer |
recoveredLocatorToJoinPreparer |
(package private) static Logger |
recoveryLogger
Logger for service recovery related messages
|
private TreeMap |
regByExpiration
Identity map of ServiceRegistration, ordered by lease
expiration.
|
private HashMap |
regByID
Map from
Uuid to ServiceRegistration |
private static String |
registrationCancelledLogObjSourceClass |
private static String |
registrationDisabledLogObjSourceClass |
private static String |
registrationEnabledLogObjSourceClass |
private static String |
registrationIteratorEnabledLogObjSourceClass |
private static String |
registrationLogObjSourceClass |
private static String |
registrationRenewedLogObjSourceClass |
private MailboxBackEnd |
serverStub
The inner proxy of this server
|
private Uuid |
serviceID
ServiceID returned from the lookup registration process
|
private Object |
snapshotNotifier
Object on which the snapshot-taking thread will synchronize
|
private Thread |
snapshotter
Snapshot-taking thread
|
private static String |
snapshotThreadSourceClass |
(package private) static Logger |
startupLogger
Logger for (successful) service startup message
|
private long |
unexportRetryDelay
Length of time to sleep between unexport attempts
|
private static String |
unknownEventExceptionLogObjSourceClass |
private static String |
VENDOR
ServiceInfo vendor value
|
private static String |
VERSION
ServiceInfo version value
|
DAYS, HOURS, MINUTES, SECONDS
Constructor and Description |
---|
MailboxImpl(ActivationID activationID,
MarshalledObject data)
Activation constructor
|
MailboxImpl(String[] configArgs,
LifeCycle lc,
boolean persistent)
Constructor for creating transient (i.e. non-activatable) service
instances.
|
Modifier and Type | Method and Description |
---|---|
private void |
addLogRecord(MailboxImpl.LogRecord rec)
Add a state-change record to persistent storage.
|
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.
|
private void |
addRegistration(ServiceRegistration reg)
Utility method used to add a registration to our state information.
|
private void |
addUnknownEvent(Uuid regID,
EventID evid)
Utility method that adds the provided EventID
to the given registration's "unknown" event list.
|
private void |
addUnknownEventDo(Uuid regID,
EventID evid)
Performs the actual logic for adding an unknown event to the
given registration's unknown event list.
|
void |
addUnknownEvents(Uuid uuid,
Collection unknownEvents)
Get events for the given registration
|
private void |
addUnknownEventsDo(Uuid uuid,
Collection unknownEvents)
Performs the actual logic for synchronously getting events
for a particular registration.
|
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. |
private Map |
cancelAllDo(Uuid[] cookie)
Performs the actual cancelAll logic
|
private void |
cancelDo(Uuid cookie)
Performs the actual registration cancellation logic
|
private void |
cleanup() |
void |
destroy()
Destroy the service, if possible, including its persistent storage.
|
void |
disableDelivery(Uuid uuid)
Disable delivery of events for the given registration
|
private void |
disableDeliveryDo(Uuid uuid)
Performs the actual logic for disabling event delivery
for a particular registration.
|
private void |
disableRegistration(Uuid uuid)
Utility method that disables event delivery for the
registration associated with the given UUID
|
private void |
disableRegistrationIterator(Uuid regId)
Utility method that sets the valid iterator id for provided registration.
|
private void |
doInit(Configuration config)
Initialization common to both activatable and transient instances.
|
private void |
doInitWithLogin(Configuration config,
LoginContext loginContext)
Method that attempts to login before delegating the
rest of the initialization process to
doInit |
private static void |
dumpAttrs(Entry[] attrs,
Logger logger,
Level level)
Utility method for displaying lookup service attributes
|
private static void |
dumpGroups(String[] grps,
Logger logger,
Level level)
Utility method for displaying lookup group attributes
|
private static void |
dumpLocators(LookupLocator[] locs,
Logger logger,
Level level)
Utility method for displaying lookup locator attributes
|
void |
enableDelivery(Uuid uuid,
RemoteEventListener target)
Enable delivery of events for the given registration
to the specified target
|
private void |
enableDeliveryDo(Uuid uuid,
RemoteEventListener preparedTarget)
Performs the actual enable delivery logic
|
private void |
enableRegistration(Uuid uuid,
RemoteEventListener preparedTarget)
Utility method that associates the given listener with the
associated registration object.
|
private void |
enableRegistrationIterator(Uuid regId,
Uuid iterId)
Utility method that sets the valid iterator id for provided registration.
|
private static boolean |
ensureCurrent(LeasedResource resource)
Utility method that check for valid resource
|
Object |
getAdmin()
Returns an object that implements whatever administration interfaces
are appropriate for the particular service.
|
private static File |
getEventLogPath(String parent,
Uuid uuid)
Utility method that returns the associated File object
for the given Uuid's persistence directory
|
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.
|
Collection |
getNextBatch(Uuid regId,
Uuid iterId,
long timeout,
Object lastEventCookie)
Get next batch of events for the given registration.
|
private Collection |
getNextBatchDo(Uuid regId,
Uuid iterId,
long timeout,
Object lastEventCookie)
Does the actual logic for obtaining the next set of events for the
given registration.
|
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. |
RemoteEventIteratorData |
getRemoteEvents(Uuid uuid)
Get events for the given registration via the returned iterator.
|
private RemoteEventIteratorData |
getRemoteEventsDo(Uuid uuid)
Performs the actual logic for synchronously getting events
for a particular registration.
|
Object |
getServiceProxy()
Returns a proxy object for this object.
|
private ServiceRegistration |
getServiceRegistration(Uuid regID)
Utility method that tries to obtain the ServiceRegistration
object associated with the given Uuid.
|
private void |
init(String[] configArgs)
Initialization common to both activatable and transient instances.
|
protected void |
initFailed(Throwable e)
Log information about failing to initialize the service and rethrow the
appropriate exception.
|
private static MarshalledObject[] |
marshalAttributes(Entry[] attrs)
Marshals each element of the
Entry[] array parameter. |
void |
modifyLookupAttributes(Entry[] attrSetTemplates,
Entry[] attrSets)
Modify the current attribute sets, using the same semantics as
ServiceRegistration.modifyAttributes.
|
void |
notify(Uuid registrationID,
RemoteEvent theEvent)
Collect remote events for the associated registration.
|
private void |
notifyDo(Uuid registrationID,
RemoteEvent theEvent)
Performs the actual logic of handling received events and
storing them.
|
private static LookupLocator[] |
prepareExistingLocators(ProxyPreparer preparer,
LookupLocator[] lookupLocators) |
private static void |
prepareNewLocators(ProxyPreparer preparer,
LookupLocator[] locators)
Using the given
ProxyPreparer , attempts to prepare each
element of the given LookupLocator array; replacing the
original element of the array with the result of the call to the
method ProxyPreparer.prepareProxy . |
MailboxPullRegistration |
pullRegister(long leaseDuration)
Defines the interface to the event mailbox service.
|
private void |
rebuildTransientState(ProxyPreparer recoveredListenerPreparer) |
private void |
recoverSnapshot(InputStream in)
Retrieve the contents of the snapshot file and reconstitute the 'base'
state of the Mercury from the retrieved data.
|
MailboxRegistration |
register(long leaseDuration)
Defines the interface to the event mailbox service.
|
private Registration |
registerDo(long duration)
Actual implementation of the registration process.
|
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 |
removeRegistration(Uuid regID,
ServiceRegistration reg)
Utility method that calls the overloaded version that accepts a boolean,
which is set to false.
|
private void |
removeRegistration(Uuid regID,
ServiceRegistration reg,
boolean initializing)
Utility method that consolidates registration removal activities.
|
long |
renew(Uuid cookie,
long extension)
Called by the lease when its
renew method is called. |
Landlord.RenewResults |
renewAll(Uuid[] cookies,
long[] extension)
Called by the lease map when its
renewAll method is called. |
private Landlord.RenewResults |
renewAllDo(Uuid[] cookie,
long[] extension)
Performs the actual renewAll logic
|
private long |
renewDo(Uuid cookie,
long extension)
Performs the actual registration renewal logic
|
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.
|
private void |
takeSnapshot(OutputStream out)
Write the current state of the Mercury to persistent storage.
|
private static Entry[] |
unmarshalAttributes(MarshalledObject[] marshalledAttrs)
Unmarshals each element of the
MarshalledObject array
parameter. |
private void |
validateIterator(Uuid regId,
Uuid iterId) |
static final String MERCURY
static final Logger leaseLogger
static final Logger deliveryLogger
static final Logger adminLogger
static final Logger initLogger
static final Logger receiveLogger
static final Logger expirationLogger
static final Logger recoveryLogger
static final Logger persistenceLogger
static final Logger startupLogger
static final Logger operationsLogger
private static final String mailboxSourceClass
private static final String notifierSourceClass
private static final String notifyTaskSourceClass
private static final String destroyThreadSourceClass
private static final String expirationThreadSourceClass
private static final String registrationLogObjSourceClass
private static final String registrationEnabledLogObjSourceClass
private static final String registrationDisabledLogObjSourceClass
private static final String registrationIteratorEnabledLogObjSourceClass
private static final String lookupGroupsChangedLogObjSourceClass
private static final String lookupLocatorsChangedLogObjSourceClass
private static final String attrsAddedLogObjSourceClass
private static final String attrsModifiedLogObjSourceClass
private static final String registrationRenewedLogObjSourceClass
private static final String registrationCancelledLogObjSourceClass
private static final String unknownEventExceptionLogObjSourceClass
private static final String snapshotThreadSourceClass
private static final String PRODUCT
private static final String MANUFACTURER
private static final String VENDOR
private static final String VERSION
private MailboxBackEnd serverStub
private MailboxProxy mailboxProxy
private MailboxAdminProxy mailboxAdminProxy
private final ReadersWriter concurrentObj
private HashMap regByID
Uuid
to ServiceRegistration
private final TreeMap regByExpiration
regByID
.private List pendingReg
private Map activeReg
private ReliableLog log
private static final int LOG_VERSION
private boolean inRecovery
private int logFileSize
private int logToSnapshotThreshold
private final Object snapshotNotifier
private Thread snapshotter
protected LoginContext loginContext
private String persistenceDirectory
private ProxyPreparer listenerPreparer
protected Exporter exporter
private Uuid serviceID
private ActivationID activationID
private boolean activationPrepared
private ActivationSystem activationSystem
private final EventLogFactory eventLogFactory
EventLogIterator
generatorprivate LeasePeriodPolicy leasePolicy
LeasePeriodPolicy
for this serviceprivate LeaseFactory leaseFactory
LandLordLeaseFactory
we use to create leasesprivate MailboxImpl.LocalLandlordAdaptor localLandlord
private JoinManager joiner
private DiscoveryManagement lookupDiscMgr
private Entry[] baseLookupAttrs
private Entry[] lookupAttrs
private String[] lookupGroups
private LookupLocator[] lookupLocators
private static ProxyPreparer locatorToJoinPreparer
private static ProxyPreparer recoveredLocatorToJoinPreparer
private MailboxImpl.Notifier notifier
private final Object eventNotifier
private MailboxImpl.ExpirationThread expirer
private long minRegExpiration
private final Object expirationNotifier
private final Object destroyLock
private boolean destroySucceeded
destroyLock
.private long maxUnexportDelay
unexport(true)
private long unexportRetryDelay
private final ReadyState readyState
private LifeCycle lifeCycle
LifeCycle
object used to notify starter framework
that this object's implementation reference, if any, should not
be held onto any longer. This is only used in the non-activatable case.private boolean persistent
boolean
flag used to determine persistence support.
Defaulted to true, and overridden in the constructor overload that takes
a boolean
argument.private static final long MAX_TIME
private static final int MAX_ATTEMPTS
MailboxImpl(ActivationID activationID, MarshalledObject data) throws Exception
activationID
- activation ID passed in by the activation daemon.data
- state data needed to re-activate a Mercury serverException
MailboxImpl(String[] configArgs, LifeCycle lc, boolean persistent) throws Exception
Exception
public Object getProxy()
ProxyAccessor
null
is returned.getProxy
in interface ProxyAccessor
null
public Object getServiceProxy()
ServiceProxyAccessor
null
.getServiceProxy
in interface ServiceProxyAccessor
public Object getAdmin() throws RemoteException
Administrable
getAdmin
in interface Administrable
RemoteException
JoinAdmin
private void init(String[] configArgs) throws Exception
Exception
private void doInitWithLogin(Configuration config, LoginContext loginContext) throws Exception
doInit
Exception
private void doInit(Configuration config) throws Exception
Exception
private void rebuildTransientState(ProxyPreparer recoveredListenerPreparer)
private void cleanup()
public MailboxRegistration register(long leaseDuration) throws RemoteException, LeaseDeniedException
EventMailbox
register
method to register themselves with
the service.register
in interface EventMailbox
leaseDuration
- the requested lease duration in millisecondsMailboxRegistration
RemoteException
- if there is
a communication failure between the client and the service.LeaseDeniedException
- if the mailbox service is unable or unwilling to grant this
registration request.public MailboxPullRegistration pullRegister(long leaseDuration) throws RemoteException, LeaseDeniedException
PullEventMailbox
pullRegister
method to register themselves with
the service.pullRegister
in interface PullEventMailbox
leaseDuration
- the requested lease duration in millisecondsMailboxPullRegistration
RemoteException
- if there is
a communication failure between the client and the service.LeaseDeniedException
- if the mailbox service is unable or unwilling to grant this
registration request.public void enableDelivery(Uuid uuid, RemoteEventListener target) throws RemoteException, ThrowThis
MailboxBackEnd
enableDelivery
in interface MailboxBackEnd
uuid
- The unique registration identifiertarget
- The designated delivery target for event notificationsRemoteException
ThrowThis
MailboxRegistration.enableDelivery(net.jini.core.event.RemoteEventListener)
public void disableDelivery(Uuid uuid) throws RemoteException, ThrowThis
MailboxBackEnd
disableDelivery
in interface MailboxBackEnd
uuid
- The unique registration identifierRemoteException
ThrowThis
MailboxRegistration.disableDelivery()
public RemoteEventIteratorData getRemoteEvents(Uuid uuid) throws RemoteException, ThrowThis
MailboxBackEnd
getRemoteEvents
in interface MailboxBackEnd
uuid
- The unique registration identifierRemoteException
ThrowThis
MailboxPullRegistration.getRemoteEvents()
public Collection getNextBatch(Uuid regId, Uuid iterId, long timeout, Object lastEventCookie) throws InvalidIteratorException, ThrowThis
MailboxBackEnd
getNextBatch
in interface MailboxBackEnd
regId
- The unique registration identifierInvalidIteratorException
ThrowThis
public void addUnknownEvents(Uuid uuid, Collection unknownEvents) throws RemoteException, ThrowThis
MailboxBackEnd
addUnknownEvents
in interface MailboxBackEnd
uuid
- The unique registration identifierunknownEvents
- collection of unknown events to be added to
the associated registration's unknown event list.RemoteException
ThrowThis
MailboxPullRegistration.getRemoteEvents()
public void notify(Uuid registrationID, RemoteEvent theEvent) throws UnknownEventException, RemoteException, ThrowThis
MailboxBackEnd
notify
in interface MailboxBackEnd
registrationID
- The unique registration identifiertheEvent
- The event to store and/or forwardUnknownEventException
RemoteException
ThrowThis
RemoteEventListener.notify(net.jini.core.event.RemoteEvent)
public long renew(Uuid cookie, long extension) throws LeaseDeniedException, UnknownLeaseException, RemoteException
Landlord
renew
method is called.
Renews the lease that is associated with the given cookie
.renew
in interface Landlord
cookie
- the Uuid
associated with the lease who's
renew
method was calledextension
- argument passed to the renew
callLeaseDeniedException
- if the landlord is unwilling to
renew the leaseUnknownLeaseException
- if landlord does not know about
a lease with the specified cookie
RemoteException
- if a communications failure occurspublic void cancel(Uuid cookie) throws UnknownLeaseException, RemoteException
Landlord
cancel
method is
called. Cancels the lease that is associated with the given
cookie
.cancel
in interface Landlord
cookie
- the Uuid
associated with the lease who's
renew
method was calledUnknownLeaseException
- if landlord does not know about
a lease with the specified cookie
RemoteException
- if a communications failure occurspublic Landlord.RenewResults renewAll(Uuid[] cookies, long[] extension) throws RemoteException
Landlord
renewAll
method is called. Should renew the lease that is
associated with each element of cookies
renewAll
in interface Landlord
cookies
- an array of Uuid
s, each universally and
uniquely identifying a lease granted by this
Landlord
extension
- 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 forRemoteException
- if a communications failure occurspublic Map cancelAll(Uuid[] cookies) throws RemoteException
Landlord
cancelAll
method is called. Should cancel the lease that is
associated with each element of cookies
cancelAll
in interface Landlord
cookies
- an array of Uuid
s, each universally and
uniquely identifying a lease granted by this
Landlord
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.RemoteException
- if a communications failure occurspublic void destroy()
DestroyAdmin
destroy
in interface DestroyAdmin
public Entry[] getLookupAttributes() throws RemoteException
JoinAdmin
getLookupAttributes
in interface JoinAdmin
RemoteException
public void addLookupAttributes(Entry[] attrSets) throws RemoteException
JoinAdmin
addLookupAttributes
in interface JoinAdmin
attrSets
- the attribute sets to addRemoteException
public void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets) throws RemoteException
JoinAdmin
modifyLookupAttributes
in interface JoinAdmin
attrSetTemplates
- the templates for matching attribute setsattrSets
- the modifications to make to matching setsRemoteException
ServiceRegistration.modifyAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])
public String[] getLookupGroups() throws RemoteException
JoinAdmin
getLookupGroups
in interface JoinAdmin
RemoteException
JoinAdmin.setLookupGroups(java.lang.String[])
public void addLookupGroups(String[] groups) throws RemoteException
JoinAdmin
addLookupGroups
in interface JoinAdmin
groups
- groups to joinRemoteException
JoinAdmin.removeLookupGroups(java.lang.String[])
public void removeLookupGroups(String[] groups) throws RemoteException
JoinAdmin
removeLookupGroups
in interface JoinAdmin
groups
- groups to leaveRemoteException
JoinAdmin.addLookupGroups(java.lang.String[])
public void setLookupGroups(String[] groups) throws RemoteException
JoinAdmin
setLookupGroups
in interface JoinAdmin
groups
- groups to joinRemoteException
JoinAdmin.getLookupGroups()
public LookupLocator[] getLookupLocators() throws RemoteException
JoinAdmin
getLookupLocators
in interface JoinAdmin
RemoteException
JoinAdmin.setLookupLocators(net.jini.core.discovery.LookupLocator[])
public void addLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdmin
addLookupLocators
in interface JoinAdmin
locators
- locators of specific lookup services to joinRemoteException
JoinAdmin.removeLookupLocators(net.jini.core.discovery.LookupLocator[])
public void removeLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdmin
removeLookupLocators
in interface JoinAdmin
locators
- locators of specific lookup services to leaveRemoteException
JoinAdmin.addLookupLocators(net.jini.core.discovery.LookupLocator[])
public void setLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdmin
setLookupLocators
in interface JoinAdmin
locators
- locators of specific lookup services to joinRemoteException
JoinAdmin.getLookupLocators()
private void addUnknownEvent(Uuid regID, EventID evid)
private void addUnknownEventDo(Uuid regID, EventID evid)
private ServiceRegistration getServiceRegistration(Uuid regID) throws ThrowThis
ThrowThis
private void removeRegistration(Uuid regID, ServiceRegistration reg)
private void removeRegistration(Uuid regID, ServiceRegistration reg, boolean initializing)
private static File getEventLogPath(String parent, Uuid uuid)
private Registration registerDo(long duration)
private void addRegistration(ServiceRegistration reg)
registerDo()
as well as
RegistrationLogObj.apply()
.private long renewDo(Uuid cookie, long extension) throws UnknownLeaseException, LeaseDeniedException
private void cancelDo(Uuid cookie) throws UnknownLeaseException
UnknownLeaseException
private Landlord.RenewResults renewAllDo(Uuid[] cookie, long[] extension) throws RemoteException
RemoteException
private Map cancelAllDo(Uuid[] cookie) throws RemoteException
RemoteException
private void enableDeliveryDo(Uuid uuid, RemoteEventListener preparedTarget) throws ThrowThis
ThrowThis
private void enableRegistration(Uuid uuid, RemoteEventListener preparedTarget) throws ThrowThis
ThrowThis
private void disableDeliveryDo(Uuid uuid) throws ThrowThis
ThrowThis
private void disableRegistration(Uuid uuid) throws ThrowThis
ThrowThis
private void enableRegistrationIterator(Uuid regId, Uuid iterId) throws ThrowThis
ThrowThis
private void disableRegistrationIterator(Uuid regId) throws ThrowThis
ThrowThis
private void addUnknownEventsDo(Uuid uuid, Collection unknownEvents) throws ThrowThis
ThrowThis
private RemoteEventIteratorData getRemoteEventsDo(Uuid uuid) throws ThrowThis
ThrowThis
private Collection getNextBatchDo(Uuid regId, Uuid iterId, long timeout, Object lastEventCookie) throws InvalidIteratorException, ThrowThis
InvalidIteratorException
ThrowThis
private void validateIterator(Uuid regId, Uuid iterId) throws InvalidIteratorException, ThrowThis
InvalidIteratorException
ThrowThis
private void notifyDo(Uuid registrationID, RemoteEvent theEvent) throws UnknownEventException, RemoteException, ThrowThis
private static MarshalledObject[] marshalAttributes(Entry[] attrs)
Entry[]
array parameter.
This method is static
so that it may called from
the static
LogRecord
classes when a set
of attributes is being logged to persistent storage.attrs
- Entry[]
array consisting of the
attributes to marshalMarshalledObject[]
, where each element
corresponds to an attribute in marshalled formprivate static Entry[] unmarshalAttributes(MarshalledObject[] marshalledAttrs)
MarshalledObject
array
parameter. This method is static
so that it may called
from the static
LogRecord
classes when a
set of attributes is being recovered from persistent storage.marshalledAttrs
- MarshalledObject
array consisting
of the attributes to unmarshalEntry[]
, where each element corresponds
to an attribute that was successfully unmarshalledprivate void addLogRecord(MailboxImpl.LogRecord rec)
Whenever a significant change occurs to the Mercury's state, this method is invoked to record that change in a file called a log file. Each record written to the log file is an object reflecting both the data used and the ACTIONS taken to make one change to the Mercury's state at a particular point in time. If the number of records contained in the log file exceeds the pre-defined threshold, a snapshot of the current state of the Mercury will be recorded.
Whenever one of the following state changes occurs, this method will be invoked with the appropriate implementation of the LogRecord interface as the input argument.
MailboxImpl.LocalLogHandler
private void takeSnapshot(OutputStream out) throws IOException
A 'snapshot' of the Mercury's current state is represented by the data contained in certain fields of the Mercury. That data represents many changes -- over time -- to the Mercury's state. This method will record that data to a file referred to as the snapshot file.
The data written by this method to the snapshot file -- as well as the format of the file -- is shown below:
IOException
private void recoverSnapshot(InputStream in) throws IOException, ClassNotFoundException
The data retrieved by this method from the snapshot file is shown below:
IOException
ClassNotFoundException
private static void dumpGroups(String[] grps, Logger logger, Level level)
private static void dumpLocators(LookupLocator[] locs, Logger logger, Level level)
private static void dumpAttrs(Entry[] attrs, Logger logger, Level level)
protected void initFailed(Throwable e) throws Exception
e
- the exception produced by the failureException
private static void prepareNewLocators(ProxyPreparer preparer, LookupLocator[] locators) throws RemoteException
ProxyPreparer
, attempts to prepare each
element of the given LookupLocator
array; replacing the
original element of the array with the result of the call to the
method ProxyPreparer.prepareProxy
. If any attempt to
prepare an element of the given array fails due to an exception,
this method will propagate that exception.
This method is a convenience method that is typically used to
prepare new locators the service should discover and join that
are inserted into, or removed from, the service's state through
the use of one of the following methods:
addLookupLocators
setLookupLocators
removeLookupLocators
preparer
- the preparer to use to prepare each element of the
input arraylocators
- array of LookupLocator
instances in which
each element will be prepared.RemoteException
- when preparation of any of the elements
of the input array fails because of a
RemoteException
SecurityException
- when preparation of any of the elements
of the input array fails because of a
SecurityException
private static LookupLocator[] prepareExistingLocators(ProxyPreparer preparer, LookupLocator[] lookupLocators)
public TrustVerifier getProxyVerifier()
ServerProxyTrust
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).getProxyVerifier
in interface ServerProxyTrust
TrustVerifier
that can be used to verify that
a proxy can be trusted as a proxy for the serviceprivate static boolean ensureCurrent(LeasedResource resource)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.