You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/11/29 15:22:47 UTC
[2/4] zest-java git commit: ZEST-128 - Tidying up
ZEST-128 - Tidying up
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/725b616f
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/725b616f
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/725b616f
Branch: refs/heads/develop
Commit: 725b616f26074625f9f4b2247d92449b2eab287f
Parents: 2e5671e
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Tue Nov 17 19:21:45 2015 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Tue Nov 17 19:21:45 2015 +0800
----------------------------------------------------------------------
.../apache/zest/entitystore/file/FileEntityStoreMixin.java | 5 +++++
.../rest/client/ContextResourceClientFactoryTest.java | 3 ++-
.../apache/zest/library/scheduler/internal/Execution.java | 9 +++------
3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-java/blob/725b616f/extensions/entitystore-file/src/main/java/org/apache/zest/entitystore/file/FileEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/main/java/org/apache/zest/entitystore/file/FileEntityStoreMixin.java b/extensions/entitystore-file/src/main/java/org/apache/zest/entitystore/file/FileEntityStoreMixin.java
index ce6f74f..791779e 100644
--- a/extensions/entitystore-file/src/main/java/org/apache/zest/entitystore/file/FileEntityStoreMixin.java
+++ b/extensions/entitystore-file/src/main/java/org/apache/zest/entitystore/file/FileEntityStoreMixin.java
@@ -23,6 +23,7 @@ import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
@@ -175,6 +176,10 @@ public class FileEntityStoreMixin
byte[] serializedState = fetch( f );
return new StringReader( new String( serializedState, "UTF-8" ) );
}
+ catch( FileNotFoundException e ){
+ // Can't happen, but it does happen.
+ throw new EntityNotFoundException( entityReference );
+ }
catch( IOException e )
{
throw new EntityStoreException( e );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/725b616f/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
index 47ff667..cab3481 100644
--- a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
@@ -21,6 +21,7 @@ package org.apache.zest.library.rest.client;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
+import org.apache.zest.api.type.HasTypes;
import org.apache.zest.api.usecase.UsecaseBuilder;
import org.hamcrest.CoreMatchers;
import org.junit.After;
@@ -598,7 +599,7 @@ public class ContextResourceClientFactoryTest
public void beforeCompletion()
throws UnitOfWorkCompletionException
{
- throw new ConcurrentEntityModificationException( Collections.<EntityComposite>emptyList(),
+ throw new ConcurrentEntityModificationException( Collections.<EntityComposite, HasTypes>emptyMap(),
UsecaseBuilder.newUsecase( "Testing" ) );
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/725b616f/libraries/scheduler/src/main/java/org/apache/zest/library/scheduler/internal/Execution.java
----------------------------------------------------------------------
diff --git a/libraries/scheduler/src/main/java/org/apache/zest/library/scheduler/internal/Execution.java b/libraries/scheduler/src/main/java/org/apache/zest/library/scheduler/internal/Execution.java
index a92ee2b..08eb627 100644
--- a/libraries/scheduler/src/main/java/org/apache/zest/library/scheduler/internal/Execution.java
+++ b/libraries/scheduler/src/main/java/org/apache/zest/library/scheduler/internal/Execution.java
@@ -36,7 +36,6 @@ import org.apache.zest.api.structure.Module;
import org.apache.zest.api.unitofwork.NoSuchEntityException;
import org.apache.zest.api.unitofwork.UnitOfWork;
import org.apache.zest.api.unitofwork.concern.UnitOfWorkConcern;
-import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation;
import org.apache.zest.library.scheduler.Schedule;
import org.apache.zest.library.scheduler.Scheduler;
import org.apache.zest.library.scheduler.SchedulerConfiguration;
@@ -47,7 +46,6 @@ import org.apache.zest.library.scheduler.SchedulerConfiguration;
* The composite is internal and should never be used by clients.
*/
@Mixins( Execution.ExecutionMixin.class )
-@Concerns( UnitOfWorkConcern.class )
public interface Execution
{
void dispatchForExecution( Schedule schedule );
@@ -58,7 +56,6 @@ public interface Execution
void stop()
throws Exception;
- @UnitOfWorkPropagation( usecase = "Schedule Next Time Update" )
void updateNextTime( ScheduleTime schedule ); // This method is public, only because the UnitOfWorkConcern is wanted.
class ExecutionMixin
@@ -166,15 +163,15 @@ public interface Execution
public void updateNextTime( ScheduleTime oldScheduleTime )
{
long now = System.currentTimeMillis();
- UnitOfWork uow = module.currentUnitOfWork();
- try
+
+ try (UnitOfWork uow = module.newUnitOfWork()) // This will discard() the UoW when block is exited. We are only doing reads, so fine.
{
submitTaskForExecution( oldScheduleTime );
Schedule schedule = uow.get( Schedule.class, oldScheduleTime.scheduleIdentity() );
long nextTime = schedule.nextRun( now + 1000 );
if( nextTime != Long.MIN_VALUE )
{
- ScheduleTime newScheduleTime = new ScheduleTime( schedule.identity().get(), nextTime );
+ ScheduleTime newScheduleTime = new ScheduleTime( oldScheduleTime.scheduleIdentity(), nextTime );
synchronized( lock )
{
// Re-add to the Timing Queue, to re-position the sorting.