大家。我是新来的(stackoverflow)。我在Java EE中实现Schedule时遇到问题。我的代码:
@Startup
@Singleton
@Lock(LockType.READ)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionManagement(TransactionManagementType.CONTAINER)
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
public class MySchedule {
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Schedule(dayOfWeek = "Sun", hour = "1", minute = "0", second = "0" )
public void sendMailWithAttachments()
{
// do some manipulation
}
问题是我在部署它时不停止调用此方法。只有当dayOfWeek设置为今天时才能正常工作。如果今天是星期日和dayOfWeek =“太阳”它可以正常工作,但是当我尝试将其更改为星期一或其他日子并重新部署循环时。 我正在使用glassfish 3.1.2.2