1 15 package org.apache.hivemind.impl; 16 17 import org.apache.hivemind.Messages; 18 import org.apache.hivemind.ShutdownCoordinator; 19 import org.apache.hivemind.service.ClassFactory; 20 import org.apache.hivemind.service.ThreadLocalStorage; 21 22 27 public class StandardWorker implements Worker 28 { 29 31 private ClassFactory _classFactory; 32 33 private Messages _messages; 34 35 private String _serviceId; 36 37 private ShutdownCoordinator _shutdownCoordinator; 38 39 private ThreadLocalStorage _threadLocalStorage; 40 41 public ClassFactory getClassFactory() 42 { 43 return _classFactory; 44 } 45 46 public Messages getMessages() 47 { 48 return _messages; 49 } 50 51 public String getServiceId() 52 { 53 return _serviceId; 54 } 55 56 public ShutdownCoordinator getShutdownCoordinator() 57 { 58 return _shutdownCoordinator; 59 } 60 61 public ThreadLocalStorage getThreadLocalStorage() 62 { 63 return _threadLocalStorage; 64 } 65 66 public void initializeService() 67 { 68 } 69 70 public void run(Runnable runnable) 71 { 72 _threadLocalStorage.put("thread-runnable", runnable); 73 74 runnable.run(); 75 } 76 77 public void setClassFactory(ClassFactory factory) 78 { 79 _classFactory = factory; 80 } 81 82 public void setMessages(Messages messages) 83 { 84 _messages = messages; 85 } 86 87 public void setServiceId(String string) 88 { 89 _serviceId = string; 90 } 91 92 public void setShutdownCoordinator(ShutdownCoordinator coordinator) 93 { 94 _shutdownCoordinator = coordinator; 95 } 96 97 public void setThreadLocalStorage(ThreadLocalStorage storage) 98 { 99 _threadLocalStorage = storage; 100 } 101 102 } | Popular Tags |