You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by xu...@apache.org on 2011/05/11 15:33:29 UTC
svn commit: r1101870 - in
/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb:
assembler/classic/InterceptorBindingBuilder.java
config/AnnotationDeployer.java core/timer/EJBCronTrigger.java
core/timer/TimerImpl.java
Author: xuhaihong
Date: Wed May 11 13:33:29 2011
New Revision: 1101870
URL: http://svn.apache.org/viewvc?rev=1101870&view=rev
Log:
No function change, just format codes a bit
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InterceptorBindingBuilder.java
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InterceptorBindingBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InterceptorBindingBuilder.java?rev=1101870&r1=1101869&r2=1101870&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InterceptorBindingBuilder.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InterceptorBindingBuilder.java Wed May 11 13:33:29 2011
@@ -114,19 +114,14 @@ public class InterceptorBindingBuilder {
}
- while (clazz != null && !clazz.equals(Object.class))
- {
-
+ while (clazz != null && clazz != Object.class) {
for (Method method : clazz.getDeclaredMethods()) {
List<InterceptorData> methodInterceptors = createInterceptorDatas(method, beanInfo.ejbName, this.bindings);
-
// The bean itself gets to intercept too and is always last.
methodInterceptors.add(beanAsInterceptor);
beanContext.setMethodInterceptors(method, methodInterceptors);
- }
-
- clazz = clazz.getSuperclass();
-
+ }
+ clazz = clazz.getSuperclass();
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1101870&r1=1101869&r2=1101870&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Wed May 11 13:33:29 2011
@@ -2128,8 +2128,8 @@ public class AnnotationDeployer implemen
for (javax.ejb.Schedule schedule : scheduleAnnotationList) {
Timer timer = new Timer();
timer.setPersistent(schedule.persistent());
- timer.setInfo((schedule.info()==null||schedule.info().isEmpty())?null:schedule.info());
- timer.setTimezone((schedule.timezone()==null||schedule.timezone().isEmpty())?null:schedule.timezone());
+ timer.setInfo((schedule.info() == null || schedule.info().isEmpty()) ? null : schedule.info());
+ timer.setTimezone((schedule.timezone() == null || schedule.timezone().isEmpty()) ? null : schedule.timezone());
//Copy TimerSchedule
TimerSchedule timerSchedule = new TimerSchedule();
timerSchedule.setSecond(schedule.second());
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java?rev=1101870&r1=1101869&r2=1101870&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java Wed May 11 13:33:29 2011
@@ -449,51 +449,43 @@ public class EJBCronTrigger extends Trig
int currentFieldIndex = 0;
- while (currentFieldIndex <=6 && calendar.before(stopCalendar)) {
-
- FieldExpression expr = expressions[currentFieldIndex];
- Integer value = expr.getNextValue(calendar);
-
- /*
- * 18.2.1.2 Expression Rules
- * If dayOfMonth has a non-wildcard value and dayOfWeek has a non-wildcard value, then either the
- * dayOfMonth field or the dayOfWeek field must match the current day (even though the other of the
- * two fields need not match the current day).
- */
- if (currentFieldIndex == 2 && !(expressions[3] instanceof AsteriskExpression)){
-
- Calendar calendarDayOfWeek =(Calendar)calendar.clone();
-
+ while (currentFieldIndex <= 6 && calendar.before(stopCalendar)) {
+
+ FieldExpression expr = expressions[currentFieldIndex];
+ Integer value = expr.getNextValue(calendar);
+
+ /*
+ * 18.2.1.2 Expression Rules
+ * If dayOfMonth has a non-wildcard value and dayOfWeek has a non-wildcard value, then either the
+ * dayOfMonth field or the dayOfWeek field must match the current day (even though the other of the
+ * two fields need not match the current day).
+ */
+ if (currentFieldIndex == 2 && !(expressions[3] instanceof AsteriskExpression)) {
+ Calendar calendarDayOfWeek = (Calendar) calendar.clone();
Integer nextDayOfWeek = expressions[3].getNextValue(calendarDayOfWeek);
-
- while (nextDayOfWeek == null){
+ while (nextDayOfWeek == null) {
calendarDayOfWeek.add(Calendar.DAY_OF_MONTH, 1);
nextDayOfWeek = expressions[3].getNextValue(calendarDayOfWeek);
}
-
- if (value!=null && nextDayOfWeek!=null) {
-
+
+ if (value != null && nextDayOfWeek != null) {
calendarDayOfWeek.set(expressions[3].field, nextDayOfWeek);
int newDayOfMonth = calendarDayOfWeek.get(expressions[2].field);
value = Math.min(value, newDayOfMonth);
-
//Next valid DayOfWeek might exist in next month.
calendar.set(Calendar.MONTH, calendarDayOfWeek.get(Calendar.MONTH));
}
}
-
+
if (currentFieldIndex >= 1 && value == null) {
-
- // No suitable value was found, so move back to the previous field
- // and increase the value
- // When current field is HOUR_OF_DAY, its upper field is DAY_OF_MONTH, so we need to -2 due to DAY_OF_WEEK.
- int parentFieldIndex = currentFieldIndex ==4 ? currentFieldIndex- 2 : currentFieldIndex - 1;
- int maxAffectedFieldType = upadteCalendar(calendar, expressions[parentFieldIndex].field, 1);
- currentFieldIndex = CALENDAR_FIELD_TYPE_ORDERED_INDEX_MAP.get(maxAffectedFieldType);
- resetFields(calendar, maxAffectedFieldType, false);
-
+ // No suitable value was found, so move back to the previous field
+ // and increase the value
+ // When current field is HOUR_OF_DAY, its upper field is DAY_OF_MONTH, so we need to -2 due to DAY_OF_WEEK.
+ int parentFieldIndex = currentFieldIndex == 4 ? currentFieldIndex - 2 : currentFieldIndex - 1;
+ int maxAffectedFieldType = upadteCalendar(calendar, expressions[parentFieldIndex].field, 1);
+ currentFieldIndex = CALENDAR_FIELD_TYPE_ORDERED_INDEX_MAP.get(maxAffectedFieldType);
+ resetFields(calendar, maxAffectedFieldType, false);
} else if (value != null) {
-
int oldValue = calendar.get(expr.field);
if (oldValue != value) {
// The value has changed, so update the calendar and reset all
@@ -501,14 +493,11 @@ public class EJBCronTrigger extends Trig
calendar.set(expr.field, value);
resetFields(calendar, expr.field, false);
currentFieldIndex++;
-
} else {
currentFieldIndex++;
}
-
} else {
-
- log.debug("end of getFireTimeAfter, result is:"+ null);
+ log.debug("end of getFireTimeAfter, result is:" + null);
return null;
}
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java?rev=1101870&r1=1101869&r2=1101870&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java Wed May 11 13:33:29 2011
@@ -56,7 +56,7 @@ public class TimerImpl implements Timer
public Serializable getInfo() throws IllegalStateException, NoSuchObjectLocalException {
checkState();
- return timerData.getInfo()==null?null:(Serializable)timerData.getInfo();
+ return (Serializable) timerData.getInfo();
}
public TimerHandle getHandle() throws IllegalStateException, NoSuchObjectLocalException {