
org.freedesktop.dbus.connections.PendingCallbackManager Maven / Gradle / Ivy
Go to download
Slightly improved version of the Java DBus library
provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/).
Changes:
- Fixed lot's of Java warnings
- Fixed broken 'Gettext' feature (Exceptions on unsupported languages, usage of "_" as method name).
- Renamed some classes/methods/variables to comply with Java naming scheme.
- Removed usage of proprietary logger and replaced it with sl4fj.
- Renamed/refactored some parts to be more 'Java' like (e.g. naming, shadowing)
- Fixed problems with DbusConnection.getConnection(SESSION) when using display export (e.g. SSH X11 forward)
package org.freedesktop.dbus.connections;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.freedesktop.dbus.DBusAsyncReply;
import org.freedesktop.dbus.interfaces.CallbackHandler;
import org.freedesktop.dbus.messages.MethodCall;
public class PendingCallbackManager {
private Map> pendingCallbacks;
private 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