Ticket #7 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

KeyCoordinator Problem

Reported by: goiss Owned by:
Priority: major Milestone:
Component: MozartSpaces Version:
Keywords: Cc:

Description (last modified by christian) (diff)

Aus dem TUWIS-Forum:

Shift auf einem KeyCoordinator Container mit einem KeySelector sollte einen bestehenden Eintrag mit diesem Key überschreiben, oder? Wenn man zwei mal den gleichen Value hineinshiftet (also v1.equals(v2) == true), wird mittels KeySelector nichts mehr gefunden...

Output des Beispiels: Container size (random): 1 Entry found by key sel. Container size (random): 1 Entry NOT found by key sel.

private static void printContainerSize(
ContainerRef ref, ICapi capi) throws XCoreException {
System.out.printf(
"Container size (random): %d\n", capi.read(ref, 0, null,
new RandomSelector(Selector.CNT_ALL)).length);
try {
capi.read(ref, 0, null, new KeySelector("key", "test"));
System.out.printf("Entry found by key sel.\n");
} catch (CountNotMetException cnme) {
System.out.printf("Entry NOT found by key sel.\n");
}
}

public static void main(String[] args) {
ICapi capi = null;
Transaction tx = null;
try {
capi = new Capi();
ContainerRef ref1 = capi.createContainer(
null, null, "ref1", IContainer.INFINITE_SIZE, new KeyCoordinator());
tx = capi.createTransaction(null, ICapi.INFINITE_TIMEOUT);
Entry e = new AtomicEntry<String>("test", String.class, new KeySelector("key", "test"));
capi.shift(ref1, tx, e);
capi.commitTransaction(tx);
printContainerSize(ref1, capi);
tx = capi.createTransaction(null, ICapi.INFINITE_TIMEOUT);
e = new AtomicEntry<String>("test", String.class, new KeySelector("key", "test"));
capi.shift(ref1, tx, e);
capi.commitTransaction(tx);
printContainerSize(ref1, capi);
} catch (XCoreException ex) {
try {
capi.rollbackTransaction(tx);
} catch (XCoreException e) {
e.printStackTrace();
}
ex.printStackTrace();
} finally {
if (capi != null) {
try {
capi.shutdown(null, true);
} catch (XCoreException ex) {
ex.printStackTrace();
}
}
}
}

Change History

comment:1 Changed 4 years ago by christian

  • Description modified (diff)

comment:2 Changed 4 years ago by christian

  • Status changed from new to closed
  • Resolution set to fixed

fixed in rev. 2558

comment:3 Changed 2 years ago by sim

 decoration Changed 1 year ago by admin

 bathtub Changed 1 year ago by admin

 solar system Changed 1 year ago by admin

 stair parts Changed 1 year ago by admin

 solar supply Changed 1 year ago by admin

Note: See TracTickets for help on using tickets.