Start migration to updated worker system
This commit is contained in:
@@ -18,7 +18,7 @@ package mimis.application.cmd.windows.gomplayer;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.cmd.windows.WindowsApplication;
|
||||
import mimis.value.Action;
|
||||
import mimis.value.Amount;
|
||||
@@ -101,7 +101,7 @@ public class GomPlayerApplication extends WindowsApplication {
|
||||
}
|
||||
}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected int volumeChangeSign;
|
||||
|
||||
public void start(int volumeChangeSign) throws ActivateException {
|
||||
@@ -115,7 +115,7 @@ public class GomPlayerApplication extends WindowsApplication {
|
||||
}
|
||||
};
|
||||
|
||||
protected class SeekWorker extends Worker {
|
||||
protected class SeekWorker extends ThreadWorker {
|
||||
protected Amount amount;
|
||||
protected int seekDirection;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package mimis.application.cmd.windows.photoviewer;
|
||||
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.cmd.windows.WindowsApplication;
|
||||
import mimis.value.Action;
|
||||
import mimis.value.Key;
|
||||
@@ -109,7 +109,7 @@ public class PhotoViewerApplication extends WindowsApplication {
|
||||
}
|
||||
}
|
||||
|
||||
protected class ZoomWorker extends Worker {
|
||||
protected class ZoomWorker extends ThreadWorker {
|
||||
protected int zoomDirection;
|
||||
|
||||
public void start(int zoomDirection) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package mimis.application.cmd.windows.winamp;
|
||||
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.cmd.windows.WindowsApplication;
|
||||
import mimis.value.Action;
|
||||
import mimis.value.Command;
|
||||
@@ -167,7 +167,7 @@ public class WinampApplication extends WindowsApplication {
|
||||
return user(0, IPC_GETOUTPUTTIME) / 1000;
|
||||
}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected int volumeChangeSign;
|
||||
|
||||
public void start(int volumeChangeSign) {
|
||||
@@ -181,7 +181,7 @@ public class WinampApplication extends WindowsApplication {
|
||||
}
|
||||
};
|
||||
|
||||
protected class SeekWorker extends Worker {
|
||||
protected class SeekWorker extends ThreadWorker {
|
||||
protected int seekDirection;
|
||||
|
||||
public void start(int seekDirection) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package mimis.application.cmd.windows.wmp;
|
||||
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.cmd.windows.WindowsApplication;
|
||||
import mimis.value.Action;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class WMPApplication extends WindowsApplication {
|
||||
}
|
||||
}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected int volumeChangeSign;
|
||||
|
||||
public void start(int volumeChangeSign) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import mimis.application.Application;
|
||||
import mimis.value.Action;
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
|
||||
import com.dt.iTunesController.ITCOMDisabledReason;
|
||||
import com.dt.iTunesController.ITTrack;
|
||||
@@ -177,7 +177,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
||||
public void onAboutToPromptUserToQuitEvent() {}
|
||||
public void onSoundVolumeChangedEvent(int newVolume) {}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected int volumeChangeRate;
|
||||
|
||||
public void start(int volumeChangeRate) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package mimis.application.lirc.ipod;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.lirc.LircApplication;
|
||||
import mimis.device.lirc.remote.WC02IPOButton;
|
||||
import mimis.value.Action;
|
||||
@@ -85,7 +85,7 @@ public class iPodApplication extends LircApplication {
|
||||
}
|
||||
}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected int volumeChangeRate;
|
||||
|
||||
public void activate(int volumeChangeRate) throws ActivateException {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package mimis.application.mpc;
|
||||
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.cmd.windows.WindowsApplication;
|
||||
import mimis.value.Action;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class MPCApplication extends WindowsApplication {
|
||||
return TITLE;
|
||||
}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected int volumeChangeSign;
|
||||
|
||||
public void start(int volumeChangeSign) {
|
||||
@@ -102,7 +102,7 @@ public class MPCApplication extends WindowsApplication {
|
||||
}
|
||||
};
|
||||
|
||||
protected class SeekWorker extends Worker {
|
||||
protected class SeekWorker extends ThreadWorker {
|
||||
protected int seekDirection;
|
||||
|
||||
public void start(int seekDirection) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.application.cmd.CMDApplication;
|
||||
import mimis.util.Native;
|
||||
import mimis.value.Action;
|
||||
@@ -171,7 +171,7 @@ public class VLCApplication extends CMDApplication {
|
||||
return TITLE;
|
||||
}
|
||||
|
||||
protected class VolumeWorker extends Worker {
|
||||
protected class VolumeWorker extends ThreadWorker {
|
||||
protected String volumeChangeSign;
|
||||
|
||||
public void activate(String volumeChangeSign) throws ActivateException {
|
||||
@@ -186,7 +186,7 @@ public class VLCApplication extends CMDApplication {
|
||||
}
|
||||
};
|
||||
|
||||
protected class SeekWorker extends Worker {
|
||||
protected class SeekWorker extends ThreadWorker {
|
||||
protected Amount amount;
|
||||
protected String seekDirection;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package mimis.device.javainput;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.exception.ButtonException;
|
||||
import de.hardcode.jxinput.Button;
|
||||
import de.hardcode.jxinput.Directional;
|
||||
@@ -33,7 +33,7 @@ import de.hardcode.jxinput.event.JXInputDirectionalEvent;
|
||||
import de.hardcode.jxinput.event.JXInputDirectionalEventListener;
|
||||
import de.hardcode.jxinput.event.JXInputEventManager;
|
||||
|
||||
public class JavaInputListener extends Worker implements Runnable, JXInputAxisEventListener, JXInputButtonEventListener, JXInputDirectionalEventListener {
|
||||
public class JavaInputListener extends ThreadWorker implements Runnable, JXInputAxisEventListener, JXInputButtonEventListener, JXInputDirectionalEventListener {
|
||||
protected JavaInputDevice javaInputDevice;
|
||||
protected JXInputDevice jxinputDevice;
|
||||
protected Queue<JXInputAxisEvent> axisEventQueue;
|
||||
|
||||
@@ -18,50 +18,43 @@ package mimis.device.lirc;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Scanner;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import mimis.exception.button.UnknownButtonException;
|
||||
import mimis.util.Native;
|
||||
import mimis.value.Registry;
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.server.socket.TcpClient;
|
||||
|
||||
public class LircService extends Worker {
|
||||
public static final String IP = "localhost";
|
||||
public class LircService extends TcpClient {
|
||||
public static final String IP = "atom";
|
||||
public static final int PORT = 8765;
|
||||
|
||||
protected ArrayList<LircButtonListener> lircButtonListenerList;
|
||||
protected String ip;
|
||||
protected int port;
|
||||
protected Socket socket;
|
||||
protected InputStream inputStream;
|
||||
protected OutputStream outputStream;
|
||||
|
||||
// Pluggable reader and writer?
|
||||
// Receive strings via callback?
|
||||
protected BufferedReader bufferedReader;
|
||||
protected PrintWriter printWriter;
|
||||
protected HashMap<String, LircButton[]> buttonMap;
|
||||
protected String send;
|
||||
|
||||
public LircService() {
|
||||
this(IP, PORT);
|
||||
buttonMap = new HashMap<String, LircButton[]>();
|
||||
send = Native.getValue(Registry.CURRENT_USER, "Software\\LIRC", "password");
|
||||
public static void main(String[] args) {
|
||||
LircService lircService = new LircService();
|
||||
lircService.start(false);
|
||||
}
|
||||
|
||||
public LircService(String ip, int port) {
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
public LircService() {
|
||||
super(IP, PORT);
|
||||
buttonMap = new HashMap<String, LircButton[]>();
|
||||
send = Native.getValue(Registry.CURRENT_USER, "Software\\LIRC", "password");
|
||||
lircButtonListenerList = new ArrayList<LircButtonListener>();
|
||||
}
|
||||
|
||||
@@ -77,44 +70,11 @@ public class LircService extends Worker {
|
||||
lircButtonListenerList.remove(lircButtonListener);
|
||||
}
|
||||
|
||||
|
||||
public void activate() throws ActivateException {
|
||||
logger.trace("Activate LircService");
|
||||
try {
|
||||
socket = new Socket(ip, port);
|
||||
socket.setSoTimeout(SLEEP);
|
||||
|
||||
inputStream = socket.getInputStream();
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
outputStream = socket.getOutputStream();
|
||||
printWriter = new PrintWriter(outputStream);
|
||||
} catch (UnknownHostException e) {
|
||||
logger.error("", e);
|
||||
throw new ActivateException();
|
||||
} catch (IOException e) {
|
||||
logger.error("", e);
|
||||
throw new ActivateException();
|
||||
}
|
||||
super.activate();
|
||||
}
|
||||
|
||||
public synchronized boolean active() {
|
||||
if (active && !socket.isConnected()) {
|
||||
active = false;
|
||||
}
|
||||
return active;
|
||||
}
|
||||
|
||||
public void deactivate() throws DeactivateException {
|
||||
logger.trace("Deactivate LircService");
|
||||
super.deactivate();
|
||||
try {
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("", e);
|
||||
}
|
||||
super.activate();
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
printWriter = new PrintWriter(outputStream);
|
||||
}
|
||||
|
||||
public void work() {
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.Component;
|
||||
import mimis.device.Device;
|
||||
import mimis.input.Feedback;
|
||||
@@ -83,7 +83,7 @@ public class NetworkDevice extends Component implements Device {
|
||||
}
|
||||
}
|
||||
|
||||
protected class Server extends Worker {
|
||||
protected class Server extends ThreadWorker {
|
||||
protected ServerSocket serverSocket;
|
||||
protected int port;
|
||||
|
||||
@@ -138,7 +138,7 @@ public class NetworkDevice extends Component implements Device {
|
||||
}
|
||||
}
|
||||
|
||||
protected class Client extends Worker {
|
||||
protected class Client extends ThreadWorker {
|
||||
protected Socket socket;
|
||||
protected InputStream inputStream;
|
||||
protected OutputStream outputStream;
|
||||
|
||||
@@ -40,7 +40,7 @@ import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
|
||||
public class WiimoteDevice extends Component implements Device, GestureListener {
|
||||
protected static final String TITLE = "Wiimote";
|
||||
@@ -243,7 +243,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
}
|
||||
}
|
||||
|
||||
class LedWorker extends Worker {
|
||||
class LedWorker extends ThreadWorker {
|
||||
protected ArrayCycle<Integer> ledCycle;
|
||||
|
||||
public LedWorker() {
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.util.Scanner;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.exception.device.DeviceNotFoundException;
|
||||
|
||||
public class WiimoteDiscovery extends Worker {
|
||||
public class WiimoteDiscovery extends ThreadWorker {
|
||||
protected static final String WIISCAN = "wiiscan";
|
||||
protected static final int TIMEOUT = 1000;
|
||||
protected WiimoteDevice wiimoteDevice;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.ArrayList;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.Component;
|
||||
import mimis.device.lirc.LircButton;
|
||||
import mimis.device.lirc.remote.PhiliphsRCLE011Button;
|
||||
@@ -151,7 +151,7 @@ public class MotionDevice extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
class ReplayWorker extends Worker {
|
||||
class ReplayWorker extends ThreadWorker {
|
||||
protected ObjectInputStream objectInputStream;
|
||||
protected int count, i, time;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package mimis.input;
|
||||
|
||||
|
||||
public class Feedback implements Input {
|
||||
protected static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -25,19 +25,19 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
|
||||
public class ButtonManager extends Manager {
|
||||
protected static final String TITLE = "Workers";
|
||||
|
||||
protected String title;
|
||||
protected Map<Worker, WorkerButton> buttonMap;
|
||||
protected Map<ThreadWorker, WorkerButton> buttonMap;
|
||||
|
||||
public ButtonManager(Worker... workerArray) {
|
||||
public ButtonManager(ThreadWorker... workerArray) {
|
||||
this(TITLE, workerArray);
|
||||
}
|
||||
|
||||
public ButtonManager(String title, Worker... workerArray) {
|
||||
public ButtonManager(String title, ThreadWorker... workerArray) {
|
||||
super(workerArray);
|
||||
this.title = title;
|
||||
createButtons();
|
||||
@@ -52,8 +52,8 @@ public class ButtonManager extends Manager {
|
||||
}
|
||||
|
||||
protected void createButtons() {
|
||||
buttonMap = new HashMap<Worker, WorkerButton>();
|
||||
for (Worker worker : workerList) {
|
||||
buttonMap = new HashMap<ThreadWorker, WorkerButton>();
|
||||
for (ThreadWorker worker : workerList) {
|
||||
WorkerButton button = new WorkerButton(worker);
|
||||
buttonMap.put(worker, button);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class ButtonManager extends Manager {
|
||||
}
|
||||
|
||||
protected void work() {
|
||||
for (Worker worker : workerList) {
|
||||
for (ThreadWorker worker : workerList) {
|
||||
buttonMap.get(worker).setPressed(worker.active());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.Component;
|
||||
import mimis.input.Task;
|
||||
import mimis.router.Router;
|
||||
@@ -41,13 +41,13 @@ import mimis.value.Target;
|
||||
public class CurrentButtonManager extends ButtonManager implements ActionListener {
|
||||
protected Router router;
|
||||
protected ArrayCycle<Component> componentCycle;
|
||||
protected Map<JRadioButton, Worker> radioButtonMap;
|
||||
protected Map<JRadioButton, ThreadWorker> radioButtonMap;
|
||||
|
||||
public CurrentButtonManager(Router router, ArrayCycle<Component> componentCycle, String title, Worker... workerArray) {
|
||||
public CurrentButtonManager(Router router, ArrayCycle<Component> componentCycle, String title, ThreadWorker... workerArray) {
|
||||
super(title, workerArray);
|
||||
this.componentCycle = componentCycle;
|
||||
this.router = router;
|
||||
radioButtonMap = new HashMap<JRadioButton, Worker>();
|
||||
radioButtonMap = new HashMap<JRadioButton, ThreadWorker>();
|
||||
}
|
||||
|
||||
public JPanel createPanel() {
|
||||
@@ -89,7 +89,7 @@ public class CurrentButtonManager extends ButtonManager implements ActionListene
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
JRadioButton radioButton = (JRadioButton) event.getSource();
|
||||
if (radioButtonMap.containsKey(radioButton)) {
|
||||
Worker worker = radioButtonMap.get(radioButton);
|
||||
ThreadWorker worker = radioButtonMap.get(radioButton);
|
||||
if (componentCycle.contains(worker)) {
|
||||
while (!componentCycle.current().equals(worker)) {
|
||||
componentCycle.next();
|
||||
@@ -100,9 +100,9 @@ public class CurrentButtonManager extends ButtonManager implements ActionListene
|
||||
}
|
||||
|
||||
public void currentChanged() {
|
||||
Worker worker = componentCycle.current();
|
||||
ThreadWorker worker = componentCycle.current();
|
||||
if (radioButtonMap.containsValue(worker)) {
|
||||
for (Entry<JRadioButton, Worker> entry : radioButtonMap.entrySet()) {
|
||||
for (Entry<JRadioButton, ThreadWorker> entry : radioButtonMap.entrySet()) {
|
||||
if (entry.getValue().equals(worker)) {
|
||||
JRadioButton radioButton = (JRadioButton) entry.getKey();
|
||||
radioButton.setSelected(true);
|
||||
|
||||
@@ -20,37 +20,37 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.IntervalWorker;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadIntervalWorker;
|
||||
import base.worker.ThreadWorker;
|
||||
|
||||
public class Manager extends IntervalWorker {
|
||||
public class Manager extends ThreadIntervalWorker {
|
||||
protected static final int INTERVAL = 1000;
|
||||
|
||||
protected ArrayList<Worker> workerList;
|
||||
protected ArrayList<ThreadWorker> workerList;
|
||||
|
||||
public Manager(Worker... workerArray) {
|
||||
workerList = new ArrayList<Worker>();
|
||||
public Manager(ThreadWorker... workerArray) {
|
||||
workerList = new ArrayList<ThreadWorker>();
|
||||
add(workerArray);
|
||||
}
|
||||
|
||||
public void add(Worker... workerArray) {
|
||||
public void add(ThreadWorker... workerArray) {
|
||||
workerList.addAll(Arrays.asList(workerArray));
|
||||
}
|
||||
|
||||
public void remove(Worker... workerArray) {
|
||||
public void remove(ThreadWorker... workerArray) {
|
||||
workerList.removeAll(Arrays.asList(workerArray));
|
||||
}
|
||||
|
||||
protected void deactivate() throws DeactivateException {
|
||||
super.deactivate();
|
||||
for (Worker worker : workerList) {
|
||||
for (ThreadWorker worker : workerList) {
|
||||
worker.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
super.exit();
|
||||
for (Worker worker : workerList) {
|
||||
for (ThreadWorker worker : workerList) {
|
||||
worker.exit();
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class Manager extends IntervalWorker {
|
||||
}
|
||||
|
||||
protected void work() {
|
||||
for (Worker worker : workerList) {
|
||||
for (ThreadWorker worker : workerList) {
|
||||
worker.active();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@ import mimis.Component;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
|
||||
public class WorkerButton extends JToggleButton implements MouseListener {
|
||||
protected static final long serialVersionUID = 1L;
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
protected Worker worker;
|
||||
protected ThreadWorker worker;
|
||||
|
||||
public WorkerButton(Worker worker) {
|
||||
public WorkerButton(ThreadWorker worker) {
|
||||
this.worker = worker;
|
||||
setFocusable(false);
|
||||
addMouseListener(this);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.net.Socket;
|
||||
|
||||
import base.exception.worker.ActivateException;
|
||||
import base.exception.worker.DeactivateException;
|
||||
import base.worker.Worker;
|
||||
import base.worker.ThreadWorker;
|
||||
import mimis.input.Feedback;
|
||||
import mimis.input.Task;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class GlobalRouter extends Router {
|
||||
}
|
||||
}
|
||||
|
||||
class Client extends Worker {
|
||||
class Client extends ThreadWorker {
|
||||
protected Socket socket;
|
||||
protected ObjectInputStream objectInputStream;
|
||||
protected ObjectOutputStream objectOutputStream;
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
package mimis.util;
|
||||
|
||||
import base.worker.Worker;
|
||||
import mimis.util.multiplexer.SignalListener;
|
||||
import mimis.value.Signal;
|
||||
import base.work.Work;
|
||||
|
||||
public class Multiplexer<T> extends Worker {
|
||||
public class Multiplexer<T> extends Work {
|
||||
public static final int TIMEOUT = 150;
|
||||
|
||||
protected int threshold;
|
||||
@@ -37,12 +37,12 @@ public class Multiplexer<T> extends Worker {
|
||||
}
|
||||
|
||||
public synchronized void add(T object) {
|
||||
if (this.type == null) {
|
||||
if (type == null) {
|
||||
signalListener.add(Signal.BEGIN, object);
|
||||
this.type = object;
|
||||
type = object;
|
||||
end = true;
|
||||
start();
|
||||
} else if (this.type.equals(object)) {
|
||||
} else if (type.equals(object)) {
|
||||
end = false;
|
||||
notifyAll();
|
||||
} else {
|
||||
@@ -54,7 +54,7 @@ public class Multiplexer<T> extends Worker {
|
||||
}
|
||||
}
|
||||
|
||||
protected void work() {
|
||||
public void work() {
|
||||
try {
|
||||
synchronized (this) {
|
||||
wait(TIMEOUT);
|
||||
|
||||
Reference in New Issue
Block a user