You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Andi Huber (JIRA)" <ji...@apache.org> on 2018/06/27 05:00:00 UTC

[jira] [Reopened] (ISIS-1960) Action background execution: provide built-in default implementation

     [ https://issues.apache.org/jira/browse/ISIS-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andi Huber reopened ISIS-1960:
------------------------------

Reopening, because current solution has issues:

1) We do delegate execution of a background task while the current transaction is still open. Instead we have to ensure that the background task does not start before the current transaction has been committed.
2) Any parameters passed over to the action, that needs to run in background must be serializable. One can not pass over transaction scoped entities. (We need a way to enforce this, best at compile-time.)


 

> Action background execution: provide built-in default implementation
> --------------------------------------------------------------------
>
>                 Key: ISIS-1960
>                 URL: https://issues.apache.org/jira/browse/ISIS-1960
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Andi Huber
>            Assignee: Andi Huber
>            Priority: Major
>             Fix For: 2.0.0-M1
>
>
> We want this code to run out-of the box (without the need for developers to provide their own implementation of *BackgroundCommandService*) ...
> {code:java}
> @Inject private BackgroundService2 backgroundService;
> @Action
> public SimpleObject runSlowlyInBackground(){
> 	backgroundService.execute(this).runSlowly();
> 	return this;
> }
>     
> @Action
> public SimpleObject runSlowly(){
> 	try {
> 		Thread.sleep(8000); // wait 8s
> 	} catch (InterruptedException e) {
> 		e.printStackTrace();
> 	}	
> 	
> 	val dummy = new SimpleObject();
> 	dummy.setName("Dummy");
> 	
> 	repositoryService.persist(dummy);
> 	
> 	return this;
> }
> {code}
> We solve this using a default ExecutorService to run Action invocations in the background.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)