Search in sources :

Example 1 with DurableStoreEntry

use of com.swiftmq.swiftlet.store.DurableStoreEntry in project swiftmq-ce by iitsoftware.

the class DurableSubscriberStoreImpl method next.

public synchronized Object next() {
    String name = iterFiles[iterPos];
    iterClientId = name.substring(0, name.indexOf(DELIMITER));
    iterDurableName = name.substring(name.indexOf(DELIMITER) + 1, name.indexOf(EXTENSION));
    DurableStoreEntry entry = null;
    try {
        entry = getDurableStoreEntry(iterClientId, iterDurableName);
    } catch (Exception e) {
        throw new RuntimeException(e.toString());
    }
    iterPos++;
    return entry;
}
Also used : DurableStoreEntry(com.swiftmq.swiftlet.store.DurableStoreEntry) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 2 with DurableStoreEntry

use of com.swiftmq.swiftlet.store.DurableStoreEntry in project swiftmq-ce by iitsoftware.

the class DurableSubscriberStoreImpl method getDurableStoreEntry.

public synchronized DurableStoreEntry getDurableStoreEntry(String clientId, String durableName) throws StoreException {
    String filename = getDurableFilename(clientId, durableName);
    File f = new File(dir, filename);
    if (!f.exists())
        throw new StoreException(f.getAbsolutePath() + " does not exists");
    Map map = null;
    try {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
        map = (HashMap) ois.readObject();
        ois.close();
    } catch (Exception e) {
        throw new StoreException(e.toString());
    }
    DurableStoreEntry entry = new DurableStoreEntry(clientId, durableName, (String) map.get("topicName"), (String) map.get("selector"), map.get("noLocal") != null);
    return entry;
}
Also used : Map(java.util.Map) HashMap(java.util.HashMap) DurableStoreEntry(com.swiftmq.swiftlet.store.DurableStoreEntry) StoreException(com.swiftmq.swiftlet.store.StoreException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 3 with DurableStoreEntry

use of com.swiftmq.swiftlet.store.DurableStoreEntry in project swiftmq-ce by iitsoftware.

the class TopicManagerImpl method loadDurables.

private HashMap loadDurables() throws Exception {
    HashMap map = new HashMap();
    durableStore = ctx.storeSwiftlet.getDurableSubscriberStore();
    for (Iterator iter = durableStore.iterator(); iter.hasNext(); ) {
        DurableStoreEntry entry = (DurableStoreEntry) iter.next();
        map.put(entry.getClientId() + DURABLE_DELIMITER + entry.getDurableName(), new DurableSubscription(entry));
    }
    return map;
}
Also used : DurableStoreEntry(com.swiftmq.swiftlet.store.DurableStoreEntry)

Aggregations

DurableStoreEntry (com.swiftmq.swiftlet.store.DurableStoreEntry)3 StoreException (com.swiftmq.swiftlet.store.StoreException)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1