Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNEMONIC-467: Simplify the example code of ShowOrder by using FactoryProxyHelper #95

Merged
merged 1 commit into from Mar 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -19,9 +19,8 @@

import org.apache.mnemonic.DurableType;
import org.apache.mnemonic.EntityFactoryProxy;
import org.apache.mnemonic.EntityFactoryProxyHelper;
import org.apache.mnemonic.NonVolatileMemAllocator;
import org.apache.mnemonic.ParameterHolder;
import org.apache.mnemonic.RestorableAllocator;
import org.apache.mnemonic.Utils;

public class ShowOrder {
Expand All @@ -34,32 +33,7 @@ public static void main(String[] argv) throws Exception {

DurableType listgftypes[] = {DurableType.DURABLE};

EntityFactoryProxy listefproxies[] = {
new EntityFactoryProxy() {
@Override
public <A extends RestorableAllocator<A>> Product restore(
A allocator, EntityFactoryProxy[] factoryproxys,
DurableType[] gfields, long phandler, boolean autoreclaim) {
return ProductFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
}
@Override
public <A extends RestorableAllocator<A>> Product restore(ParameterHolder<A> ph) {
return ProductFactory.restore(ph.getAllocator(),
ph.getEntityFactoryProxies(), ph.getGenericTypes(), ph.getHandler(), ph.getAutoReclaim());
}
@Override
public <A extends RestorableAllocator<A>> Product create(
A allocator, EntityFactoryProxy[] factoryproxys,
DurableType[] gfields, boolean autoreclaim) {
return ProductFactory.create(allocator, factoryproxys, gfields, autoreclaim);
}
@Override
public <A extends RestorableAllocator<A>> Product create(ParameterHolder<A> ph) {
return ProductFactory.create(ph.getAllocator(),
ph.getEntityFactoryProxies(), ph.getGenericTypes(), ph.getAutoReclaim());
}
}
};
EntityFactoryProxy listefproxies[] = {new EntityFactoryProxyHelper<Product>(Product.class) };

long hdl = 0L;
for (long keyid = 1; keyid <= 3; keyid++) {
Expand Down