Package VASSAL.tools.ipc
Class IPCMessenger
java.lang.Object
VASSAL.tools.ipc.IPCMessenger
public class IPCMessenger extends Object
-
Field Summary
Fields Modifier and Type Field Description protected ObjectInputStreaminprotected MultiEventListenerSupportlsupprotected AtomicLongnext_idprotected ObjectOutputStreamoutprotected BlockingQueue<IPCMessage>outqueueprotected Map<Long,CompletableFuture<IPCMessage>>waiting -
Constructor Summary
Constructors Constructor Description IPCMessenger(InputStream in, OutputStream out)IPCMessenger(InputStream in, OutputStream out, MultiEventListenerSupport lsup)IPCMessenger(Socket sock) -
Method Summary
Modifier and Type Method Description <T> voidaddEventListener(Class<T> c, EventListener<? super T> l)Adds anEventListener.<T> List<EventListener<? super T>>getEventListeners(Class<T> c)Notify the listeners of an event.booleanhasEventListeners(Class<?> c)Checks whether there are anyEventListeners.<T> voidremoveEventListener(Class<T> c, EventListener<? super T> l)Removes anEventListener.Future<IPCMessage>send(IPCMessage msg)voidstart()voidstop()
-
Field Details
-
next_id
-
waiting
-
outqueue
-
in
-
out
-
lsup
-
-
Constructor Details
-
IPCMessenger
public IPCMessenger(InputStream in, OutputStream out, MultiEventListenerSupport lsup) throws IOException- Throws:
IOException
-
IPCMessenger
- Throws:
IOException
-
IPCMessenger
- Throws:
IOException
-
-
Method Details
-
start
- Throws:
IOException
-
stop
- Throws:
IOException
-
send
- Throws:
IOException
-
addEventListener
Adds anEventListener.- Parameters:
c- the class to listen forl- the listener to add
-
removeEventListener
Removes anEventListener.- Parameters:
c- the class to checkl- the listener to remove
-
hasEventListeners
Checks whether there are anyEventListeners.- Parameters:
c- the class to check- Returns:
trueif there are any listeners for the given class
-
getEventListeners
Notify the listeners of an event.- Parameters:
event- the event to send
-