Methods Summary |
---|
void | cancelled()
if( logger.isLoggable(Level.FINER) ) {
printStateTransition(state_, CANCELLED);
}
currentTask_ = null;
state_ = CANCELLED;
|
void | delivered()
if( logger.isLoggable(Level.FINER) ) {
printStateTransition(state_, BEING_DELIVERED);
}
currentTask_ = null;
if( numFailedDeliveries_ == 0 ) {
numExpirations_++;
}
state_ = BEING_DELIVERED;
|
public boolean | equals(java.lang.Object other)
boolean equal = false;
if( other instanceof RuntimeTimerState ) {
equal = timerId_.equals(((RuntimeTimerState) other).timerId_);
}
return equal;
|
BaseContainer | getContainer()
return container_;
|
long | getContainerId()
return containerId_;
|
EJBTimerTask | getCurrentTimerTask()
return currentTask_;
|
java.util.Date | getInitialExpiration()
return initialExpiration_;
|
long | getIntervalDuration()
return intervalDuration_;
|
java.util.Date | getNextTimeout()
if( !isScheduled() && !isRescheduled() ) {
throw new IllegalStateException();
}
return currentTask_.getTimeout();
|
int | getNumExpirations()
return numExpirations_;
|
int | getNumFailedDeliveries()Number of failed deliveries since timer last transitioned to
the SCHEDULED state.
return numFailedDeliveries_;
|
long | getTimeRemaining()
Date timeout = getNextTimeout();
Date now = new Date();
return (timeout.getTime() - now.getTime());
|
java.lang.String | getTimedObjectApplicationName()
EjbDescriptor ejbDesc = container_.getEjbDescriptor();
Application app = ejbDesc.getApplication();
return (app != null) ? app.getRegistrationName() : "";
|
java.lang.String | getTimedObjectEjbName()
return container_.getEjbDescriptor().getName();
|
java.lang.Object | getTimedObjectPrimaryKey()
return timedObjectPrimaryKey_;
|
TimerPrimaryKey | getTimerId()
return timerId_;
|
public int | hashCode()
return timerId_.hashCode();
|
boolean | isActive()
return (state_ != CANCELLED);
|
boolean | isBeingDelivered()
return (state_ == BEING_DELIVERED);
|
boolean | isCancelled()
return (state_ == CANCELLED);
|
boolean | isCreated()
return (state_ == CREATED);
|
boolean | isPeriodic()
return (intervalDuration_ > 0);
|
boolean | isRescheduled()
return (isScheduled() && (numFailedDeliveries_ > 0));
|
boolean | isScheduled()
return (state_ == SCHEDULED);
|
private void | printStateTransition(int fromState, int toState)
logger.log(Level.FINER, timerId_ + ": " + stateToString(fromState) +
" to " + stateToString(toState));
|
void | rescheduled(EJBTimerTask timerTask)
if( logger.isLoggable(Level.FINER) ) {
printStateTransition(state_, SCHEDULED);
}
currentTask_ = timerTask;
state_ = SCHEDULED;
numFailedDeliveries_++;
|
void | restoredToDelivered()Transition from CANCELLED to DELIVERED when ejbTimeout calls
cancel and then rolls back. Don't reset numFailedDeliveries.
if( logger.isLoggable(Level.FINER) ) {
printStateTransition(state_, BEING_DELIVERED);
}
currentTask_ = null;
state_ = BEING_DELIVERED;
|
void | scheduled(EJBTimerTask timerTask)
if( logger.isLoggable(Level.FINER) ) {
printStateTransition(state_, SCHEDULED);
}
currentTask_ = timerTask;
state_ = SCHEDULED;
numFailedDeliveries_ = 0;
|
java.lang.String | stateToString()
return stateToString(state_);
|
private java.lang.String | stateToString(int state)
switch(state) {
case CREATED :
return "CREATED";
case SCHEDULED :
return "SCHEDULED";
case BEING_DELIVERED :
return "BEING_DELIVERED";
case CANCELLED :
return "CANCELLED";
}
return state + " NOT FOUND";
|
boolean | timedObjectIsEntity()
return (timedObjectPrimaryKey_ != null);
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer();
buffer.append("'" + getTimerId() + "' ");
buffer.append("'TimedObject = " + getTimedObjectEjbName() + "' ");
buffer.append("'Application = " + getTimedObjectApplicationName()
+ "' ");
buffer.append("'" + stateToString() + "' ");
buffer.append("'" + (isPeriodic() ? "PERIODIC' " : "SINGLE-ACTION' "));
buffer.append("'Container ID = " + containerId_ + "' ");
buffer.append("'" + getInitialExpiration() + "' ");
buffer.append("'" + getIntervalDuration() + "' ");
Object pk = getTimedObjectPrimaryKey();
if( pk != null ) {
buffer.append("'" + pk + "' ");
}
return buffer.toString();
|