Alfresco colgado en Quartz job

cancel
Showing results for 
Search instead for 
Did you mean: 
cybermakoki
Member II

Alfresco colgado en Quartz job

Hola!

He seguido la mini-guia de scheduled actions para creame un quartz job que se ejecute cada hora…

Este es mi código:



public class MyJOB extends QuartzJobBean {     
   
   private ActionService actionService;
      private AuthenticationComponent authenticationComponent;
      private TransactionService transactionService;
      
      protected void executeInternal(JobExecutionContext jobContext) {
      
                               
         Authentication currentAuthentication = getAuthenticationComponent().getCurrentAuthentication();
         // authenticate as system user
         getAuthenticationComponent().setSystemUserAsCurrentUser();
         UserTransaction tx = null;
         try {
            tx = getTransactionService().getUserTransaction();
            tx.begin();

            Action myJobEx= getActionService().createAction(MyJOBExecuter.NAME);
          
            getActionService().executeAction(myJobEx, null);
           
           
           
         } catch (Throwable err) {
            err.printStackTrace();
            try {
               if (tx != null) {
                  tx.rollback();
               }
            } catch (Exception tex) {
            }
         } finally {
            // restore user security context
            getAuthenticationComponent().setCurrentAuthentication(currentAuthentication);
         }
      }


      public void setAuthenticationComponent(AuthenticationComponent authenticationComponent) {
         this.authenticationComponent = authenticationComponent;
      }


      public AuthenticationComponent getAuthenticationComponent() {
         return authenticationComponent;
      }


      public void setActionService(ActionService actionService) {
         this.actionService = actionService;
      }


      public ActionService getActionService() {
         return actionService;
      }


      public void setTransactionService(TransactionService transactionService) {
         this.transactionService = transactionService;
      }


      public TransactionService getTransactionService() {
         return transactionService;
      }
            
   

Resumiendo, al final lo que hace es mover un documento de una carpeta a otra en función de una propiedad.

La cosa es que aunq parece que ha terminado de ejecutar la acción, no lo hace y se queda colgado el servidor, no puedo hacer nada… tengo que pararlo y reiniciar…

Tiene que haber algún problema en el Job porque si ejecuto el action de forma manual funciona bien.

Alguna idea???

Muchas gracias de antemano! Smiley Happy
2 Replies
cybermakoki
Member II

Re: Alfresco colgado en Quartz job

Me he dado cuenta de que solo se queda colgado cuando tiene que mover un expediente, si no mueve nada, no se queda colgado… Smiley Frustrated
massanen_2296
Member II

Re: Alfresco colgado en Quartz job

buenas, un poco tarde…. pero podría ser que el error lo causara no hacer el tx.rollback() cuando acabas la transacción. Solo lo haces en el catch, es decir, cuando da un error. Añadiendo lo siguiente en el "finally"


finally {
         // restore user security context
         authenticationComponent
               .setCurrentAuthentication(currentAuthentication);
         try {
             if (tx != null) {
                tx.rollback();
             }
          } catch (Exception tex) {
          }
      }

puede ser que no se cuelgue.