
org.freedesktop.dbus.connections.base.PendingCallbackManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dbus-java-osgi Show documentation
Show all versions of dbus-java-osgi Show documentation
Improved version of the DBus-Java library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/).
This is the OSGi compliant bundle of all required libraries in one bundle.
package org.freedesktop.dbus.connections.base;
import org.freedesktop.dbus.DBusAsyncReply;
import org.freedesktop.dbus.connections.AbstractConnection;
import org.freedesktop.dbus.interfaces.CallbackHandler;
import org.freedesktop.dbus.messages.MethodCall;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class PendingCallbackManager {
private final Map> pendingCallbacks;
private final Map> pendingCallbackReplys;
PendingCallbackManager() {
pendingCallbacks = new ConcurrentHashMap<>();
pendingCallbackReplys = new ConcurrentHashMap<>();
}
public synchronized void queueCallback(MethodCall _call, Method _method, CallbackHandler> _callback, AbstractConnection _connection) {
pendingCallbacks.put(_call, _callback);
pendingCallbackReplys.put(_call, new DBusAsyncReply<>(_call, _method, _connection));
}
public synchronized CallbackHandler extends Object> removeCallback(MethodCall _methodCall) {
pendingCallbackReplys.remove(_methodCall);
return pendingCallbacks.remove(_methodCall);
}
public synchronized CallbackHandler extends Object> getCallback(MethodCall _methodCall) {
return pendingCallbacks.get(_methodCall);
}
public synchronized DBusAsyncReply> getCallbackReply(MethodCall _methodCall) {
return pendingCallbackReplys.get(_methodCall);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy