@Override public Iterable<SchemaEntry> allEntries() { Iterable<SchemaEntry> all = super.allEntries(); for (SchemaEntry entry : all) { cache.add(entry); } return all; } }
@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { return cache.add(super.registerIfLatest(schema, latest)); }
@Override public SchemaEntry lookupById(String id) { SchemaEntry entry = cache.lookupById(id); if (entry == null) { return cache.add(super.lookupById(id)); } return entry; }
@Override public SchemaEntry register(String schema) throws SchemaValidationException { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.register(schema)); } return entry; }
@Override public SchemaEntry lookupBySchema(String schema) { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.lookupBySchema(schema)); } return entry; }
@Override public SchemaEntry lookupById(String id) { SchemaEntry entry = cache.lookupById(id); if (entry == null) { return cache.add(super.lookupById(id)); } return entry; }
@Override public SchemaEntry register(String schema) throws SchemaValidationException { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.register(schema)); } return entry; }
@Override public SchemaEntry lookupBySchema(String schema) { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.lookupBySchema(schema)); } return entry; }
@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { return cache.add(super.registerIfLatest(schema, latest)); }
@Override public Iterable<SchemaEntry> allEntries() { Iterable<SchemaEntry> all = super.allEntries(); for (SchemaEntry entry : all) { cache.add(entry); } return all; } }
@Override public SchemaEntry register(String schema) throws SchemaValidationException { while (true) { Iterable<SchemaEntry> schemaEntries = allEntries(); SchemaEntry actualLatest = null; for (SchemaEntry entry : schemaEntries) { actualLatest = entry; break; } validator.validate(schema, schemaEntries); SchemaEntry registered = super.registerIfLatest(schema, actualLatest); // if registered is not null, it was successful if (null != registered) { return registered; } } }
@Override public SchemaEntry register(String schema) throws SchemaValidationException { while (true) { Iterable<SchemaEntry> schemaEntries = allEntries(); SchemaEntry actualLatest = null; for (SchemaEntry entry : schemaEntries) { actualLatest = entry; break; } validator.validate(schema, schemaEntries); SchemaEntry registered = super.registerIfLatest(schema, actualLatest); // if registered is not null, it was successful if (null != registered) { return registered; } } }
@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { Iterable<SchemaEntry> schemaEntries = allEntries(); SchemaEntry actualLatest = null; for (SchemaEntry entry : schemaEntries) { actualLatest = entry; break; } if (actualLatest == latest || ((actualLatest != null) && actualLatest.equals(latest))) { // they are equal, either both are null or they equal validator.validate(schema, schemaEntries); return super.registerIfLatest(schema, latest); } else { return null; } } }
@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { Iterable<SchemaEntry> schemaEntries = allEntries(); SchemaEntry actualLatest = null; for (SchemaEntry entry : schemaEntries) { actualLatest = entry; break; } if (actualLatest == latest || ((actualLatest != null) && actualLatest.equals(latest))) { // they are equal, either both are null or they equal validator.validate(schema, schemaEntries); return super.registerIfLatest(schema, latest); } else { return null; } } }