public final class PooledEvent
extends java.lang.Object
implements java.util.concurrent.Delayed
PooledEvent
- A pooled event.Constructor and Description |
---|
PooledEvent(int contextId,
int userId,
int accountId,
java.lang.String fullname,
boolean contentRelated,
boolean immediateDelivery,
com.openexchange.session.Session session)
Initializes a new
PooledEvent with default topic . |
PooledEvent(java.lang.String topic,
int contextId,
int userId,
int accountId,
java.lang.String fullname,
boolean contentRelated,
boolean immediateDelivery,
com.openexchange.session.Session session)
Initializes a new
PooledEvent . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.util.concurrent.Delayed o) |
boolean |
equals(java.lang.Object obj) |
boolean |
equalsByUser(int userId,
int contextId)
Checks if this pooled events matches specified user ID and context ID.
|
int |
getAccountId()
Gets the account ID.
|
int |
getContextId()
Gets the context ID.
|
long |
getDelay(java.util.concurrent.TimeUnit unit) |
java.lang.String |
getFullname()
Gets the fullname
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Gets the properties.
|
java.lang.Object |
getProperty(java.lang.String name)
Gets given property.
|
com.openexchange.session.Session |
getSession()
Gets the session
|
java.lang.String |
getTopic()
Gets the topic for this event.
|
int |
getUserId()
Gets the user ID.
|
int |
hashCode() |
boolean |
isAsync()
Checks whether the event should be delivered asynchronously.
|
boolean |
isContentRelated()
Checks for a content-related event.
|
long |
lastAccessed()
Gets this pooled notification's last-accessed time stamp.
|
PooledEvent |
putProperty(java.lang.String name,
java.lang.Object value)
Puts given property.
|
void |
removesProperty(java.lang.String name)
Removes given property.
|
PooledEvent |
setAsync(boolean async)
Sets whether the event should be delivered asynchronously (default behavior).
|
void |
touch()
Touches this pooled notification; meaning its last-accessed time stamp is set to now.
|
public PooledEvent(int contextId, int userId, int accountId, java.lang.String fullname, boolean contentRelated, boolean immediateDelivery, com.openexchange.session.Session session)
PooledEvent
with default topic
.contextId
- The context IDuserId
- The user IDaccountId
- The account IDfullname
- The folder fullnamecontentRelated
- true
for a content-related event; otherwise false
immediateDelivery
- true
for immediate delivery; otherwise false
session
- The sessionpublic PooledEvent(java.lang.String topic, int contextId, int userId, int accountId, java.lang.String fullname, boolean contentRelated, boolean immediateDelivery, com.openexchange.session.Session session)
PooledEvent
.contextId
- The context IDuserId
- The user IDaccountId
- The account IDfullname
- The folder fullnamecontentRelated
- true
for a content-related event; otherwise false
immediateDelivery
- true
for immediate delivery; otherwise false
session
- The sessionpublic PooledEvent putProperty(java.lang.String name, java.lang.Object value)
name
- The property namevalue
- The property valuepublic java.lang.Object getProperty(java.lang.String name)
name
- The property namepublic void removesProperty(java.lang.String name)
name
- The property namepublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
public PooledEvent setAsync(boolean async)
false
EventPool.put(PooledEvent)
does not return to the caller until delivery of the event is completed.
Note: Works only if this pooled event is considered for immediate delivery.
async
- true
to deliver asynchronously; otherwise false
public boolean isAsync()
true
to deliver asynchronously; otherwise false
public long getDelay(java.util.concurrent.TimeUnit unit)
getDelay
in interface java.util.concurrent.Delayed
public int compareTo(java.util.concurrent.Delayed o)
compareTo
in interface java.lang.Comparable<java.util.concurrent.Delayed>
public java.lang.String getTopic()
public void touch()
public long lastAccessed()
public boolean equalsByUser(int userId, int contextId)
userId
- The user IDcontextId
- The context IDtrue
this pooled events matches; otherwise false
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int getContextId()
public int getUserId()
public int getAccountId()
public java.lang.String getFullname()
public com.openexchange.session.Session getSession()
public boolean isContentRelated()
true
for a content-related event; otherwise false