class MailboxImpl extends Object implements MailboxBackEnd, TimeConstants, ServerProxyTrust, ProxyAccessor, Startable
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<Uuid,MailboxImpl.NotifyTask> |
activeReg
Map of ServiceRegistrations that have event
delivery enabled and have event delivery tasks currently
scheduled.
|
(package private) static Logger |
ADMIN_LOGGER
Logger for service administration related messages
|
private static String |
ATTRS_ADDED_LOG_OBJ_SOURCE_CLASS |
private static String |
ATTRS_MODIFIED_LOG_OBJ_SOURCE_CLASS |
private static Entry[] |
BASE_LOOKUP_ATTRS
The attributes to use when joining lookup services
|
private ReadersWriter |
concurrentObj
Concurrent object (lock) to control read and write access
|
private Configuration |
config |
private AccessControlContext |
context |
(package private) static Logger |
DELIVERY_LOGGER
Logger for event delivery related messages
|
private static String |
DESTROY_THREAD_SOURCE_CLASS |
private Object |
destroyLock
Object for coordinating the destroy process
|
private boolean |
destroySucceeded
Flag that denotes whether or not destroy has already been called.
|
private EventLogFactory |
eventLogFactory
EventLogIterator generator |
private Object |
eventNotifier
Object for coordinating actions with the notification thread
|
(package private) static Logger |
EXPIRATION_LOGGER
Logger for lease expiration related messages
|
private static String |
EXPIRATION_THREAD_SOURCE_CLASS |
private Object |
expirationNotifier
Object for coordinating actions with the expire thread
|
private Thread |
expirer
Registration expireR thread
|
protected Exporter |
exporter
The exporter for exporting and unexporting
|
(package private) static Logger |
INIT_LOGGER
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
|
(package private) static Logger |
LEASE_LOGGER
Logger for lease related messages
|
private LeaseFactory |
leaseFactory
LandLordLeaseFactory we use to create leases |
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 static String |
LOOKUP_GROUPS_CHANGED_LOG_OBJ_SOURCE_CLASS |
private static String |
LOOKUP_LOCATORS_CHANGED_LOG_OBJ_SOURCE_CLASS |
private Entry[] |
lookupAttrs |
private DiscoveryManagement |
lookupDiscMgr
DiscoveryManager for joining lookup services.
|
private String[] |
lookupGroups
The lookup groups we should join.
|
private LookupLocator[] |
lookupLocators
The lookup locators we should join
Default is to join with no locators.
|
(package private) static String |
MAILBOX_SOURCE_CLASS |
private MailboxAdminProxy |
mailboxAdminProxy
The admin proxy of this server
|
private MailboxProxy |
mailboxProxy
The outter proxy of this server
|
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 Thread |
notifier
Event delivery thread
|
private static String |
NOTIFIER_SOURCE_CLASS |
private static String |
NOTIFY_TASK_SOURCE_CLASS |
(package private) static Logger |
OPERATIONS_LOGGER
Logger for service operation messages
|
private List<Uuid> |
pendingReg
List of ServiceRegistrations that have event
delivery enabled, but don't have any event delivery tasks
currently scheduled.
|
(package private) static Logger |
PERSISTENCE_LOGGER
Logger for service persistence related messages
|
private String |
persistenceDirectory
Name of persistence directory
|
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 |
RECEIVE_LOGGER
Logger for event reception related messages
|
private ProxyPreparer |
recoveredListenerPreparer
Proxy preparer recovered
|
private static ProxyPreparer |
recoveredLocatorToJoinPreparer |
(package private) static Logger |
RECOVERY_LOGGER
Logger for service recovery related messages
|
private TreeMap<ServiceRegistration,ServiceRegistration> |
regByExpiration
Identity map of ServiceRegistration, ordered by lease
expiration.
|
private Map<Uuid,ServiceRegistration> |
regByID
Map from
Uuid to ServiceRegistration |
private static String |
REGISTRATION_CANCELLED_LOG_OBJ_SOURCE_CLASS |
private static String |
REGISTRATION_DISABLED_LOG_OBJ_SOURCE_CLASS |
private static String |
REGISTRATION_ENABLED_LOG_OBJ_SOURCE_CLASS |
private static String |
REGISTRATION_ITERATOR_ENABLED_LOG_OBJ_SOURCE_CLASS |
private static String |
REGISTRATION_LOG_OBJ_SOURCE_CLASS |
private static String |
REGISTRATION_RENEWED_LOG_OBJ_SOURCE_CLASS |
private MailboxBackEnd |
serverStub
The inner proxy of this server
|
private Uuid |
serviceID
ServiceID returned from the lookup registration process
|
private static String |
SNAPSHOT_THREAD_SOURCE_CLASS |
private Object |
snapshotNotifier
Object on which the snapshot-taking thread will synchronize
|
private Thread |
snapshotter
Snapshot-taking thread
|
private boolean |
started |
(package private) static Logger |
STARTUP_LOGGER
Logger for (successful) service startup message
|
private Throwable |
thrown |
private long |
unexportRetryDelay
Length of time to sleep between unexport attempts
|
private static String |
UNKNOWN_EVENT_EXCEPTION_LOG_OBJ_SOURCE_CLASS |
private static String |
VENDOR
ServiceInfo vendor value
|
private static String |
VERSION
ServiceInfo version value
|
DAYS, HOURS, MINUTES, SECONDS| Modifier | Constructor and Description |
|---|---|
(package private) |
MailboxImpl(ActivationID activationID,
MarshalledObject data)
Activation constructor
|
private |
MailboxImpl(Configuration config,
ActivationID activID,
boolean persistant,
Object[] logMessage) |
private |
MailboxImpl(MailboxImplInit init,
ActivationID activID,
boolean persistent,
Object[] logMessage) |
private |
MailboxImpl(String[] configArgs,
ActivationID activID,
boolean persistant,
Object[] logMessage) |
(package private) |
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() |
private static Configuration |
config(String[] configArgs) |
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.
|
(package private) static void |
dumpAttrs(Entry[] attrs,
Logger logger,
Level level)
Utility method for displaying lookup service attributes
|
(package private) static void |
dumpGroups(String[] grps,
Logger logger,
Level level)
Utility method for displaying lookup group attributes
|
(package 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.
|
(package 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.
|
(package 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 static MailboxImplInit |
init(Configuration config,
LoginContext loginContext,
ActivationID activID,
boolean persistant,
Object[] logMessage) |
protected void |
initFailed(Throwable e)
Log information about failing to initialize the service and rethrow the
appropriate exception.
|
private static LoginContext |
loginContext(Configuration config) |
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.
|
(package 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 |
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.
|
void |
start()
Called after construction, this method enables objects to delay
starting threads or exporting until after construction is complete,
to allow safe publication of the service in accordance with the JMM.
|
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 LEASE_LOGGER
static final Logger DELIVERY_LOGGER
static final Logger ADMIN_LOGGER
static final Logger INIT_LOGGER
static final Logger RECEIVE_LOGGER
static final Logger EXPIRATION_LOGGER
static final Logger RECOVERY_LOGGER
static final Logger PERSISTENCE_LOGGER
static final Logger STARTUP_LOGGER
static final Logger OPERATIONS_LOGGER
static final String MAILBOX_SOURCE_CLASS
private static final String NOTIFIER_SOURCE_CLASS
private static final String NOTIFY_TASK_SOURCE_CLASS
private static final String DESTROY_THREAD_SOURCE_CLASS
private static final String EXPIRATION_THREAD_SOURCE_CLASS
private static final String REGISTRATION_LOG_OBJ_SOURCE_CLASS
private static final String REGISTRATION_ENABLED_LOG_OBJ_SOURCE_CLASS
private static final String REGISTRATION_DISABLED_LOG_OBJ_SOURCE_CLASS
private static final String REGISTRATION_ITERATOR_ENABLED_LOG_OBJ_SOURCE_CLASS
private static final String LOOKUP_GROUPS_CHANGED_LOG_OBJ_SOURCE_CLASS
private static final String LOOKUP_LOCATORS_CHANGED_LOG_OBJ_SOURCE_CLASS
private static final String ATTRS_ADDED_LOG_OBJ_SOURCE_CLASS
private static final String ATTRS_MODIFIED_LOG_OBJ_SOURCE_CLASS
private static final String REGISTRATION_RENEWED_LOG_OBJ_SOURCE_CLASS
private static final String REGISTRATION_CANCELLED_LOG_OBJ_SOURCE_CLASS
private static final String UNKNOWN_EVENT_EXCEPTION_LOG_OBJ_SOURCE_CLASS
private static final String SNAPSHOT_THREAD_SOURCE_CLASS
private static final String PRODUCT
private static final String MANUFACTURER
private static final String VENDOR
private static final String VERSION
private static final int LOG_VERSION
private static final Entry[] BASE_LOOKUP_ATTRS
private volatile MailboxBackEnd serverStub
private volatile MailboxProxy mailboxProxy
private volatile MailboxAdminProxy mailboxAdminProxy
private final ReadersWriter concurrentObj
private final Map<Uuid,ServiceRegistration> regByID
Uuid to ServiceRegistrationprivate final TreeMap<ServiceRegistration,ServiceRegistration> regByExpiration
regByID.private final List<Uuid> pendingReg
private final Map<Uuid,MailboxImpl.NotifyTask> activeReg
private final ReliableLog log
private volatile boolean inRecovery
private int logFileSize
private int logToSnapshotThreshold
private final Object snapshotNotifier
private final Thread snapshotter
protected final LoginContext loginContext
private final String persistenceDirectory
private final ProxyPreparer listenerPreparer
private ProxyPreparer recoveredListenerPreparer
protected final Exporter exporter
private volatile Uuid serviceID
private final ActivationID activationID
private final boolean activationPrepared
private final ActivationSystem activationSystem
private final EventLogFactory eventLogFactory
EventLogIterator generatorprivate final LeasePeriodPolicy leasePolicy
LeasePeriodPolicy for this serviceprivate volatile LeaseFactory leaseFactory
LandLordLeaseFactory we use to create leasesprivate final MailboxImpl.LocalLandlordAdaptor localLandlord
private JoinManager joiner
private DiscoveryManagement lookupDiscMgr
private Entry[] lookupAttrs
private String[] lookupGroups
private LookupLocator[] lookupLocators
private static ProxyPreparer locatorToJoinPreparer
private static ProxyPreparer recoveredLocatorToJoinPreparer
private final Thread notifier
private final Object eventNotifier
private final Thread expirer
private long minRegExpiration
private final Object expirationNotifier
private final Object destroyLock
private volatile boolean destroySucceeded
destroyLock.private final long maxUnexportDelay
unexport(true)private final long unexportRetryDelay
private final ReadyState readyState
private volatile 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 final boolean persistent
boolean flag used to determine persistence support.
Defaulted to true, and overridden in the constructor overload that takes
a boolean argument.private Configuration config
private Throwable thrown
private boolean started
private AccessControlContext context
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 serverExceptionMailboxImpl(String[] configArgs, LifeCycle lc, boolean persistent) throws Exception
Exceptionprivate MailboxImpl(Configuration config, ActivationID activID, boolean persistant, Object[] logMessage) throws LoginException, ActivationException, IOException, RemoteException, Exception
private MailboxImpl(MailboxImplInit init, ActivationID activID, boolean persistent, Object[] logMessage)
private MailboxImpl(String[] configArgs, ActivationID activID, boolean persistant, Object[] logMessage) throws ConfigurationException, ActivationException, IOException, RemoteException, Exception
public Object getProxy()
ProxyAccessornull is returned.getProxy in interface ProxyAccessornullpublic Object getServiceProxy()
ServiceProxyAccessornull.getServiceProxy in interface ServiceProxyAccessorpublic Object getAdmin() throws RemoteException
AdministrablegetAdmin in interface AdministrableRemoteExceptionJoinAdminprivate static Configuration config(String[] configArgs) throws ConfigurationException
ConfigurationExceptionprivate static LoginContext loginContext(Configuration config) throws ConfigurationException
ConfigurationExceptionprivate static MailboxImplInit init(Configuration config, LoginContext loginContext, ActivationID activID, boolean persistant, Object[] logMessage) throws ConfigurationException, LoginException, RemoteException, ActivationException, IOException, Exception
public void start()
throws Exception
StartableIn addition to starting threads after construction, it also allows objects to avoid throwing an exception during construction to avoid finalizer attacks.
The implementation is required to ensure start() is idempotent (only executed once, additional invocations must return immediately).
private void cleanup()
public MailboxRegistration register(long leaseDuration) throws RemoteException, LeaseDeniedException
EventMailboxregister method to register themselves with
the service.register in interface EventMailboxleaseDuration - the requested lease duration in millisecondsMailboxRegistrationRemoteException - 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
PullEventMailboxpullRegister method to register themselves with
the service.pullRegister in interface PullEventMailboxleaseDuration - the requested lease duration in millisecondsMailboxPullRegistrationRemoteException - 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
MailboxBackEndenableDelivery in interface MailboxBackEnduuid - The unique registration identifiertarget - The designated delivery target for event notificationsRemoteExceptionThrowThisMailboxRegistration.enableDelivery(net.jini.core.event.RemoteEventListener)public void disableDelivery(Uuid uuid) throws RemoteException, ThrowThis
MailboxBackEnddisableDelivery in interface MailboxBackEnduuid - The unique registration identifierRemoteExceptionThrowThisMailboxRegistration.disableDelivery()public RemoteEventIteratorData getRemoteEvents(Uuid uuid) throws RemoteException, ThrowThis
MailboxBackEndgetRemoteEvents in interface MailboxBackEnduuid - The unique registration identifierRemoteExceptionThrowThisMailboxPullRegistration.getRemoteEvents()public Collection getNextBatch(Uuid regId, Uuid iterId, long timeout, Object lastEventCookie) throws InvalidIteratorException, ThrowThis
MailboxBackEndgetNextBatch in interface MailboxBackEndregId - The unique registration identifierInvalidIteratorExceptionThrowThispublic void addUnknownEvents(Uuid uuid, Collection unknownEvents) throws RemoteException, ThrowThis
MailboxBackEndaddUnknownEvents in interface MailboxBackEnduuid - The unique registration identifierunknownEvents - collection of unknown events to be added to
the associated registration's unknown event list.RemoteExceptionThrowThisMailboxPullRegistration.getRemoteEvents()public void notify(Uuid registrationID, RemoteEvent theEvent) throws UnknownEventException, RemoteException, ThrowThis
MailboxBackEndnotify in interface MailboxBackEndregistrationID - The unique registration identifiertheEvent - The event to store and/or forwardUnknownEventExceptionRemoteExceptionThrowThisRemoteEventListener.notify(net.jini.core.event.RemoteEvent)public long renew(Uuid cookie, long extension) throws LeaseDeniedException, UnknownLeaseException, RemoteException
Landlordrenew method is called.
Renews the lease that is associated with the given cookie.renew in interface Landlordcookie - 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 cookieRemoteException - if a communications failure occurspublic void cancel(Uuid cookie) throws UnknownLeaseException, RemoteException
Landlordcancel method is
called. Cancels the lease that is associated with the given
cookie.cancel in interface Landlordcookie - the Uuid associated with the lease who's
renew method was calledUnknownLeaseException - if landlord does not know about
a lease with the specified cookieRemoteException - if a communications failure occurspublic Landlord.RenewResults renewAll(Uuid[] cookies, long[] extension) throws RemoteException
LandlordrenewAll method is called. Should renew the lease that is
associated with each element of cookiesrenewAll in interface Landlordcookies - an array of Uuids, each universally and
uniquely identifying a lease granted by this
Landlordextension - 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
LandlordcancelAll method is called. Should cancel the lease that is
associated with each element of cookiescancelAll in interface Landlordcookies - an array of Uuids, each universally and
uniquely identifying a lease granted by this
Landlordcookies
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()
DestroyAdmindestroy in interface DestroyAdminpublic Entry[] getLookupAttributes() throws RemoteException
JoinAdmingetLookupAttributes in interface JoinAdminRemoteExceptionpublic void addLookupAttributes(Entry[] attrSets) throws RemoteException
JoinAdminaddLookupAttributes in interface JoinAdminattrSets - the attribute sets to addRemoteExceptionpublic void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets) throws RemoteException
JoinAdminmodifyLookupAttributes in interface JoinAdminattrSetTemplates - the templates for matching attribute setsattrSets - the modifications to make to matching setsRemoteExceptionServiceRegistration.modifyAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])public String[] getLookupGroups() throws RemoteException
JoinAdmingetLookupGroups in interface JoinAdminRemoteExceptionJoinAdmin.setLookupGroups(java.lang.String[])public void addLookupGroups(String[] groups) throws RemoteException
JoinAdminaddLookupGroups in interface JoinAdmingroups - groups to joinRemoteExceptionJoinAdmin.removeLookupGroups(java.lang.String[])public void removeLookupGroups(String[] groups) throws RemoteException
JoinAdminremoveLookupGroups in interface JoinAdmingroups - groups to leaveRemoteExceptionJoinAdmin.addLookupGroups(java.lang.String[])public void setLookupGroups(String[] groups) throws RemoteException
JoinAdminsetLookupGroups in interface JoinAdmingroups - groups to joinRemoteExceptionJoinAdmin.getLookupGroups()public LookupLocator[] getLookupLocators() throws RemoteException
JoinAdmingetLookupLocators in interface JoinAdminRemoteExceptionJoinAdmin.setLookupLocators(net.jini.core.discovery.LookupLocator[])public void addLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdminaddLookupLocators in interface JoinAdminlocators - locators of specific lookup services to joinRemoteExceptionJoinAdmin.removeLookupLocators(net.jini.core.discovery.LookupLocator[])public void removeLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdminremoveLookupLocators in interface JoinAdminlocators - locators of specific lookup services to leaveRemoteExceptionJoinAdmin.addLookupLocators(net.jini.core.discovery.LookupLocator[])public void setLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdminsetLookupLocators in interface JoinAdminlocators - locators of specific lookup services to joinRemoteExceptionJoinAdmin.getLookupLocators()private void addUnknownEvent(Uuid regID, EventID evid)
private void addUnknownEventDo(Uuid regID, EventID evid)
private ServiceRegistration getServiceRegistration(Uuid regID) throws ThrowThis
ThrowThisprivate void removeRegistration(Uuid regID, ServiceRegistration reg)
private void removeRegistration(Uuid regID, ServiceRegistration reg, boolean initializing)
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
UnknownLeaseExceptionprivate Landlord.RenewResults renewAllDo(Uuid[] cookie, long[] extension) throws RemoteException
RemoteExceptionprivate Map cancelAllDo(Uuid[] cookie) throws RemoteException
RemoteExceptionprivate void enableDeliveryDo(Uuid uuid, RemoteEventListener preparedTarget) throws ThrowThis
ThrowThisprivate void enableRegistration(Uuid uuid, RemoteEventListener preparedTarget) throws ThrowThis
ThrowThisprivate void disableDeliveryDo(Uuid uuid) throws ThrowThis
ThrowThisprivate void disableRegistration(Uuid uuid) throws ThrowThis
ThrowThisprivate void enableRegistrationIterator(Uuid regId, Uuid iterId) throws ThrowThis
ThrowThisprivate void disableRegistrationIterator(Uuid regId) throws ThrowThis
ThrowThisprivate void addUnknownEventsDo(Uuid uuid, Collection unknownEvents) throws ThrowThis
ThrowThisprivate RemoteEventIteratorData getRemoteEventsDo(Uuid uuid) throws ThrowThis
ThrowThisprivate Collection getNextBatchDo(Uuid regId, Uuid iterId, long timeout, Object lastEventCookie) throws InvalidIteratorException, ThrowThis
InvalidIteratorExceptionThrowThisprivate void validateIterator(Uuid regId, Uuid iterId) throws InvalidIteratorException, ThrowThis
InvalidIteratorExceptionThrowThisprivate 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.LocalLogHandlerprivate 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:
IOExceptionprivate void recoverSnapshot(InputStream in) throws IOException, ClassNotFoundException
The data retrieved by this method from the snapshot file is shown below:
IOExceptionClassNotFoundExceptionstatic void dumpGroups(String[] grps, Logger logger, Level level)
static void dumpLocators(LookupLocator[] locs, Logger logger, Level level)
static void dumpAttrs(Entry[] attrs, Logger logger, Level level)
protected void initFailed(Throwable e) throws Exception
e - the exception produced by the failureExceptionprivate 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
RemoteExceptionSecurityException - when preparation of any of the elements
of the input array fails because of a
SecurityExceptionstatic LookupLocator[] prepareExistingLocators(ProxyPreparer preparer, LookupLocator[] lookupLocators)
public TrustVerifier getProxyVerifier()
ServerProxyTrustTrustVerifier 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 ServerProxyTrustTrustVerifier that can be used to verify that
a proxy can be trusted as a proxy for the servicestatic boolean ensureCurrent(LeasedResource resource)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.