]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/SpaceListenerImpl.java
Make cook and waiter look around for work to do if they are idle
[pub/jan/sbc.git] / src / main / java / at / ac / tuwien / sbc / valesriegler / xvsm / SpaceListenerImpl.java
1 package at.ac.tuwien.sbc.valesriegler.xvsm;
2
3 import java.io.Serializable;
4 import java.util.List;
5
6 import org.mozartspaces.capi3.AnyCoordinator;
7 import org.mozartspaces.core.Capi;
8 import org.mozartspaces.core.ContainerReference;
9 import org.mozartspaces.core.MzsConstants;
10 import org.mozartspaces.core.MzsConstants.RequestTimeout;
11
12 /**
13  * 
14  * @author Gregor Riegler <gregor DOT riegler AT gmail DOT com>
15  *
16  * @see SpaceListener
17  */
18 public abstract class SpaceListenerImpl extends SpaceListener {
19
20         private final Capi capi;
21         private final ContainerReference cref;
22
23
24         public SpaceListenerImpl(Capi core, ContainerReference cref) {
25                 this.capi = core;
26                 this.cref= cref;
27         }
28         
29         public SpaceListenerImpl(Capi core, ContainerReference cref, boolean lookAround) {
30                 this(core, cref);
31                 this.lookAround  = lookAround;
32         }
33
34         @Override
35         List<? extends Serializable> getEntries() throws Exception {
36                 return capi.read(cref, AnyCoordinator
37                                 .newSelector(MzsConstants.Selecting.COUNT_MAX),
38                                 RequestTimeout.DEFAULT, null);
39         }
40 }