Package org.jboss.ejb3.timerservice.mk2.persistence.filestore

Examples of org.jboss.ejb3.timerservice.mk2.persistence.filestore.FileTimerPersistence


    * Creates and returns a new persistent state of this timer
    * @return
    */
   protected TimerEntity createPersistentState()
   {
      return new TimerEntity(this);
   }
View Full Code Here


        if (timer == null || !timer.persistent) {
            return;
        }

        // get the persistent entity from the timer
        final TimerEntity timerEntity = timer.getPersistentState();
        try {
            //if timer persistence is disabled
            if (timerPersistence == null) {
                logger.warn("Timer persistence is not enabled, persistent timers will not survive JVM restarts");
                return;
            }
            if (timerEntity.getTimerState() == TimerState.EXPIRED ||
                    timerEntity.getTimerState() == TimerState.CANCELED) {
                timerPersistence.removeTimer(timerEntity);
            } else {
                timerPersistence.persistTimer(timerEntity);
            }
View Full Code Here

        String timedObjectId = timerHandle.getTimedObjectId();
        if (timerPersistence == null) {
            return null;
        }

        TimerEntity timerEntity = timerPersistence.loadTimer(id, timedObjectId);
        if (timerEntity.isCalendarTimer()) {
            return new CalendarTimer((CalendarTimerEntity) timerEntity, this);
        }
        return new TimerImpl(timerEntity, this);

    }
View Full Code Here

     * Creates and returns a new persistent state of this timer
     *
     * @return
     */
    protected TimerEntity createPersistentState() {
        return new TimerEntity(this);
    }
View Full Code Here

            for (File timerFile : file.listFiles()) {
                FileInputStream in = null;
                try {
                    in = new FileInputStream(timerFile);
                    unmarshaller.start(new InputStreamByteInput(in));
                    final TimerEntity entity = unmarshaller.readObject(TimerEntity.class);
                    timers.put(entity.getId(), entity);
                    unmarshaller.finish();
                } catch (Exception e) {
                    logger.error("Could not restore timer from " + timerFile, e);
                } finally {
                    if (in != null) {
View Full Code Here

        executorService = new ThreadPoolExecutor(coreThreads, maxThreads, 1, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>());
        //only start the persistence service if it has been configured
        final String path = this.path.getOptionalValue();
        if (path != null) {
            timerPersistence = new FileTimerPersistence(transactionManagerInjectedValue.getValue(), transactionSynchronizationRegistryInjectedValue.getValue(), new File(path + File.separatorChar + name), true, module.getModuleLoader());
            timerPersistence.start();
        }
        timerServiceFactory = new TimerServiceFactoryImpl(timerPersistence, transactionManagerInjectedValue.getValue(), executorService);
    }
View Full Code Here

    * @see CalendarTimerTask
    */
   @Override
   protected TimerTask<?> getTimerTask()
   {
      return new CalendarTimerTask(this);
   }
View Full Code Here

    * @see CalendarTimerTask
    */
   @Override
   protected TimerTask<?> getTimerTask()
   {
      return new CalendarTimerTask(this);
   }
View Full Code Here

     *
     * @see CalendarTimerTask
     */
    @Override
    protected TimerTask<?> getTimerTask() {
        return new CalendarTimerTask(this);
    }
View Full Code Here

    * @return
    */
   private TimerService createTimerService()
   {
      // get the TimedObjectInvoker
      TimedObjectInvoker timedObjectInvoker = this.getTimedObjectInvoker();
      // if there's no TimedObjectInvoker, we can't do anything, so just
      // throw an exception
      if (timedObjectInvoker == null)
      {
         throw new IllegalStateException("Cannot create timerservice for EJB " + this.getEjbName()
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.timerservice.mk2.persistence.filestore.FileTimerPersistence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.