public class UserInfo extends Object implements Comparable<UserInfo>
EventFilter
) and the last
activity time for the user.Constructor and Description |
---|
UserInfo(String aUserId)
Creates a new UserInfo for the user id.
|
Modifier and Type | Method and Description |
---|---|
void |
addEvent(Domain aDomain,
Event anEvent)
Adds an event for a domain to the user.
|
int |
compareTo(UserInfo aUserInfo) |
boolean |
equals(Object anObject) |
EventFilter |
getEventFilter(Domain aDomain)
Returns the EventFilter for the domain.
|
long |
getLastActivityTime()
Returns the last activity time.
|
UnlistenEvent |
getUnlistenEvent()
Returns the registered
UnlistenEvent . |
String |
getUserId()
Returns the user id.
|
int |
hashCode() |
boolean |
isEventsEmpty()
Checks if events are available.
|
void |
notifyEventListening()
doNotifyAll informs all waiting Threads for new events.
|
boolean |
removeEventFilter(Domain aDomain)
Removes the EventFilter for a domain.
|
void |
reportUserActivity()
That method must be called to report a user activity and protects the user from a timeout for the time of the
timeout interval (
EventServiceConfiguration.getTimeoutTime() ). |
List<DomainEvent> |
retrieveEvents(int aMaxEvents)
Returns and removes all recorded events.
|
void |
setEventFilter(Domain aDomain,
EventFilter anEventFilter)
Sets an EventFilter to a domain.
|
void |
setLastActivityTime(long aLastActivityTime)
Sets the last activity time.
|
void |
setUnlistenEvent(UnlistenEvent anUnlistenEvent)
A custom
UnlistenEvent can be set which is transferred
to all registered UnlistenEventListener instances when
an unlisten occurred (for example by a timeout or when a user/client leaves a domain). |
String |
toString()
The user id is used to represent the UserInfo.
|
public void addEvent(Domain aDomain, Event anEvent)
aDomain
- domainanEvent
- eventpublic void notifyEventListening()
public List<DomainEvent> retrieveEvents(int aMaxEvents)
aMaxEvents
- maximum amount of events which should be processed (at once).
The rest will be processed with the next call/request (again to the maximum amount, of course).
The maximum amount of events prevents the logic from endless seeking of events (for example when more events are concurrently added than this logic/thread can process).public boolean isEventsEmpty()
public void setEventFilter(Domain aDomain, EventFilter anEventFilter)
aDomain
- domain where the EventFilter should be applied.anEventFilter
- EventFilter to filter the events for the domainpublic boolean removeEventFilter(Domain aDomain)
aDomain
- domain where the EventFilter to remove is applied.EventFilter
is removed, otherwise false
(for example the EventFilter
was already removed before)public EventFilter getEventFilter(Domain aDomain)
aDomain
- domainpublic UnlistenEvent getUnlistenEvent()
UnlistenEvent
. That can be
a custom UnlistenEvent
which can be set with
setUnlistenEvent(de.novanic.eventservice.client.event.listener.unlisten.UnlistenEvent)
or a default/generic UnlistenEvent
when no custom
UnlistenEvent
is registered.UnlistenEvent
to report a timeout or
a user/client which left a domain.public void setUnlistenEvent(UnlistenEvent anUnlistenEvent)
UnlistenEvent
can be set which is transferred
to all registered UnlistenEventListener
instances when
an unlisten occurred (for example by a timeout or when a user/client leaves a domain). When no custom
UnlistenEvent
is registered, a default/generic
UnlistenEvent
will be processed and reported.anUnlistenEvent
- UnlistenEvent
which should be
triggered.public void setLastActivityTime(long aLastActivityTime)
aLastActivityTime
- last activity timepublic long getLastActivityTime()
public void reportUserActivity()
EventServiceConfiguration.getTimeoutTime()
).public int compareTo(UserInfo aUserInfo)
compareTo
in interface Comparable<UserInfo>
Copyright © 2012. All Rights Reserved.