Skip to content

Commit

Permalink
MNEMONIC-467: Simplify the example code of ShowOrder by using Factory…
Browse files Browse the repository at this point in the history
…ProxyHelper
  • Loading branch information
yzz127 committed Mar 5, 2018
1 parent 1866b1e commit bed9ba4
Showing 1 changed file with 2 additions and 28 deletions.
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

0 comments on commit bed9ba4

Please sign in to comment.