All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sqlite.UnlockNotificationCallback Maven / Gradle / Ivy

The newest version!
package org.sqlite;

import java.util.Map;
import java.util.WeakHashMap;

import org.bytedeco.javacpp.Pointer;
import org.bytedeco.javacpp.PointerPointer;
import org.sqlite.SQLite.sqlite3;

class UnlockNotificationCallback extends UnlockNotifyCallback {
	static final UnlockNotificationCallback INSTANCE = new UnlockNotificationCallback();

	private final Map unlockNotifications = new WeakHashMap<>();

	private UnlockNotificationCallback() {
	}

	synchronized UnlockNotification add(sqlite3 db) {
		return unlockNotifications.computeIfAbsent(db, k -> new UnlockNotification());
	}

	@Override
	public void notify(PointerPointer args, int nArg) {
		for (int i = 0; i < nArg; i++) {
			UnlockNotification notif = unlockNotifications.get(args.get(i));
			notif.fire();
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy