Return-Path: X-Original-To: apmail-zest-commits-archive@minotaur.apache.org Delivered-To: apmail-zest-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB57418D40 for ; Sun, 29 Nov 2015 14:22:46 +0000 (UTC) Received: (qmail 64890 invoked by uid 500); 29 Nov 2015 14:22:46 -0000 Delivered-To: apmail-zest-commits-archive@zest.apache.org Received: (qmail 64827 invoked by uid 500); 29 Nov 2015 14:22:46 -0000 Mailing-List: contact commits-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list commits@zest.apache.org Received: (qmail 64791 invoked by uid 99); 29 Nov 2015 14:22:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Nov 2015 14:22:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 585AAE00C5; Sun, 29 Nov 2015 14:22:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@zest.apache.org Date: Sun, 29 Nov 2015 14:22:47 -0000 Message-Id: In-Reply-To: <0d3111cb7f8d48abbe6bcbf84bcb1d9a@git.apache.org> References: <0d3111cb7f8d48abbe6bcbf84bcb1d9a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Tue Nov 17 19:21:45 2015 +0800 Committer: Niclas Hedhman 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.emptyList(), + throw new ConcurrentEntityModificationException( Collections.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.