1
2
3
4
5 package org.neo.swarm.services.binding;
6
7 import org.neo.swarm.SwarmContainer;
8 import org.neo.swarm.services.Service;
9 import org.neo.swarm.util.threads.ThreadPool;
10
11 /***
12 * Generic BindRunnable Service Wrapper,
13 * @see org.neo.swarm.services.binding.DynamicRunnable
14 * @see org.neo.swarm.services.binding.StaticRunnable
15 * @author navery
16 */
17 public class BindingService implements Service {
18
19 BindingRunnable bindingThread;
20 ThreadPool threadpool;
21 String serviceName;
22
23 /***
24 * @param container
25 * @param appContext
26 * represents the remote perspective of the local application context.
27 * @param acProxyFactory
28 * @param serializer
29 */
30 public BindingService(String serviceName, BindingRunnable bindingThread, ThreadPool threadpool) {
31 this.threadpool = threadpool;
32 this.serviceName = serviceName;
33 this.bindingThread = bindingThread;
34 }
35
36 public void start() {
37 try {
38 threadpool.execute(bindingThread);
39 } catch (InterruptedException e) {
40 e.printStackTrace();
41 }
42 }
43
44 public void stop() {
45 bindingThread.stop();
46 }
47
48 public String getName() {
49 return "multicast dynamic binding";
50 }
51 }